diff --git a/src/ProgressPane.jsx b/src/ProgressPane.jsx index 78ad804..1024368 100644 --- a/src/ProgressPane.jsx +++ b/src/ProgressPane.jsx @@ -23,7 +23,7 @@ async function fetchData() { const csv = await fetch("https://papermar.io/reports/progress.csv") .then(response => response.text()) - return csv + const rows = csv .split("\n") .filter(row => row.length) .map(row => { @@ -35,10 +35,15 @@ async function fetchData() { obj[key] = transform(data.shift()) } - obj.percentBytes = Math.round((obj.matchingBytes / obj.totalBytes) * 100) - return obj }) + + const latest = rows[rows.length - 1] + for (const row of rows) { + row.percentBytes = (row.matchingBytes / latest.totalBytes) * 100 + } + + return rows } let cachedData = null @@ -92,15 +97,6 @@ function DataView({ data, captionPortal, nonce }) { const maxPercent = Math.ceil(latest.percentBytes / 25) * 25 return <> - {/*
Matched | -{Math.round((latest.matchingBytes / latest.totalBytes) * 10000) / 100}% | -