Indicate if stats are incomplete
This commit is contained in:
		
							parent
							
								
									c1791f8520
								
							
						
					
					
						commit
						f149156def
					
				
					 2 changed files with 27 additions and 18 deletions
				
			
		| 
						 | 
					@ -4,13 +4,18 @@
 | 
				
			||||||
      input(type="hidden" name="account" value=account)
 | 
					      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
 | 
					      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
 | 
					  table.s-sidebarwidget--content.s-sidebarwidget__items
 | 
				
			||||||
    tr.s-sidebarwidget--item
 | 
					    tr.s-sidebarwidget--item
 | 
				
			||||||
      th items
 | 
					      th items
 | 
				
			||||||
      td= count.total
 | 
					      td= count.total
 | 
				
			||||||
    tr.s-sidebarwidget--item
 | 
					    if hasFullTrackData
 | 
				
			||||||
      th runtime
 | 
					      tr.s-sidebarwidget--item
 | 
				
			||||||
      td= count.runtime
 | 
					        th runtime
 | 
				
			||||||
 | 
					        td= count.runtime
 | 
				
			||||||
    tr.s-sidebarwidget--item
 | 
					    tr.s-sidebarwidget--item
 | 
				
			||||||
      th format
 | 
					      th format
 | 
				
			||||||
      td
 | 
					      td
 | 
				
			||||||
| 
						 | 
					@ -27,20 +32,22 @@
 | 
				
			||||||
        span.fc-black-250= ` / `
 | 
					        span.fc-black-250= ` / `
 | 
				
			||||||
        = count.paid
 | 
					        = count.paid
 | 
				
			||||||
        span.fc-black-400= ` paid`
 | 
					        span.fc-black-400= ` paid`
 | 
				
			||||||
    tr.s-sidebarwidget--item
 | 
					    if hasFullTrackData
 | 
				
			||||||
      th tracks
 | 
					      tr.s-sidebarwidget--item
 | 
				
			||||||
      td
 | 
					        th tracks
 | 
				
			||||||
        = count.tracks
 | 
					        td
 | 
				
			||||||
        span.pl8.fc-black-250= ` / `
 | 
					          = count.tracks
 | 
				
			||||||
        span.fc-black-400 avg #{count.avgTracks}
 | 
					          span.pl8.fc-black-250= ` / `
 | 
				
			||||||
    tr.s-sidebarwidget--item
 | 
					          span.fc-black-400 avg #{count.avgTracks}
 | 
				
			||||||
      th tags
 | 
					    if hasFullTrackData
 | 
				
			||||||
      td
 | 
					      tr.s-sidebarwidget--item
 | 
				
			||||||
        = count.tags
 | 
					        th tags
 | 
				
			||||||
        span.pl8.fc-black-250= ` / `
 | 
					        td
 | 
				
			||||||
        span.fc-black-400 avg #{count.avgTags}
 | 
					          = count.tags
 | 
				
			||||||
        span.fc-black-250= ` / `
 | 
					          span.pl8.fc-black-250= ` / `
 | 
				
			||||||
        span.fc-black-400 lonely #{count.lonelyTags}
 | 
					          span.fc-black-400 avg #{count.avgTags}
 | 
				
			||||||
 | 
					          span.fc-black-250= ` / `
 | 
				
			||||||
 | 
					          span.fc-black-400 lonely #{count.lonelyTags}
 | 
				
			||||||
    tr.s-sidebarwidget--item
 | 
					    tr.s-sidebarwidget--item
 | 
				
			||||||
      th value
 | 
					      th value
 | 
				
			||||||
      td
 | 
					      td
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -58,7 +58,9 @@ pugSync.beforeInclude("includes/collection-stats.pug", async (from, event, {acco
 | 
				
			||||||
 | 
					
 | 
				
			||||||
router.get("/:account/collection-stats", defineEventHandler(async event => {
 | 
					router.get("/:account/collection-stats", defineEventHandler(async event => {
 | 
				
			||||||
	const {account} = await getValidatedRouterParams(event, schema.schema.account.parse)
 | 
						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 => {
 | 
					router.post("/api/settings/currency", defineEventHandler(async event => {
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue