online-judge icon indicating copy to clipboard operation
online-judge copied to clipboard

Add support for archiving a submission

Open int-y1 opened this issue 9 months ago • 5 comments

fixes #1767

an admin needs judge.archive_submission to archive submissions. there are 2 ways to archive a submission:

  1. go to /problem/<code>/manage/submission, turn on "Archive locked submissions", and click "Rejudge selected submissions"
    • my approach is to include locked submissions in the query, and then let Submissions.judge set is_archived to true
  2. go to /admin/judge/submission/<code>/change/ and toggle "Is archived"

user-facing changes when a submission is archived:

  • during point recalculation (e.g. /admin/judge/profile/ > Action > Recalculate scores): submission is not considered when recalculating points, problems solved, and pp
  • /user/<name>/solved: submission no longer appears in "Points breakdown" and in the problems solved table
  • /problem/<code>/rank/: submission no longer appears as a best solution
  • /submissions/ and /problem/<code>/submissions/: submission becomes partly transparent and gets an archive icon. see screenshot.

Screenshot 2025-03-02 171710

there are no admin-facing changes when a submission is archived

int-y1 avatar Mar 02 '25 09:03 int-y1

Codecov Report

Attention: Patch coverage is 47.72727% with 23 lines in your changes missing coverage. Please review.

Project coverage is 47.71%. Comparing base (fd7fb05) to head (7d1ef6b). Report is 75 commits behind head on master.

Files with missing lines Patch % Lines
judge/tasks/submission.py 22.22% 7 Missing :warning:
judge/signals.py 37.50% 5 Missing :warning:
judge/views/problem_manage.py 42.85% 4 Missing :warning:
judge/admin/submission.py 33.33% 2 Missing :warning:
judge/models/submission.py 60.00% 2 Missing :warning:
judge/models/profile.py 0.00% 1 Missing :warning:
judge/utils/problems.py 0.00% 1 Missing :warning:
judge/views/user.py 0.00% 1 Missing :warning:
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #2411      +/-   ##
==========================================
+ Coverage   46.76%   47.71%   +0.94%     
==========================================
  Files         251      261      +10     
  Lines       13317    13769     +452     
==========================================
+ Hits         6228     6570     +342     
- Misses       7089     7199     +110     

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

:rocket: New features to boost your workflow:
  • :snowflake: Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • :package: JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

codecov-commenter avatar Mar 02 '25 09:03 codecov-commenter

Overall ty for working on this, it looks great :)

Riolku avatar Mar 03 '25 01:03 Riolku

  • allow access to "Archive locked submissions". don't put this behind the "judge.archive_submission" permission.
  • add is_archived=False to more queries

int-y1 avatar Mar 04 '25 05:03 int-y1

I remember the reason we wanted "rejudge" to be "rejudge and archive" was because in most cases, you'd want to do both simultaneously. I think a compromise solution might be to have a button for "rejudge and archive", and possibly separate buttons for "rejudge" and "mark archived"?

Thoughts? @int-y1 @quantum5 @Ninjaclasher

kiritofeng avatar Mar 31 '25 06:03 kiritofeng

changes:

  • rebased the migration to 0151
  • moved the archiving code from Submission.judge to Submission.archive
  • rejudge_problem_filter will determine if the submission is rejudged or archived

i didn't add a button for only "mark archived" because it's not needed yet

int-y1 avatar Apr 11 '25 10:04 int-y1