Skip to content

Commit

Permalink
Fixed the verdict in contest mode all or nothing when score is 0 (#126)
Browse files Browse the repository at this point in the history
Added the verdict "WA" when score is 0 in contest mode "All or nothing"

Fixes: omegaup/omegaup#7000
  • Loading branch information
pabo99 authored Aug 12, 2023
1 parent 2fd1cb9 commit 73485f9
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
4 changes: 3 additions & 1 deletion cmd/omegaup-grader/frontend_handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -277,9 +277,11 @@ func broadcastRun(
}
score := base.RationalToFloat(run.Result.Score)
contestScore := base.RationalToFloat(run.Result.ContestScore)
verdict := run.Result.Verdict
if run.ScoreMode == "all_or_nothing" && score != 1 {
score = 0
contestScore = 0
verdict = "WA"
}
msg := runFinishedMessage{
Message: "/run/update/",
Expand All @@ -293,7 +295,7 @@ func broadcastRun(
Score: score,
ContestScore: contestScore,
Status: "ready",
Verdict: run.Result.Verdict,
Verdict: verdict,
Language: run.Run.Language,
Time: -1,
SubmitDelay: -1,
Expand Down
2 changes: 1 addition & 1 deletion cmd/omegaup-grader/frontend_handler_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -383,7 +383,7 @@ func TestBroadcastRun(t *testing.T) {
},
{
scoreMode: "all_or_nothing",
verdict: "PA",
verdict: "WA",
score: big.NewRat(1, 2),
expectedScore: 0.,
scoreByGroup: map[string]any{
Expand Down

0 comments on commit 73485f9

Please sign in to comment.