From e0e1da1c01a119e8a245b85ddf4d744b467c5500 Mon Sep 17 00:00:00 2001 From: louispaulb Date: Wed, 15 Jul 2026 07:19:15 -0400 Subject: [PATCH] fix(dispatch): lever le cap 50 sur les techniciens (occupation + charge) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit techOccupancy et getTechsWithLoad récupéraient les Dispatch Technician avec limit_page_length=50 alors que l'effectif est de 56. Les techs au-delà du 50e (ordre ERPNext) étaient donc ABSENTS de l'occupation → dans le calendrier mois de leur horaire (TechScheduleDialog), c.hasShift est piloté UNIQUEMENT par l'occupation (shiftMap), donc leurs quarts créés en Semaine/Jour n'y apparaissaient jamais (tout gris) — ex. Philippe Bourdon & co., alors que Simon Clot-Gagnon (dans les 50) s'affichait bien. Même cap = mêmes techs invisibles au dispatch/ranking (getTechsWithLoad). Cap porté à 500 (comme les requêtes jobs/disponibilités voisines). Confirmé live : roster/technicians = 56 (Philippe présent) vs dispatch/occupancy = 45 sans Philippe. Les Shift Assignment existaient (fetchés limit 2000) mais ne nourrissent que le menu de cellule, pas la barre d'occupation. Co-Authored-By: Claude Opus 4.8 --- services/targo-hub/lib/dispatch.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/services/targo-hub/lib/dispatch.js b/services/targo-hub/lib/dispatch.js index 9a0fead..fbfd85f 100644 --- a/services/targo-hub/lib/dispatch.js +++ b/services/targo-hub/lib/dispatch.js @@ -52,7 +52,7 @@ function distKm (a, b) { async function getTechsWithLoad (dateStr) { const [techRes, jobRes] = await Promise.all([ - erpFetch(`/api/resource/Dispatch Technician?fields=${encodeURIComponent(JSON.stringify(['name', 'technician_id', 'full_name', 'status', 'longitude', 'latitude', 'traccar_device_id', 'phone']))}&limit_page_length=50`), + erpFetch(`/api/resource/Dispatch Technician?fields=${encodeURIComponent(JSON.stringify(['name', 'technician_id', 'full_name', 'status', 'longitude', 'latitude', 'traccar_device_id', 'phone']))}&limit_page_length=500`), // 500 : couvre tout l'effectif (>50) — sinon les techs au-delà du 50e sont invisibles au dispatch/ranking erpFetch(`/api/resource/Dispatch Job?filters=${encodeURIComponent(JSON.stringify({ status: ['in', ['open', 'assigned']], scheduled_date: dateStr }))}&fields=${encodeURIComponent(JSON.stringify(['name', 'assigned_tech', 'duration_h', 'longitude', 'latitude', 'status', 'route_order']))}&limit_page_length=200`), ]) if (techRes.status !== 200) throw new Error('Failed to fetch technicians') @@ -323,7 +323,7 @@ async function techOccupancy ({ after_date, days = SLOT_HORIZON_DAYS, skill = '' const [techRes, jobRes, tplRes, shiftRes, availRes] = await Promise.all([ erpFetch(`/api/resource/Dispatch Technician?fields=${encodeURIComponent(JSON.stringify([ 'name', 'technician_id', 'full_name', 'status', 'absence_from', 'absence_until', 'skills', '_user_tags', - ]))}&limit_page_length=50`), + ]))}&limit_page_length=500`), // 500 : couvre tout l'effectif (56+ techs) — le cap 50 laissait les techs au-delà du 50e SANS occupation → calendrier mois de leur horaire tout gris (bug Philippe Bourdon & co.) erpFetch(`/api/resource/Dispatch Job?filters=${encodeURIComponent(JSON.stringify([ ['status', 'in', ['open', 'assigned']], ['scheduled_date', '>=', dates[0]],