missing ids
All checks were successful
fetch npm modules / f0ck the f0cker (push) Successful in 37s

This commit is contained in:
Flummi 2023-05-03 04:25:18 +02:00
parent e47dfb38fb
commit 63bd1104b7
2 changed files with 12 additions and 6 deletions

View File

@ -84,36 +84,41 @@ export default new class {
// async funcs // async funcs
async countf0cks() { async countf0cks() {
const tagged = (await db` const tagged = +(await db`
select count(*) as total select count(*) as total
from "items" from "items"
where id in (select item_id from tags_assign group by item_id) and active = true where id in (select item_id from tags_assign group by item_id) and active = true
`)[0].total; `)[0].total;
const untagged = (await db` const untagged = +(await db`
select count(*) as total select count(*) as total
from "items" from "items"
where id not in (select item_id from tags_assign group by item_id) and active = true where id not in (select item_id from tags_assign group by item_id) and active = true
`)[0].total; `)[0].total;
const sfw = (await db` const sfw = +(await db`
select count(*) as total select count(*) as total
from "items" from "items"
where id in (select item_id from tags_assign where tag_id = 1 group by item_id) and active = true where id in (select item_id from tags_assign where tag_id = 1 group by item_id) and active = true
`)[0].total; `)[0].total;
const nsfw = (await db` const nsfw = +(await db`
select count(*) as total select count(*) as total
from "items" from "items"
where id in (select item_id from tags_assign where tag_id = 2 group by item_id) and active = true where id in (select item_id from tags_assign where tag_id = 2 group by item_id) and active = true
`)[0].total; `)[0].total;
const deleted = (await db` const deleted = +(await db`
select count(*) as total select count(*) as total
from "items" from "items"
where active = false where active = false
`)[0].total; `)[0].total;
const lastf0ck = +(await db`
select max(id) as id
from "items"
`)[0].id;
return { return {
tagged, tagged,
untagged, untagged,
total: +tagged + +untagged, total: tagged + untagged,
deleted, deleted,
untracked: lastf0ck - (tagged + untagged + deleted),
sfw, sfw,
nsfw, nsfw,
}; };

View File

@ -35,6 +35,7 @@
<tr><td>SFW</td><td>{{ stats.sfw }}</td></tr> <tr><td>SFW</td><td>{{ stats.sfw }}</td></tr>
<tr><td>NSFW</td><td>{{ stats.nsfw }}</td></tr> <tr><td>NSFW</td><td>{{ stats.nsfw }}</td></tr>
<tr><td>deleted</td><td>{{ stats.deleted }}</td></tr> <tr><td>deleted</td><td>{{ stats.deleted }}</td></tr>
<tr><td>missing ids</td><td>{{ stats.untracked }}</td></tr>
</table> </table>
</div> </div>
</div> </div>