From 63bd1104b73850c290e8522e2457dbb180124659 Mon Sep 17 00:00:00 2001 From: Flummi Date: Wed, 3 May 2023 04:25:18 +0200 Subject: [PATCH] missing ids --- src/inc/lib.mjs | 17 +++++++++++------ views/ranking.html | 1 + 2 files changed, 12 insertions(+), 6 deletions(-) diff --git a/src/inc/lib.mjs b/src/inc/lib.mjs index d8f5714..707a0de 100644 --- a/src/inc/lib.mjs +++ b/src/inc/lib.mjs @@ -84,36 +84,41 @@ export default new class { // async funcs async countf0cks() { - const tagged = (await db` + const tagged = +(await db` select count(*) as total from "items" where id in (select item_id from tags_assign group by item_id) and active = true `)[0].total; - const untagged = (await db` + const untagged = +(await db` select count(*) as total from "items" where id not in (select item_id from tags_assign group by item_id) and active = true `)[0].total; - const sfw = (await db` + const sfw = +(await db` select count(*) as total from "items" where id in (select item_id from tags_assign where tag_id = 1 group by item_id) and active = true `)[0].total; - const nsfw = (await db` + const nsfw = +(await db` select count(*) as total from "items" where id in (select item_id from tags_assign where tag_id = 2 group by item_id) and active = true `)[0].total; - const deleted = (await db` + const deleted = +(await db` select count(*) as total from "items" where active = false `)[0].total; + const lastf0ck = +(await db` + select max(id) as id + from "items" + `)[0].id; return { tagged, untagged, - total: +tagged + +untagged, + total: tagged + untagged, deleted, + untracked: lastf0ck - (tagged + untagged + deleted), sfw, nsfw, }; diff --git a/views/ranking.html b/views/ranking.html index bfddb92..41ae314 100644 --- a/views/ranking.html +++ b/views/ranking.html @@ -35,6 +35,7 @@ SFW{{ stats.sfw }} NSFW{{ stats.nsfw }} deleted{{ stats.deleted }} + missing ids{{ stats.untracked }}