From e784c47f4c01af98e2d0495aab9917e996417a6e Mon Sep 17 00:00:00 2001 From: gzub04 Date: Sun, 16 Jun 2024 23:40:07 +0200 Subject: [PATCH] Fixed analytics.py and added new test --- connector/Include/analytics.py | 4 ++-- test_scripts/Test.http | 2 ++ 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/connector/Include/analytics.py b/connector/Include/analytics.py index 5c5fa729..56f0b3ce 100644 --- a/connector/Include/analytics.py +++ b/connector/Include/analytics.py @@ -79,7 +79,7 @@ def get_movie_rating_avg(movie_id): def get_user_ratings(user_id): cursor = conn.cursor() cursor.execute(""" - SELECT * + SELECT movie_ID, rating FROM ratings WHERE oauth_ID = %s; """, (user_id,)) @@ -111,6 +111,6 @@ if __name__ == "__main__": break cache.init_app(app) - app.run(host="0.0.0.0", port=8082, debug=True) + app.run(host="localhost", port=8082, debug=True) conn.close() diff --git a/test_scripts/Test.http b/test_scripts/Test.http index ce6174e1..af04531c 100644 --- a/test_scripts/Test.http +++ b/test_scripts/Test.http @@ -28,3 +28,5 @@ GET http://localhost:8082/api/get_users_number ### GET http://localhost:8082/api/get_movie_rating_avg/155 ### +GET http://localhost:8082/api/get_user_ratings/1234 +### \ No newline at end of file