Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TASK-429 Bug: not loading worker types during schedule import #344

Merged
merged 2 commits into from
Apr 11, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 19 additions & 8 deletions src/helpers/parser.helper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,26 @@ const ZMIANA_PRACUJACA = "Zmiana pracująca";
const KOLOR = "Kolor";
export const SHIFT_HEADERS = [NAZWA_ZMIANY, SKROT, OD, DO, ZMIANA_PRACUJACA, KOLOR];

const IMIE_I_NAZWISKO = "Imię i nazwisko";
const STANOWISKO_FUNKCJA = "Stanowisko/funkcja";
const RODZAJ_UMOWY = "Rodzaj umowy";
const WYMIAR_CZASU_PRACY = "Wymiar czasu pracy";
const ZESPOL = "Zespół";
export const WORKER_HEADERS = [
"Imię i nazwisko",
"Stanowisko/funkcja",
"Rodzaj umowy",
"Wymiar czasu pracy",
"Zespół",
IMIE_I_NAZWISKO,
STANOWISKO_FUNKCJA,
RODZAJ_UMOWY,
WYMIAR_CZASU_PRACY,
ZESPOL,
];
const CELLS_TO_AVOID = [
WORKSHEET_NAME,
NAZWA_ZMIANY,
IMIE_I_NAZWISKO,
STANOWISKO_FUNKCJA,
RODZAJ_UMOWY,
WYMIAR_CZASU_PRACY,
];
const CELLS_TO_AVOID = [WORKSHEET_NAME, NAZWA_ZMIANY];

export class ParserHelper {
public static isEmptyRow(rowValues: Array<string>): boolean {
Expand All @@ -34,8 +46,7 @@ export class ParserHelper {
rowValuesSet.size === 0 ||
(rowValuesSet.size === 1 && rowValuesSet.has("")) ||
Array.from(rowValuesSet).some((a) => typeof a === "undefined") ||
contains(CELLS_TO_AVOID) ||
contains(WORKER_HEADERS)
contains(CELLS_TO_AVOID)
);

function contains(cellToAvoid: Array<string>): boolean {
Expand Down