ghostly grails

Just a business 'mon

stats. musings. deranged idiocy. a sack of a potatoes masquerading as a 'mon on the way to riches.

(function(){ const TOKEN = "TRd65FCqp0KcIVv9Nri5aR2KzuHyu8kS"; const TABLE = "1984542"; const FIELD = "Grade"; async function load() { let rows = [], page = 1, more = true; while(more) { const r = await fetch( `https://api.baserow.io/api/database/rows/table/${TABLE}/ ?size=200&page=${page}`, {headers:{"Authorization":`Token ${TOKEN}`}} ); const d = await r.json(); rows = rows.concat(d.results); more = !!d.next; page++; } const graded = rows.filter(r => r[FIELD] && +r[FIELD] > 0); const total = graded.length; if(!total) return; const cnt = g => graded.filter(r => +r[FIELD] === g).length; const pct = g => Math.round(cnt(g)/total*100); const avg = (graded.reduce((s,r)=>s+ +r[FIELD],0)/total).toFixed(1); const other = graded.filter(r => +r[FIELD] < 8).length; document.getElementById("gg-stats").innerHTML = `
${total}
Cards graded
${pct(10)}%
PSA 10 rate
${avg}
Avg grade
${pct(9)}%
PSA 9 rate
PSA 10
${pct(10)}%
PSA 9
${pct(9)}%
PSA 8
${pct(8)}%
PSA 7–
${Math.round(other/total*100)}%
Updated ${new Date().toLocaleTimeString([], {hour:'2-digit',minute:'2-digit'})}ghostlygrails.com
`; setTimeout(()=>{ [10,9,8].forEach(g=>{ const el=document.getElementById(`f${g}`); if(el) el.style.width=pct(g)+"%"; }); const f7=document.getElementById("f7"); if(f7) f7.style.width=Math.round(other/total*100)+"%"; },100); } load(); })();