From a4fa26f1f12a974ad9599acafb5bfab6ef527cb1 Mon Sep 17 00:00:00 2001 From: Tom Smeding Date: Mon, 28 Feb 2022 23:11:20 +0100 Subject: timetrack: Show total account on last week in calendar --- modules/timetrack/timetrack.html | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/modules/timetrack/timetrack.html b/modules/timetrack/timetrack.html index 2666fdc..47cba40 100644 --- a/modules/timetrack/timetrack.html +++ b/modules/timetrack/timetrack.html @@ -142,11 +142,17 @@ function weekstart(date){ function refreshcalendar(list,npreweeks){ if(npreweeks==undefined)npreweeks=2; + var dayTarget=38/5 - 1; + + var weekTotals=new Map(); // only in weeks that have entries + var totalTime=0; + function datekey(d){return d.getFullYear()+"-"+d.getMonth()+"-"+d.getDate();} var hist=new Map(), incheck=new Map(); var errors=[]; for(var i=0;i0); + var prevTarget=numPrevWeeks*5*dayTarget; + var prevSurplus=prevTotal-prevTarget*3600*1000; + var descr=Math.round(prevSurplus/1000/3600*10)/10+"h"; + + td=document.createElement("td"); + td.appendChild(document.createTextNode("Account: " + descr)); + tr.appendChild(td); + } + tb.appendChild(tr); } } -- cgit v1.2.3-70-g09d2