Skip to content

Commit

Permalink
grader: Show percentage instead of points when appropriate
Browse files Browse the repository at this point in the history
  • Loading branch information
fushar committed Aug 12, 2024
1 parent 68fa199 commit ea4169a
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -21,16 +21,17 @@ public AggregationResult aggregate(List<TestCaseVerdict> testCaseVerdicts, doubl
aggregatedVerdict = verdict;
}

String points;
String points = "";
if (verdict == Verdict.OK) {
double okPoints = 0.0;
if (testCaseVerdict.getPercentage().isPresent()) {
okPoints = testCaseVerdict.getPercentage().get() * subtaskPoints / 100.0;
points = testCaseVerdict.getPercentage().get() + "%";
} else if (testCaseVerdict.getPoints().isPresent()) {
okPoints = testCaseVerdict.getPoints().get();
points = "" + okPoints;
}
aggregatedPoints = Math.min(aggregatedPoints, okPoints);
points = "" + okPoints;
} else if (verdict == Verdict.ACCEPTED) {
points = "*";
} else if (verdict == Verdict.SKIPPED) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ void aggregate_min_ok_percentage() {

AggregationResult result = aggregator.aggregate(testCaseVerdicts, 70.0);
assertThat(result.getSubtaskVerdict()).isEqualTo(SubtaskVerdict.of(Verdict.OK, 17.5));
assertThat(result.getTestCasePoints()).containsExactly("*", "17.5", "35.0");
assertThat(result.getTestCasePoints()).containsExactly("*", "25%", "50%");
}

@Test
Expand Down

0 comments on commit ea4169a

Please sign in to comment.