Append total posts count at the end of the leaderboard.

This commit is contained in:
Pachira 2023-08-31 00:52:14 +00:00
parent e222009dd0
commit 6fc10984e1
2 changed files with 9 additions and 3 deletions

View file

@ -98,10 +98,16 @@ if($mode === 'markdown') {
MD;
foreach($rankings as $ranking)
$totalPostsCount = 0;
foreach($rankings as $ranking) {
$totalPostsCount += $ranking->postsCount;
$markdown .= sprintf("| %s | [%s](%s%s) | %s |\r\n", $ranking->position,
$ranking->user?->getName() ?? 'Deleted User',
url_prefix(false), url('user-profile', ['user' => $ranking->userId]), $ranking->postsCount);
url_prefix(false), url('user-profile', ['user' => $ranking->userId]), number_format($ranking->postsCount));
}
$markdown .= sprintf("\r\nIn total %s posts were made!\r\n", number_format($totalPostsCount));
Template::set('leaderboard_markdown', $markdown);
}

View file

@ -115,7 +115,7 @@
{% if members|length >= 20 %}
<div style="text-align: center; padding: 10px;">
<a href="{{ url('search-query', {'section': 'posts', 'query': search_merge_query({'type': 'member', 'after': members|last.info.id})}) }}" class="input__button">Load next 20 posts...</a>
<a href="{{ url('search-query', {'section': 'posts', 'query': search_merge_query({'type': 'member', 'after': members|last.info.id})}) }}" class="input__button">Load next 20 members...</a>
</div>
{% endif %}
</div>