Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Late adjustment patch #489

Merged
merged 2 commits into from
Nov 23, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 5 additions & 3 deletions src/main/java/edu/byu/cs/autograder/score/Scorer.java
Original file line number Diff line number Diff line change
Expand Up @@ -318,9 +318,11 @@ private Rubric.Results mergeResultsWithPrevious(Rubric.RubricType rubricType, Ru
float score = startingScore;

for (Submission previousSubmission : previousSubmissions) {
Rubric.RubricItem previousItem = previousSubmission.rubric().items().get(rubricType);
if (previousItem != null && previousItem.results().rawScore() <= results.rawScore()) {
score = Math.max(score, previousItem.results().score());
if(previousSubmission.passed()) {
Rubric.RubricItem previousItem = previousSubmission.rubric().items().get(rubricType);
if (previousItem != null && previousItem.results().rawScore() <= results.rawScore()) {
score = Math.max(score, previousItem.results().score());
}
}
}

Expand Down
15 changes: 15 additions & 0 deletions src/test/java/edu/byu/cs/autograder/score/ScorerTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -274,6 +274,21 @@ void score_doesNotDecrease_when_distributedHigherPriorScore() throws CanvasExcep
Assertions.assertEquals(UNIT_TESTS_POSSIBLE_POINTS, rubricItems.get(Rubric.RubricType.UNIT_TESTS).results().score());
}

@Test
void score_doesDecrease_when_higherPriorScoreOfFailedSubmission() throws CanvasException, DataAccessException {
Submission lastSubmission = previousSubmissionHelper(
new Phase3SubmissionValues(0, CODE_QUALITY_POSSIBLE_POINTS, UNIT_TESTS_POSSIBLE_POINTS, -1),
new Phase3SubmissionValues(PASSOFF_POSSIBLE_POINTS, CODE_QUALITY_POSSIBLE_POINTS, UNIT_TESTS_POSSIBLE_POINTS, 30)
);

Assertions.assertNotNull(lastSubmission);
EnumMap<Rubric.RubricType, Rubric.RubricItem> rubricItems = lastSubmission.rubric().items();

Assertions.assertEquals(PASSOFF_POSSIBLE_POINTS / 2f, rubricItems.get(Rubric.RubricType.PASSOFF_TESTS).results().score());
Assertions.assertEquals(CODE_QUALITY_POSSIBLE_POINTS / 2f, rubricItems.get(Rubric.RubricType.QUALITY).results().score());
Assertions.assertEquals(UNIT_TESTS_POSSIBLE_POINTS / 2f, rubricItems.get(Rubric.RubricType.UNIT_TESTS).results().score());
}

// Helper Methods for constructing

/**
Expand Down