From 892e267a1643e26738e6701ac6a1b05c20c3ffce Mon Sep 17 00:00:00 2001 From: Joan Sanchez Date: Wed, 3 Apr 2019 11:36:10 +0200 Subject: [PATCH] fixed worker calendar total holidays #1299 --- modules/worker/back/methods/worker-calendar/absences.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/modules/worker/back/methods/worker-calendar/absences.js b/modules/worker/back/methods/worker-calendar/absences.js index 9b9479ca1..1ca212863 100644 --- a/modules/worker/back/methods/worker-calendar/absences.js +++ b/modules/worker/back/methods/worker-calendar/absences.js @@ -124,7 +124,7 @@ module.exports = Self => { let totalHolidays = contract.holidays().days; if (contract.started && contract.ended) - totalHolidays = getHolidaysByContract(contract); + totalHolidays = getHolidaysByContract(started, contract); calendar.totalHolidays += totalHolidays; @@ -141,10 +141,10 @@ module.exports = Self => { return [calendar, absences, holidays]; }; - function getHolidaysByContract(contract) { + function getHolidaysByContract(started, contract) { const dayTimestamp = 1000 * 60 * 60 * 24; const endedTime = contract.ended.getTime(); - const startedTime = contract.started.getTime(); + const startedTime = started.getTime(); const contractDays = Math.floor((endedTime - startedTime) / dayTimestamp); if (contractDays < 365)