diff --git a/wwwroot/app.js b/wwwroot/app.js index c4ec65e..6cd23c2 100644 --- a/wwwroot/app.js +++ b/wwwroot/app.js @@ -98,7 +98,7 @@ async function loadView() { function renderSummary(s) { $('summary').innerHTML = ` - Zeitraum: ${pct(s.totalCost)} + Auslastung: ${pctScaled(s.totalCost)} Einträge: ${s.totalEntries} `; } @@ -127,7 +127,7 @@ function renderBucketChart(buckets, bucketMinutes) { const wrapper = document.createElement('div'); wrapper.className = 'bar-wrapper'; wrapper.innerHTML = ` -
+ `; @@ -483,3 +483,9 @@ function escAttr(s) { function pct(cost) { return (cost / WEEKLY_BUDGET * 100).toFixed(3) + '%'; } + +function pctScaled(cost) { + const days = (viewTo - viewFrom) / 86400000; + const budget = WEEKLY_BUDGET / 7 * days; + return (cost / budget * 100).toFixed(3) + '%'; +}