domjudge
domjudge copied to clipboard
The first solved is not calculated for some case
Description of the problem
DOMjudge is unable to calculate first solved data correctly in a specific case described below.
Recalculation (Refresh scoreboard cache from jury UI) can recalculates correctly, but it'd be great if DOMjudge can handle this case.
Your environment
Any of DOMjudge 8.2.1, 8.2.2, 2cd74e91c35122ad1eae325520e573c71b11a032 (using docker-contributor image on Ubuntu 22.04)
Steps to reproduce
If the following happens in this order for a specific problem, the first solved is not calculated:
- Team A submits a solution.
- Team B submits a solution.
- Team B's solution is returned as accepted. At this point, Team A's solution is still under judging.
- Team A's solution is returned as incorrect.
At the point of returning the result of Team B (step 3), the first solved cannot be determined. However, once the Team A's submission is returned (at step 4), because there's no pending submission that was submitted before the Team B's submission, the Team B's submission is expected to be marked as the first solved.
For local testing, it's easy to reproduce this by extending timelimit of a problem longer (e.g. 60 seconds) and submitting a TLE solution as a team A's one.
Expected behaviour
Once the Team B's solution can be determined as the first solved, then the scoreboard shows it.
Actual behaviour
The first solved is still N/A even after the first solved can be determined.
Requesting recalculation of the scoreboard fixes it.
This sounds very similar to #2105. Is this already fixed in main @nickygerritsen ?
Seems not since @tossy310 tested it there as well. We should investigate
Yes, I've tested on the HEAD of main, and the issue exists there as well.
If I read code correctly, the problem is that this part of code
https://github.com/DOMjudge/domjudge/blob/2cd74e91c35122ad1eae325520e573c71b11a032/webapp/src/Service/ScoreboardService.php#L417-L467
is responsible to update first-to-solve, but this is called only for the corresponding team's submission. (except recalculation of the cache).
https://github.com/DOMjudge/domjudge/pull/527 (an old PR) changed logics around here, and it prevents updating first-to-solve at step 3 in my reproduction step, but it didn't add any logic to recalculate first-to-solve at step 4 in the step.
I opened a PR with a potential fix. Thanks for finding this!