domjudge icon indicating copy to clipboard operation
domjudge copied to clipboard

The first solved is not calculated for some case

Open tossy310 opened this issue 1 year ago • 7 comments
trafficstars

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:

  1. Team A submits a solution.
  2. Team B submits a solution.
  3. Team B's solution is returned as accepted. At this point, Team A's solution is still under judging.
  4. 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.

tossy310 avatar Dec 26 '23 06:12 tossy310

This sounds very similar to #2105. Is this already fixed in main @nickygerritsen ?

eldering avatar Dec 26 '23 15:12 eldering

Seems not since @tossy310 tested it there as well. We should investigate

nickygerritsen avatar Dec 26 '23 19:12 nickygerritsen

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.

tossy310 avatar Dec 27 '23 00:12 tossy310

I opened a PR with a potential fix. Thanks for finding this!

nickygerritsen avatar Dec 29 '23 10:12 nickygerritsen