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

add "total score" and average score to maintainers page #179

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
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
1 change: 1 addition & 0 deletions app/components/total-score.hbs
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Total Score: {{this.score}} Average Score: {{this.averageScore}}
24 changes: 24 additions & 0 deletions app/components/total-score.js
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);
}
}
1 change: 1 addition & 0 deletions app/templates/maintainers/show.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
{{this.model.name}}
</h1>
<p>{{pluralize-this this.model.addons.length "addon"}} maintained by {{this.model.name}}.</p>
<TotalScore @addons={{this.model.addons}} />
</header>
<AddonList @addons={{this.model.addons}} />
</div>