From 3981b8684c895bfa9a9fb0af9468693c0fe96ea9 Mon Sep 17 00:00:00 2001 From: Patrick Fic Date: Thu, 13 Apr 2023 10:11:15 -0700 Subject: [PATCH] IO-2244 Round difference calculation to 1 decimal point for productive hours claiming enforcement. --- .../tech-job-clock-out-button.component.jsx | 13 ++++++++----- .../time-ticket-modal.component.jsx | 12 ++++++++---- 2 files changed, 16 insertions(+), 9 deletions(-) diff --git a/client/src/components/tech-job-clock-out-button/tech-job-clock-out-button.component.jsx b/client/src/components/tech-job-clock-out-button/tech-job-clock-out-button.component.jsx index 8ace8e08d..5c0830d5e 100644 --- a/client/src/components/tech-job-clock-out-button/tech-job-clock-out-button.component.jsx +++ b/client/src/components/tech-job-clock-out-button/tech-job-clock-out-button.component.jsx @@ -169,11 +169,14 @@ export function TechClockOffButton({ ? "mod_lbr_ty" : "cost_center"; - const costCenterDiff = totals.find( - (total) => - total[fieldTypeToCheck] === - getFieldValue("cost_center") - )?.difference; + const costCenterDiff = + Math.round( + totals.find( + (total) => + total[fieldTypeToCheck] === + getFieldValue("cost_center") + )?.difference * 10 + ) / 10; if (value > costCenterDiff) return Promise.reject( diff --git a/client/src/components/time-ticket-modal/time-ticket-modal.component.jsx b/client/src/components/time-ticket-modal/time-ticket-modal.component.jsx index c0cf7b024..a72322851 100644 --- a/client/src/components/time-ticket-modal/time-ticket-modal.component.jsx +++ b/client/src/components/time-ticket-modal/time-ticket-modal.component.jsx @@ -206,10 +206,14 @@ export function TimeTicketModalComponent({ ? "mod_lbr_ty" : "cost_center"; - const costCenterDiff = totals.find( - (total) => - total[fieldTypeToCheck] === getFieldValue("cost_center") - )?.difference; + const costCenterDiff = + Math.round( + totals.find( + (total) => + total[fieldTypeToCheck] === + getFieldValue("cost_center") + )?.difference * 10 + ) / 10; if (value > costCenterDiff) return Promise.reject(