From 6794a54722ffeb6855f1234163a8e3c76ad38fac Mon Sep 17 00:00:00 2001 From: Alberto Date: Tue, 28 Jan 2025 15:26:09 +0100 Subject: [PATCH 1/3] Pass rates in cents when importing Per diem --- src/pages/workspace/perDiem/ImportedPerDiemPage.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/pages/workspace/perDiem/ImportedPerDiemPage.tsx b/src/pages/workspace/perDiem/ImportedPerDiemPage.tsx index 77df21162641..3b752f155050 100644 --- a/src/pages/workspace/perDiem/ImportedPerDiemPage.tsx +++ b/src/pages/workspace/perDiem/ImportedPerDiemPage.tsx @@ -37,7 +37,7 @@ function generatePerDiemUnits(perDiemDestination: string[], perDiemSubRate: stri perDiemUnits[perDiemDestination[i]].subRates?.push({ id: PerDiem.generateCustomUnitID(), name: perDiemSubRate.at(i) ?? '', - rate: Number(perDiemAmount.at(i)) ?? 0, + rate: (Number(perDiemAmount.at(i)) ?? 0) * CONST.POLICY.CUSTOM_UNIT_RATE_BASE_OFFSET, }); } return Object.values(perDiemUnits); From 3c9e264487d31e0adefcdb11265e02802a890997 Mon Sep 17 00:00:00 2001 From: Alberto Date: Tue, 28 Jan 2025 15:50:31 +0100 Subject: [PATCH 2/3] lint --- src/pages/workspace/perDiem/ImportedPerDiemPage.tsx | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/pages/workspace/perDiem/ImportedPerDiemPage.tsx b/src/pages/workspace/perDiem/ImportedPerDiemPage.tsx index 3b752f155050..d394fc9ebf57 100644 --- a/src/pages/workspace/perDiem/ImportedPerDiemPage.tsx +++ b/src/pages/workspace/perDiem/ImportedPerDiemPage.tsx @@ -8,7 +8,7 @@ import ScreenWrapper from '@components/ScreenWrapper'; import useLocalize from '@hooks/useLocalize'; import usePolicy from '@hooks/usePolicy'; import {closeImportPage} from '@libs/actions/ImportSpreadsheet'; -import * as PerDiem from '@libs/actions/Policy/PerDiem'; +import {generateCustomUnitID, importPerDiemRates} from '@libs/actions/Policy/PerDiem'; import {sanitizeCurrencyCode} from '@libs/CurrencyUtils'; import {findDuplicate, generateColumnNames} from '@libs/importSpreadsheetUtils'; import Navigation from '@libs/Navigation/Navigation'; @@ -35,7 +35,7 @@ function generatePerDiemUnits(perDiemDestination: string[], perDiemSubRate: stri subRates: [], }; perDiemUnits[perDiemDestination[i]].subRates?.push({ - id: PerDiem.generateCustomUnitID(), + id: generateCustomUnitID(), name: perDiemSubRate.at(i) ?? '', rate: (Number(perDiemAmount.at(i)) ?? 0) * CONST.POLICY.CUSTOM_UNIT_RATE_BASE_OFFSET, }); @@ -122,7 +122,7 @@ function ImportedPerDiemPage({route}: ImportedPerDiemPageProps) { if (perDiemUnits) { setIsImportingPerDiemRates(true); - PerDiem.importPerDiemRates(policyID, perDiemCustomUnit.customUnitID, perDiemUnits, rowsLength); + importPerDiemRates(policyID, perDiemCustomUnit.customUnitID, perDiemUnits, rowsLength); } }, [validate, spreadsheet?.columns, spreadsheet?.data, containsHeader, policyID, perDiemCustomUnit?.customUnitID]); From 4c1916e9511509ac8500a0d38d1ef768542e0f69 Mon Sep 17 00:00:00 2001 From: Alberto Date: Tue, 28 Jan 2025 15:50:44 +0100 Subject: [PATCH 3/3] rename for lint --- src/pages/workspace/perDiem/ImportedPerDiemPage.tsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/pages/workspace/perDiem/ImportedPerDiemPage.tsx b/src/pages/workspace/perDiem/ImportedPerDiemPage.tsx index d394fc9ebf57..4c778538267d 100644 --- a/src/pages/workspace/perDiem/ImportedPerDiemPage.tsx +++ b/src/pages/workspace/perDiem/ImportedPerDiemPage.tsx @@ -95,7 +95,7 @@ function ImportedPerDiemPage({route}: ImportedPerDiemPageProps) { return errors; }, [requiredColumns, spreadsheet?.columns, translate, columnRoles]); - const importPerDiemRates = useCallback(() => { + const importRates = useCallback(() => { setIsValidationEnabled(true); const errors = validate(); if (Object.keys(errors).length > 0 || !perDiemCustomUnit?.customUnitID) { @@ -149,7 +149,7 @@ function ImportedPerDiemPage({route}: ImportedPerDiemPageProps) {