Feature: last submission status#606
Conversation
MasloMaslane
left a comment
There was a problem hiding this comment.
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?
| # 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 |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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
| # 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] |
There was a problem hiding this comment.
do we need this array? i believe it creates a sql query
|
|


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).

