Skip to content

Commit

Permalink
review functionality working minus getting user id
Browse files Browse the repository at this point in the history
  • Loading branch information
nfoster1492 committed Nov 15, 2023
1 parent 239717d commit 2366016
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
4 changes: 2 additions & 2 deletions src/recommenderapp/templates/review.html
Original file line number Diff line number Diff line change
Expand Up @@ -135,8 +135,6 @@
<script>

let rating = 0;

var comments = $("#comments").val()

var selectedMovie = ''; // Variable to store the selected movie

Expand Down Expand Up @@ -194,6 +192,8 @@

//MAKE POST CALL TO DB TO ADD MOVIE REVIEW TO TABLE

var comments = document.getElementById('comments').value;

data = {
movie: selectedMovie,
score: rating,
Expand Down
7 changes: 4 additions & 3 deletions src/recommenderapp/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,8 @@ def logintoAccount(db, username, password):

def submitReview(db, user, movie, score, review, timestamp):
executor = db.cursor()
executor.execute("SELECT idMovies FROM movies WHERE name = %s", movie)
movie_id = executor.fetchall()[0]
executor.execute("INSERT INTO popcornpicksdb.ratings(user_id, movie_id, score, review, time) VALUES (%d, %d, %d, %s, %s);", (user, movie_id, score, review, timestamp))
executor.execute("SELECT idMovies FROM movies WHERE name = %s", [movie])
movie_id = executor.fetchall()[0][0]
print("REVIEW IS " + review)
executor.execute("INSERT INTO popcornpicksdb.ratings(user_id, movie_id, score, review, time) VALUES (%s, %s, %s, %s, %s);", (int(user), int(movie_id), int(score), str(review), int(timestamp)))
db.commit()

0 comments on commit 2366016

Please sign in to comment.