Skip to content

Commit

Permalink
Bug fix
Browse files Browse the repository at this point in the history
  • Loading branch information
jdabtieu committed Jan 6, 2025
1 parent b947269 commit 590981a
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/views/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,13 +69,13 @@ def check_instancer_perms(id):
data = db.execute(("SELECT * FROM contest_problems WHERE "
"contest_id=:cid AND problem_id=:pid"),
cid=contest_id, pid=problem_id)
has_perm |= len(data) > 0 and (data[0]["publish_timestamp"] is not None and

Check warning on line 72 in src/views/api.py

View workflow job for this annotation

GitHub Actions / build (ubuntu-latest)

W504 line break after binary operator

Check warning on line 72 in src/views/api.py

View workflow job for this annotation

GitHub Actions / build (windows-latest)

W504 line break after binary operator
parse_datetime(data[0]["publish_timestamp"]) <= datetime.utcnow())
else:
has_perm = api_perm(["ADMIN", "SUPERADMIN", "PROBLEM_MANAGER", "CONTENT_MANAGER"])
data = db.execute("SELECT * FROM problems WHERE id=:pid", pid=problem_id)

needs_admin = len(data) == 0 or (data[0]["publish_timestamp"] is None or
parse_datetime(data[0]["publish_timestamp"]) > datetime.utcnow())
if len(data) == 0 or (needs_admin and not has_perm):
if len(data) == 0 or not has_perm:
return ("Problem not found", 404)
if not data[0]["instanced"]: # Check if the problem is instanced
return ("This problem is not instanced", 400)
Expand Down

0 comments on commit 590981a

Please sign in to comment.