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 @@