Skip to content

armgit / zulip

Public Imported from GitHub
0

Zulip server and web application. Open-source team chat that helps teams stay productive and focused.

team_page: Display count of contributors with >=100 commits.

Eeshan Gargf2e7b92b024c
diff --git a/static/js/portico/team.js b/static/js/portico/team.js
index 7e737143898..c2a06923957 100644
--- a/static/js/portico/team.js
+++ b/static/js/portico/team.js
@@ -68,21 +68,29 @@ export default function render_tabs() {
const count_template = _.template($("#count-template").html());
const total_count_template = _.template($("#total-count-template").html());
const contributors_list = page_params.contributors.filter((c) => exclude_bot_contributors(c));
- const total_tab_html = contributors_list
- .map((c) => ({
- name: get_display_name(c),
- github_username: c.github_username,
- avatar: c.avatar,
- profile_url: get_profile_url(c),
- commits: calculate_total_commits(c),
- }))
+ const mapped_contributors_list = contributors_list.map((c) => ({
+ name: get_display_name(c),
+ github_username: c.github_username,
+ avatar: c.avatar,
+ profile_url: get_profile_url(c),
+ commits: calculate_total_commits(c),
+ }));
+ const total_tab_html = mapped_contributors_list
.sort((a, b) => (a.commits < b.commits ? 1 : a.commits > b.commits ? -1 : 0))
.map((c) => template(c))
.join("");
+ const hundred_plus_total_contributors = mapped_contributors_list.filter(
+ (c) => c.commits >= 100,
+ );
+
$("#tab-total .contributors-grid").html(total_tab_html);
$("#tab-total").prepend(
- total_count_template({contributor_count: contributors_list.length, tab_name: "total"}),
+ total_count_template({
+ contributor_count: contributors_list.length,
+ tab_name: "total",
+ hundred_plus_contributor_count: hundred_plus_total_contributors.length,
+ }),
);
for (const repo_name of Object.keys(repo_name_to_tab_name)) {
@@ -113,9 +121,17 @@ export default function render_tabs() {
$(`#tab-${CSS.escape(tab_name)} .contributors-grid`).html(html);
const contributor_count = filtered_by_repo.length;
+ const hundred_plus_contributor_count = filtered_by_repo.filter(
+ (c) => c[repo_name] >= 100,
+ ).length;
const repo_url = `https://github.com/zulip/${repo_name}`;
$(`#tab-${CSS.escape(tab_name)}`).prepend(
- count_template({contributor_count, repo_name, repo_url}),
+ count_template({
+ contributor_count,
+ repo_name,
+ repo_url,
+ hundred_plus_contributor_count,
+ }),
);
loaded_repos.push(repo_name);
diff --git a/templates/zerver/team.html b/templates/zerver/team.html
index 6e9498feb42..34f3812b902 100644
--- a/templates/zerver/team.html
+++ b/templates/zerver/team.html
@@ -159,7 +159,7 @@
<script type="text/template" id="total-count-template">
<p class="contributor-count">
- <%= contributor_count %> total contributors
+ <%= contributor_count %> total contributors (<%= hundred_plus_contributor_count %> with 100+ commits)
</p>
</script>
@@ -169,6 +169,7 @@
<a href="<%= repo_url %>" target="_blank" rel="noopener noreferrer">
zulip/<%= repo_name %>
</a>
+ (<%= hundred_plus_contributor_count %> with 100+ commits)
</p>
</script>