This commit is contained in:
Flummi
2021-12-23 06:07:23 +01:00
parent 885d729a76
commit 17006f7e10
2 changed files with 41 additions and 0 deletions

View File

@ -228,5 +228,22 @@ export default (router, tpl) => {
res.redirect(`/${referer}`);
});
router.get(/^\/ranking/, async (req, res) => {
try {
const list = await sql('tags_assign')
.select('prefix', sql.raw('count(distinct tag_id, item_id) count'))
.groupBy('prefix')
.orderBy('count', 'desc');
const stats = await lib.countf0cks();
res.reply({
body: tpl.render('ranking', { list, stats, tmp: null }, req)
});
} catch(err) {
res.end(JSON.stringify(err.message));
}
});
return router;
};