Remove break deductions from shift hours — show raw on-site time

The planner needs to know who is available and for how long (scheduling),
not paid hours after payroll deductions. Workforce was returning explicit
break data for some shifts (e.g. a 30-min break on a 12:00–14:00 shift),
causing those hours to display short. Strip all break logic and use raw
start→finish duration.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
jtricerolph 2026-07-21 15:50:33 +00:00
parent e0b0f2f275
commit 1a5de8d3fc

View file

@ -92,11 +92,7 @@ export async function fetchShifts(from, to, deptIds) {
const date = new Date(s.start * 1000).toISOString().slice(0, 10) const date = new Date(s.start * 1000).toISOString().slice(0, 10)
let breakHrs = 0 const shiftHrs = (s.finish - s.start) / 3600
if (Array.isArray(s.breaks) && s.breaks.length) {
breakHrs = s.breaks.reduce((sum, b) => sum + (b.finish - b.start) / 3600, 0)
}
const shiftHrs = Math.max(0, (s.finish - s.start) / 3600 - breakHrs)
if (!byUser[uid]) byUser[uid] = {} if (!byUser[uid]) byUser[uid] = {}
if (!byUser[uid][date]) byUser[uid][date] = { hours: 0, shifts: [] } if (!byUser[uid][date]) byUser[uid][date] = { hours: 0, shifts: [] }