show total commits on repo page

This commit is contained in:
hazycora 2023-08-03 06:54:13 -05:00
parent 6e3e5b9876
commit a11787b18d
No known key found for this signature in database
GPG key ID: 215AF1F81F86940E

View file

@ -2,7 +2,8 @@
<%
let description = it.repo.description?.replace(/https?:\/\/([\S]+)/g, '$1')
function prettyNumber(number) {
if (number < 1000) return number
if (number < 10) return number
if (number < 1000) return Math.floor(number/10) * 10 + '+'
return Math.floor(number / 1000)+'k'
}
%>
@ -20,7 +21,11 @@
</div>
</div>
<div class="info-line">
<% if (it.repo.open_issues_count > 0 || it.repo.stars_count > 0 || it.repo.forks_count > 0) { %>
<% if (!it.repo.empty) { %>
<div class="fact">
<p class="fact-heading"><%= prettyNumber(it.repo.commits_count) %></p>
<p class="fact-subtitle"><%= (it.repo.commits_count) != 1 ? 'Commits' : 'Commit' %></p>
</div>
<div class="fact">
<p class="fact-heading"><%= prettyNumber(it.repo.open_issues_count) %></p>
<p class="fact-subtitle"><%= (it.repo.open_issues_count) != 1 ? 'Issues' : 'Issue' %></p>