-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
TASK-433 correct worker hours info calculation and TASK-439 wrong hea…
…ders in export (#345) Co-authored-by: Tomasz Pęcak <[email protected]>
- Loading branch information
Showing
22 changed files
with
1,549 additions
and
471 deletions.
There are no files selected for viewing
1,433 changes: 1,132 additions & 301 deletions
1,433
cypress/fixtures/march-2021-worker-data.ts → ...worker-data/march-2021-raw-worker-data.ts
Large diffs are not rendered by default.
Oops, something went wrong.
Binary file not shown.
Binary file added
BIN
+20.2 KB
cypress/fixtures/worker-data/marzec_koniec_miesiąca_2021_preprocessed.xlsx
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
/* This Source Code Form is subject to the terms of the Mozilla Public | ||
* License, v. 2.0. If a copy of the MPL was not distributed with this | ||
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */ | ||
import { ShiftCode } from "../../../src/common-models/shift-info.model"; | ||
import { ContractType } from "../../../src/common-models/worker-info.model"; | ||
import { MonthDataArray } from "../../../src/helpers/shifts.helper"; | ||
import { monthWorkerData } from "./march-2021-raw-worker-data"; | ||
|
||
const MARCH_DAY_COUNT = 31; | ||
const MONTH = 2; // march | ||
const YEAR = 2021; | ||
|
||
const createWorkerInfoObject = (workerName: string): WorkerTestDataInstance => { | ||
const cropToMonth = <T>(data: T[]): MonthDataArray<T> => | ||
data.slice(0, MARCH_DAY_COUNT) as MonthDataArray<T>; | ||
const actualWorkerShifts = cropToMonth<ShiftCode>( | ||
monthWorkerData.actualScheduleShifts[workerName] as ShiftCode[] | ||
); | ||
const primaryWorkerShifts = cropToMonth<ShiftCode>( | ||
monthWorkerData.primaryScheduleShifts[workerName] as ShiftCode[] | ||
); | ||
|
||
return { | ||
workerName, | ||
workerNorm: monthWorkerData.time[workerName], | ||
workerContract: ContractType.EMPLOYMENT_CONTRACT, | ||
workerReqiuredHours: monthWorkerData.requiredWorkHours[workerName], | ||
workerActualHours: monthWorkerData.actualWorkHours[workerName], | ||
workerOvertime: monthWorkerData.overtime[workerName], | ||
actualWorkerShifts, | ||
primaryWorkerShifts, | ||
month: MONTH, | ||
year: YEAR, | ||
dates: cropToMonth(monthWorkerData.dates), | ||
}; | ||
}; | ||
|
||
export interface WorkerTestDataInstance { | ||
workerName: string; | ||
workerNorm: number; | ||
workerContract: ContractType; | ||
workerReqiuredHours: number; | ||
workerActualHours: number; | ||
workerOvertime: number; | ||
actualWorkerShifts: ShiftCode[]; | ||
primaryWorkerShifts: MonthDataArray<ShiftCode>; | ||
month: number; | ||
year: number; | ||
dates: number[]; | ||
} | ||
export const workerTestData: WorkerTestDataInstance[] = Object.keys(monthWorkerData.time).map( | ||
createWorkerInfoObject | ||
); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.