Skip to content

Commit

Permalink
[IGNORE CI] Revert "Fix cs50==7.0.1 compatibility"
Browse files Browse the repository at this point in the history
cs50==7.0.2 fixes this
  • Loading branch information
jdabtieu committed Jul 30, 2021
1 parent 6ce57fa commit 79f618e
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 8 deletions.
8 changes: 4 additions & 4 deletions src/application.py
Original file line number Diff line number Diff line change
Expand Up @@ -741,10 +741,10 @@ def edit_contest_problem(contest_id, problem_id):
# Only edit score for statically scored problems whose value has changed
if data[0]["score_users"] == -1 and data[0]["point_value"] != new_points:
point_change = int(new_points) - data[0]["point_value"]
db.execute(("UPDATE contest_users SET points=? WHERE contest_id=? AND user_id "
"IN (SELECT user_id FROM contest_solved WHERE contest_id=? AND "
"problem_id=?)"),
point_change, contest_id, contest_id, problem_id)
db.execute(("UPDATE contest_users SET points=points+:point_change WHERE "
"contest_id=:cid AND user_id IN (SELECT user_id FROM contest_solved "
"WHERE contest_id=:cid AND problem_id=:pid)"),
point_change=point_change, cid=contest_id, pid=problem_id)
db.execute(("UPDATE contest_problems SET point_value=:pv WHERE contest_id=:cid "
"AND problem_id=:pid"),
pv=int(new_points), cid=contest_id, pid=problem_id)
Expand Down
9 changes: 5 additions & 4 deletions src/helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -156,10 +156,11 @@ def update_dyn_score(contest_id, problem_id, update_curr_user=True):
cid=contest_id, points=old_points, uid=session["user_id"])

# Update points of all users who previously solved the problem
db.execute(("UPDATE contest_users SET points=points + ? WHERE contest_id=? AND "
"user_id IN (SELECT user_id FROM contest_solved WHERE "
"contest_id=? AND problem_id=?)"),
point_diff, contest_id, contest_id, problem_id)
db.execute(("UPDATE contest_users SET points=points+:point_change "
"WHERE contest_id=:cid AND user_id IN "
"(SELECT user_id FROM contest_solved WHERE "
"contest_id=:cid AND problem_id=:pid)"),
point_change=point_diff, cid=contest_id, pid=problem_id)
db.execute("COMMIT")


Expand Down

0 comments on commit 79f618e

Please sign in to comment.