Skip to content

Commit

Permalink
Fix test case cacheing
Browse files Browse the repository at this point in the history
  • Loading branch information
mraron committed Apr 10, 2024
1 parent dbeeafc commit 5b76d21
Showing 1 changed file with 8 additions and 7 deletions.
15 changes: 8 additions & 7 deletions pkg/problems/tasktype/batch/batch.go
Original file line number Diff line number Diff line change
Expand Up @@ -303,16 +303,17 @@ func (b Batch) Run(judging problems.Judgeable, sp *language.SandboxProvider, lan
}

if _, ok := testCache[tc.InputPath]; ok {
tmpIndex, tmpGroup := tc.Index, tc.Group
maxScore := tc.MaxScore
*tc = *testCache[tc.InputPath]
tc.Index = tmpIndex
tc.Group = tmpGroup
if tc.MaxScore > 0 {
if testCache[tc.InputPath].MaxScore > 0 {
tmpIndex, tmpGroup := tc.Index, tc.Group
maxScore := tc.MaxScore
*tc = *testCache[tc.InputPath]
tc.Index = tmpIndex
tc.Group = tmpGroup

tc.Score = tc.Score / tc.MaxScore * maxScore
tc.MaxScore = maxScore
continue
}
continue
}
testCache[tc.InputPath] = tc

Expand Down

0 comments on commit 5b76d21

Please sign in to comment.