add total number of comments and favs to rankingpage

This commit is contained in:
2026-05-17 12:06:40 +02:00
parent 46aec71c87
commit 9f0ad48342
6 changed files with 27 additions and 3 deletions

View File

@@ -176,10 +176,8 @@
"font_default": "Standard", "font_default": "Standard",
"theme": "Thema", "theme": "Thema",
"flash_section": "Flash", "flash_section": "Flash",
"flash_bg": "Flash im Hintergrund abspielen", "flash_bg": "Flash im Hintergrund abspielen",
"flash_bg_hint": "Verhindert, dass Ruffle pausiert, wenn der Tab verlassen wird", "flash_bg_hint": "Verhindert, dass Ruffle pausiert, wenn der Tab verlassen wird",
"notifications_section": "Benachrichtigungseinstellungen", "notifications_section": "Benachrichtigungseinstellungen",
"receive_system_notifications": "Systembenachrichtigungen erhalten", "receive_system_notifications": "Systembenachrichtigungen erhalten",
"receive_system_notifications_hint": "Benachrichtigungen über Erfolg/Fehler bei Hintergrund-Uploads umschalten. Kritische Moderationsaktionen werden immer angezeigt.", "receive_system_notifications_hint": "Benachrichtigungen über Erfolg/Fehler bei Hintergrund-Uploads umschalten. Kritische Moderationsaktionen werden immer angezeigt.",
@@ -444,6 +442,8 @@
"stat_sfw": "SFW-Inhalte", "stat_sfw": "SFW-Inhalte",
"stat_nsfw": "NSFW-Inhalte", "stat_nsfw": "NSFW-Inhalte",
"stat_deleted": "Gelöscht", "stat_deleted": "Gelöscht",
"stat_comments": "Gesamt Kommentare",
"stat_favs": "Gesamt Favoriten",
"most_favorited": "Meiste Favs", "most_favorited": "Meiste Favs",
"favs": "Favs", "favs": "Favs",
"top_xd": "Top xD-Score" "top_xd": "Top xD-Score"

View File

@@ -448,6 +448,8 @@
"stat_sfw": "SFW content", "stat_sfw": "SFW content",
"stat_nsfw": "NSFW content", "stat_nsfw": "NSFW content",
"stat_deleted": "Deleted", "stat_deleted": "Deleted",
"stat_comments": "Total Comments",
"stat_favs": "Total Favorites",
"most_favorited": "Most Favorited", "most_favorited": "Most Favorited",
"favs": "favs", "favs": "favs",
"top_xd": "Top xD Scores" "top_xd": "Top xD Scores"

View File

@@ -444,6 +444,8 @@
"stat_sfw": "SFW-inhoud", "stat_sfw": "SFW-inhoud",
"stat_nsfw": "NSFW-inhoud", "stat_nsfw": "NSFW-inhoud",
"stat_deleted": "Verwijderd", "stat_deleted": "Verwijderd",
"stat_comments": "Totaal aantal reacties",
"stat_favs": "Totaal aantal favorieten",
"most_favorited": "Meest Gefavoriet", "most_favorited": "Meest Gefavoriet",
"favs": "favorieten", "favs": "favorieten",
"top_xd": "Top xD-scores" "top_xd": "Top xD-scores"

View File

@@ -446,6 +446,8 @@
"stat_sfw": "SFW-Inhalt", "stat_sfw": "SFW-Inhalt",
"stat_nsfw": "NSFW-Inhalt", "stat_nsfw": "NSFW-Inhalt",
"stat_deleted": "Gelöscht", "stat_deleted": "Gelöscht",
"stat_comments": "Gesamtanzahl Kommentare",
"stat_favs": "Gesamtanzahl Favoriten",
"most_favorited": "Am häufigsten favorisiert", "most_favorited": "Am häufigsten favorisiert",
"favs": "Favoriten", "favs": "Favoriten",
"top_xd": "Beste xD-Punktestände" "top_xd": "Beste xD-Punktestände"

View File

@@ -22,6 +22,20 @@ export default (router, tpl) => {
`; `;
const stats = await lib.countf0cks(); const stats = await lib.countf0cks();
const totalComments = +(await db`
select count(*) as total
from comments
join items on comments.item_id = items.id
where comments.is_deleted = false and items.active = true
`)[0].total;
const totalFavs = +(await db`
select count(*) as total
from favorites
join items on favorites.item_id = items.id
where items.active = true
`)[0].total;
const hoster = await db` const hoster = await db`
with t as ( with t as (
select select
@@ -77,6 +91,8 @@ export default (router, tpl) => {
hoster, hoster,
favotop, favotop,
xdtop, xdtop,
totalComments,
totalFavs,
tmp: null, tmp: null,
session: (req.session && req.session.user) ? { ...req.session } : false, session: (req.session && req.session.user) ? { ...req.session } : false,
page_meta: { page_meta: {

View File

@@ -72,6 +72,8 @@
<table class="stats-table clean-table"> <table class="stats-table clean-table">
<tbody> <tbody>
<tr><td>{{ t('ranking.stat_total') }}</td><td>{{ stats.total }}</td></tr> <tr><td>{{ t('ranking.stat_total') }}</td><td>{{ stats.total }}</td></tr>
<tr><td>{{ t('ranking.stat_comments') }}</td><td>{{ totalComments }}</td></tr>
<tr><td>{{ t('ranking.stat_favs') }}</td><td>{{ totalFavs }}</td></tr>
<tr><td>{{ t('ranking.stat_tagged') }}</td><td>{{ stats.tagged }}</td></tr> <tr><td>{{ t('ranking.stat_tagged') }}</td><td>{{ stats.tagged }}</td></tr>
<tr><td>{{ t('ranking.stat_untagged') }}</td><td>{{ stats.untagged }}</td></tr> <tr><td>{{ t('ranking.stat_untagged') }}</td><td>{{ stats.untagged }}</td></tr>
<tr><td>{{ t('ranking.stat_sfw') }}</td><td>{{ stats.sfw }}</td></tr> <tr><td>{{ t('ranking.stat_sfw') }}</td><td>{{ stats.sfw }}</td></tr>