Add weekend day balancing options and summary counts for shifts

This commit is contained in:
Ross
2025-12-17 10:43:37 +00:00
parent 81b2c85d61
commit 83444ac402
3 changed files with 283 additions and 2 deletions
+12
View File
@@ -173,9 +173,21 @@ function generateExtra() {
worker_td.get(0).dataset.shiftDiffSummed = summed_shift_diff.toPrecision(2);
// compute separate Sat / Sun counts for this worker
let sat_count = 0;
let sun_count = 0;
for (let i = 1; i <= weeks; i++) {
let sat = $(tr).find(`[data-week='${i}'][data-day='Sat']`).attr("data-shift");
let sun = $(tr).find(`[data-week='${i}'][data-day='Sun']`).attr("data-shift");
if (sat && sat !== "") sat_count += 1;
if (sun && sun !== "") sun_count += 1;
}
worker_td.after(`<div class='worker-summary auto-generated'>
<span>Total shifts: ${total_shifts}, </span>
<span>Weekends: ${weekends_worked}, </span>
<span>Sat: ${sat_count}, </span>
<span>Sun: ${sun_count}, </span>
<span>Nights: ${nights_worked}, </span>
<span>Bank holidays: ${bank_holidays_worked}, </span>
<span class='shift-diff-span'>Summed shift diff: ${summed_shift_diff.toPrecision(2)}, </span>