Skip to content

Commit

Permalink
Redirect if session_id not defined
Browse files Browse the repository at this point in the history
Co-authored-by: Artyom V. Gorchakov <[email protected]>
  • Loading branch information
Hekzory and worldbeater authored Feb 29, 2024
1 parent ff6ebf2 commit 10eecd1
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions webapp/views/student.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,10 +58,10 @@ def submissions(student: Student | None, page: int):
size = 5
session_id = request.cookies.get("anonymous_identifier")
if config.config.exam or not config.config.enable_registration:
submissions_statuses = statuses.get_anonymous_submissions_statuses(session_id, (page - 1) * size, size) \
if session_id else []
submissions_count = statuses.count_session_id_submissions(session_id) \
if session_id else 0
if not session_id:
return redirect('/')
submissions_statuses = statuses.get_anonymous_submissions_statuses(session_id, (page - 1) * size, size)
submissions_count = statuses.count_session_id_submissions(session_id)
elif student is not None:
submissions_statuses = statuses.get_submissions_statuses(student, (page - 1) * size, size)
submissions_count = statuses.count_student_submissions(student)
Expand Down

0 comments on commit 10eecd1

Please sign in to comment.