tagpage: fix pagination

This commit is contained in:
Flummi 2022-03-25 16:03:33 +01:00
parent e15c16434c
commit d43195b52d

View File

@ -27,7 +27,6 @@ export default {
}; };
total = (await sql("items") total = (await sql("items")
.select("items.id", "items.mime", "st.tag")
.innerJoin( .innerJoin(
sql("tags") sql("tags")
.select("tags_assign.item_id", "tags.tag") .select("tags_assign.item_id", "tags.tag")
@ -38,9 +37,9 @@ export default {
"st.item_id", "items.id" "st.item_id", "items.id"
) )
.whereRaw(modequery) .whereRaw(modequery)
.groupBy('items.id', 'st.tag', 'st.item_id') .groupBy('st.tag', 'st.item_id')
.count("* as total") .count("* as total")
)[0]?.total; )?.length;
} }
else { else {
if(!o.fav) { if(!o.fav) {
@ -120,12 +119,9 @@ export default {
) )
.groupBy('st.item_id', 'items.id', 'tags_assign.tag_id'); .groupBy('st.item_id', 'items.id', 'tags_assign.tag_id');
} }
rows = await rows; rows = await rows;
if(rows.length === 0) if(rows.length === 0)
return { return {
success: false, success: false,