Fixed analytics.py and added new test

This commit is contained in:
gzub04 2024-06-16 23:40:07 +02:00
parent 2f117ea384
commit e784c47f4c
2 changed files with 4 additions and 2 deletions

View File

@ -79,7 +79,7 @@ def get_movie_rating_avg(movie_id):
def get_user_ratings(user_id): def get_user_ratings(user_id):
cursor = conn.cursor() cursor = conn.cursor()
cursor.execute(""" cursor.execute("""
SELECT * SELECT movie_ID, rating
FROM ratings FROM ratings
WHERE oauth_ID = %s; WHERE oauth_ID = %s;
""", (user_id,)) """, (user_id,))
@ -111,6 +111,6 @@ if __name__ == "__main__":
break break
cache.init_app(app) 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() conn.close()

View File

@ -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_movie_rating_avg/155
### ###
GET http://localhost:8082/api/get_user_ratings/1234
###