-
Notifications
You must be signed in to change notification settings - Fork 65
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add "total score" and average score to maintainers page
- Loading branch information
Showing
3 changed files
with
26 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
Total Score: {{this.score}} Average Score: {{this.averageScore}} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
import Component from '@glimmer/component'; | ||
|
||
export default class TotalScoreComponent extends Component { | ||
get score() { | ||
if(!this.args.addons.length) { | ||
return 0; | ||
} | ||
|
||
let score = this.args.addons.reduce((total, currentAddon) => { | ||
return currentAddon.score + total; | ||
}, 0); | ||
|
||
return score.toFixed(1); | ||
} | ||
|
||
get averageScore() { | ||
if (!this.score || !this.args.addons.length){ | ||
return 0; | ||
} | ||
|
||
let average = this.score / this.args.addons.length; | ||
return average.toFixed(1); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters