Indicate if stats are incomplete
This commit is contained in:
parent
c1791f8520
commit
f149156def
2 changed files with 27 additions and 18 deletions
|
@ -4,10 +4,15 @@
|
|||
input(type="hidden" name="account" value=account)
|
||||
button.s-link(hx-post="/api/load-collection" hx-target="#collection-sync" hx-select="#collection-sync" hx-include="previous input") Sync
|
||||
|
||||
if !hasFullTrackData && arrange !== "tag"
|
||||
p.s-sidebarwidget--content
|
||||
a.s-btn.s-btn__outlined.s-btn__muted(href="./" + and({arrange: "tag", shape: "grid"})) Download tags for more stats
|
||||
|
||||
table.s-sidebarwidget--content.s-sidebarwidget__items
|
||||
tr.s-sidebarwidget--item
|
||||
th items
|
||||
td= count.total
|
||||
if hasFullTrackData
|
||||
tr.s-sidebarwidget--item
|
||||
th runtime
|
||||
td= count.runtime
|
||||
|
@ -27,12 +32,14 @@
|
|||
span.fc-black-250= ` / `
|
||||
= count.paid
|
||||
span.fc-black-400= ` paid`
|
||||
if hasFullTrackData
|
||||
tr.s-sidebarwidget--item
|
||||
th tracks
|
||||
td
|
||||
= count.tracks
|
||||
span.pl8.fc-black-250= ` / `
|
||||
span.fc-black-400 avg #{count.avgTracks}
|
||||
if hasFullTrackData
|
||||
tr.s-sidebarwidget--item
|
||||
th tags
|
||||
td
|
||||
|
|
|
@ -58,7 +58,9 @@ pugSync.beforeInclude("includes/collection-stats.pug", async (from, event, {acco
|
|||
|
||||
router.get("/:account/collection-stats", defineEventHandler(async event => {
|
||||
const {account} = await getValidatedRouterParams(event, schema.schema.account.parse)
|
||||
return pugSync.render(event, "collection-stats.pug", {account, isStatsPage: true})
|
||||
// if there are any untagged items then we don't have full track data
|
||||
const hasFullTrackData = !db.prepare("SELECT * FROM item LEFT JOIN item_tag USING (account, item_id) WHERE account = ? AND tag IS NULL").get(account)
|
||||
return pugSync.render(event, "collection-stats.pug", {account, hasFullTrackData, isStatsPage: true})
|
||||
}))
|
||||
|
||||
router.post("/api/settings/currency", defineEventHandler(async event => {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue