| 588 | } |
| 589 | |
| 590 | static thresholdForScore ({ level, type, score }) { |
| 591 | let levelScoreType, levelScoreTypes |
| 592 | if (!(levelScoreTypes = level.scoreTypes)) { return null } |
| 593 | if (!(levelScoreType = _.find(levelScoreTypes, { type }))) { return null } |
| 594 | for (const threshold of ['gold', 'silver', 'bronze']) { |
| 595 | let achieved |
| 596 | const thresholdValue = levelScoreType.thresholds[threshold] |
| 597 | if (Array.from(LevelConstants.lowerIsBetterScoreTypes).includes(type)) { |
| 598 | achieved = score <= thresholdValue |
| 599 | } else { |
| 600 | achieved = score >= thresholdValue |
| 601 | } |
| 602 | if (achieved) { |
| 603 | return threshold |
| 604 | } |
| 605 | } |
| 606 | } |
| 607 | |
| 608 | isSummative () { |
| 609 | return ['open-ended', 'cumulative'].includes(this.get('assessment')) |