Skip to content

Feature: last submission status#606

Merged
m4teuk merged 7 commits intosio2project:masterfrom
m4teuk:feature/last-submission-status
Mar 17, 2026
Merged

Feature: last submission status#606
m4teuk merged 7 commits intosio2project:masterfrom
m4teuk:feature/last-submission-status

Conversation

@m4teuk
Copy link
Copy Markdown
Contributor

@m4teuk m4teuk commented Dec 31, 2025

Added a badge to each problem row in the problems tab. The badge display the status of the users last submission for that problem, like "Initial tests: failed" or "Pending". It is displayed only for normal (not ignored submissions).
image
image

@m4teuk m4teuk marked this pull request as ready for review December 31, 2025 18:19
@m4teuk m4teuk requested a review from MasloMaslane as a code owner December 31, 2025 18:19
@m4teuk m4teuk requested a review from twalen December 31, 2025 18:19
Copy link
Copy Markdown
Member

@MasloMaslane MasloMaslane left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also I don't really like that the badge is next to the title. Maybe it could be immediately to the left of the score?

Comment thread oioioi/contests/views.py Outdated
Comment on lines +173 to +188
# Bulk fetch user's submissions for the problem instances and build a map
# of latest submission per problem instance. Submissions are ordered by
# date descending, so the first occurrence for a given problem_instance
# is the latest one.
submissions_qs = (
Submission.objects.filter(
user__id=request.user.id,
problem_instance_id__in=pi_ids,
kind="NORMAL" # ignore ignored submissions
)
.order_by("-date")
)
for s in submissions_qs:
pid = s.problem_instance_id
if pid not in last_submission_map:
last_submission_map[pid] = s
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it shouldn't always fetch last submission, for example in some contests max submission counts as the score (OI, OIJ).

In this PR #405 there are functions implemented that return scored submission effectively. Maybe you can copy them here.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As for me this looks safe, the column is clearly marked as "the last submission" and the link is pointing to a a submission that have been used

@twalen twalen linked an issue Feb 25, 2026 that may be closed by this pull request
Comment thread oioioi/contests/views.py Outdated
Comment thread oioioi/contests/tests/tests.py
@m4teuk m4teuk requested a review from twalen March 3, 2026 16:08
twalen
twalen previously approved these changes Mar 11, 2026
@m4teuk m4teuk requested a review from MasloMaslane March 11, 2026 16:02
Comment thread oioioi/contests/views.py Outdated
Comment thread oioioi/contests/views.py Outdated
# 7) can_submit
# Sorted by (start_date, end_date, round name, problem name)
# Preload user-related data to avoid N+1 queries
pi_ids = [pi.id for pi in problem_instances]
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

do we need this array? i believe it creates a sql query

@m4teuk m4teuk self-assigned this Mar 13, 2026
@sonarqubecloud
Copy link
Copy Markdown

Quality Gate Failed Quality Gate failed

Failed conditions
8 Security Hotspots

See analysis details on SonarQube Cloud

@m4teuk m4teuk requested a review from MasloMaslane March 15, 2026 18:06
@m4teuk
Copy link
Copy Markdown
Contributor Author

m4teuk commented Mar 15, 2026

Quality Gate Failed Quality Gate failed

Failed conditions 8 Security Hotspots

See analysis details on SonarQube Cloud

#652

@m4teuk m4teuk merged commit 79a393f into sio2project:master Mar 17, 2026
2 of 3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Last Submission Status in the Problems tab

3 participants