Skip to content

Commit

Permalink
[pre-commit.ci] auto fixes from pre-commit.com hooks
Browse files Browse the repository at this point in the history
for more information, see https://pre-commit.ci
  • Loading branch information
pre-commit-ci[bot] committed Aug 27, 2024
1 parent 9c4d9ec commit 260f006
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions contest/contest/tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,13 +40,15 @@ def auto_save_redis_to_database() -> None:
# # 从 Redis 获取现有的答案缓存
cached_answers = cache.get(cache_key, {})

if cached_answers is not None: # 防止未提交的是白卷
if cached_answers is not None: # 防止未提交的是白卷
for question_id, choice_id in cached_answers.items():
# Filter out tokens
if not question_id.startswith("question-"):
continue

if not isinstance(choice_id, str) or not choice_id.startswith("choice-"):
if not isinstance(choice_id, str) or not choice_id.startswith(
"choice-"
):
return

answer: DraftAnswer = get_object_or_404(
Expand Down Expand Up @@ -75,4 +77,4 @@ def auto_save_redis_to_database() -> None:
print(e)

r.delete(key)
r.delete(':1:' + ddl_key[:-4] + '_json')
r.delete(":1:" + ddl_key[:-4] + "_json")

0 comments on commit 260f006

Please sign in to comment.