more QOL improvements
Build Images and Deploy / Update-PROD-Stack (push) Successful in 29s

This commit is contained in:
2026-02-28 01:37:32 -05:00
parent b9981d0e70
commit 4f9e92bda7
18 changed files with 426 additions and 32 deletions
+16 -5
View File
@@ -22,14 +22,22 @@ router.get('/hunt/:shortName/leaderboard', (req, res) => {
return res.status(404).render('error', { title: 'Not Found', message: 'Hunt not found.' });
}
const leaderboard = Hunts.getLeaderboard(hunt.id);
res.render('hunt/leaderboard', { title: `${hunt.name} - Leaderboard`, hunt, leaderboard });
const perPage = 25;
const page = Math.max(1, parseInt(req.query.page) || 1);
const totalCount = Hunts.getLeaderboardCount(hunt.id);
const totalPages = Math.max(1, Math.ceil(totalCount / perPage));
const leaderboard = Hunts.getLeaderboard(hunt.id, perPage, (page - 1) * perPage);
res.render('hunt/leaderboard', { title: `${hunt.name} - Leaderboard`, hunt, leaderboard, page, totalPages, offset: (page - 1) * perPage });
});
// ─── Global leaderboard ──────────────────────────────────
router.get('/leaderboard', (req, res) => {
const leaderboard = Scans.getGlobalLeaderboard();
res.render('leaderboard/global', { title: 'Global Leaderboard', leaderboard });
const perPage = 25;
const page = Math.max(1, parseInt(req.query.page) || 1);
const totalCount = Scans.getGlobalLeaderboardCount();
const totalPages = Math.max(1, Math.ceil(totalCount / perPage));
const leaderboard = Scans.getGlobalLeaderboard(perPage, (page - 1) * perPage);
res.render('leaderboard/global', { title: 'Global Leaderboard', leaderboard, page, totalPages, offset: (page - 1) * perPage });
});
// ─── Package profile (by card number — no secret code exposed) ────
@@ -74,13 +82,16 @@ router.get('/player/:username', (req, res) => {
const rank = Users.getRank(user.id);
const totalPlayers = Users.getTotalPlayerCount();
const isOwnProfile = req.session && req.session.userId === user.id;
res.render('player/profile', {
title: `${user.username}'s Profile`,
profile,
recentScans,
huntBreakdown,
rank,
totalPlayers
totalPlayers,
isOwnProfile
});
});