Skip to content

Commit

Permalink
Merge pull request #953 from Dudrie/fix-short-test-passed-state-not-c…
Browse files Browse the repository at this point in the history
…orrect

Fix wrong calculation of short test passed state.
  • Loading branch information
Dudrie authored Mar 1, 2021
2 parents c536fb8 + 454bdb9 commit c6548ba
Showing 1 changed file with 3 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -73,16 +73,9 @@ export class ShortTestCriteria extends PossiblePercentageCriteria {
const achieved = student.getGrading(shortTest)?.points ?? 0;
const total = shortTest.totalPoints.must;

let state = PassedState.NOT_PASSED;
if (this.isPercentagePerTest) {
if (shortTest.hasPassed(student)) {
state = PassedState.PASSED;
}
} else {
if (achieved >= this.valuePerTestNeeded) {
state = PassedState.PASSED;
}
}
const state = shortTest.hasPassed(student)
? PassedState.PASSED
: PassedState.NOT_PASSED;

return {
passed: state === PassedState.PASSED ? prev.passed + 1 : prev.passed,
Expand Down

0 comments on commit c6548ba

Please sign in to comment.