From 590981ae112d4d10b5aa18ac00f945039937a338 Mon Sep 17 00:00:00 2001 From: Jonathan Wu Date: Mon, 6 Jan 2025 17:38:14 -0500 Subject: [PATCH] Bug fix --- src/views/api.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/views/api.py b/src/views/api.py index 90c3e8f..accf9b9 100644 --- a/src/views/api.py +++ b/src/views/api.py @@ -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 + 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)