Skip to content

Commit

Permalink
Display reviews count on teams main page
Browse files Browse the repository at this point in the history
Related: eloquence#199
  • Loading branch information
Poslovitch committed Jul 16, 2023
1 parent 283fa68 commit babea21
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 0 deletions.
1 change: 1 addition & 0 deletions locales/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -242,6 +242,7 @@
"moderator badge": "moderator",
"founder badge": "founder",
"number of members": "Number of members:",
"number of reviews": "Number of reviews:",
"view list": "(view list)",
"moderators": "Moderators:",
"membership roster": "Team roster: %s",
Expand Down
1 change: 1 addition & 0 deletions locales/fr.json
Original file line number Diff line number Diff line change
Expand Up @@ -258,6 +258,7 @@
"moderator badge": "modérateur",
"founder badge": "fondateur",
"number of members": "Nombre de membres :",
"number of reviews": "Nombre de critiques :",
"view list": "(afficher la liste)",
"moderators": "Modérateurs :",
"membership roster": "Constitution de l’équipe : %s",
Expand Down
1 change: 1 addition & 0 deletions locales/qqq.json
Original file line number Diff line number Diff line change
Expand Up @@ -244,6 +244,7 @@
"moderator badge": "Indicator badge next to a username shown if the user is moderator of a given team\n{{Identical|Moderator}}",
"founder badge": "Indicator badge next to a username shown if the user is founder of a given team\n{{Identical|Founder}}",
"number of members": "Label on team page for the number of members of a given team",
"number of reviews": "Label on team page for the number of reviews of a given team",
"view list": "Link on team page for getting a list of all members of a given team",
"moderators": "Label on team page for the moderators of a given team\n{{Identical|Moderator}}",
"membership roster": "Title on page providing a list of all members of a given team. %s is substituted with team name",
Expand Down
8 changes: 8 additions & 0 deletions models/team.js
Original file line number Diff line number Diff line change
Expand Up @@ -208,9 +208,17 @@ Team.getWithData = async function(id, {
team.reviews.pop();
team.reviewOffsetDate = team.reviews[team.reviews.length - 1].createdOn;
}

team.reviewsCount = await Team.getReviewsCount(id);

return team;
};

Team.getReviewsCount = async function(id) {
const team = await Team.get(id).getJoin({reviews: {teams: true}});
return team.reviews.length;
};

// NOTE: INSTANCE METHODS ------------------------------------------------------

// Standard handlers
Expand Down
4 changes: 4 additions & 0 deletions views/team.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,10 @@
<p>
{{!LINK TO ROSTER AND MODERATORS LIST}}
<b>{{{__ "number of members"}}}</b> {{{team.members.length}}} <a href="/team/{{{team.urlID}}}/members">{{{__ "view list"}}}</a>
</p>
<p>
<b>{{{__ "number of reviews"}}}</b> {{{team.reviewsCount}}}
</p>
<p>
<b>{{{__ "moderators"}}}</b>
<ul class="team-member-list">
Expand Down

0 comments on commit babea21

Please sign in to comment.