From 910ce894e87a4825f08669fae07567bb29b10574 Mon Sep 17 00:00:00 2001 From: Jourdan0803 Date: Tue, 10 Dec 2024 21:42:21 -0500 Subject: [PATCH] updates data api --- app/api/analysis_routes.py | 8 ++++++++ app/templates/index.html | 36 ++++++++++++++++++++++++++++-------- 2 files changed, 36 insertions(+), 8 deletions(-) diff --git a/app/api/analysis_routes.py b/app/api/analysis_routes.py index 6a57c84..cd9f013 100644 --- a/app/api/analysis_routes.py +++ b/app/api/analysis_routes.py @@ -71,7 +71,15 @@ def analyze_data(): try: start_year = int(start_year) end_year = int(end_year) + + if start_year > end_year: + return jsonify({"error": "Start year cannot be greater than end year"}), 404 + movie_data = get_movie_data(start_year, end_year) + + if not movie_data: + return jsonify({"error": "No data found for the specified years"}), 404 + current_app.logger.info("movie_data: %s", movie_data) except Exception as e: return jsonify({"error": str(e)}), 500 diff --git a/app/templates/index.html b/app/templates/index.html index 14659ac..b5f3fdd 100644 --- a/app/templates/index.html +++ b/app/templates/index.html @@ -88,7 +88,13 @@ -

Explore Movie Genres Over Time

+

Explore Movie Genres Over Time

+

+ This service allows users to analyze the popularity of different movie genres over a specified time range. +

+

+ Please enter a start year and end year to analyze the movie genres over time. +

@@ -98,10 +104,10 @@

Explore Movie Genres Over Time

-
- +
+
- +