refactor: opravy dle SonarQube
CI / Generate TypeScript types (push) Successful in 10s
CI / Server unit tests (push) Successful in 20s
CI / Build server (push) Successful in 29s
CI / Build client (push) Successful in 33s
CI / Playwright E2E tests (push) Has been cancelled
CI / Build and push Docker image (push) Has been cancelled
CI / Notify (push) Has been cancelled
CI / Generate TypeScript types (push) Successful in 10s
CI / Server unit tests (push) Successful in 20s
CI / Build server (push) Successful in 29s
CI / Build client (push) Successful in 33s
CI / Playwright E2E tests (push) Has been cancelled
CI / Build and push Docker image (push) Has been cancelled
CI / Notify (push) Has been cancelled
This commit is contained in:
@@ -485,13 +485,13 @@ export async function addChoice(login: string, trusted: boolean, locationKey: Lu
|
||||
async function validateFoodIndex(locationKey: LunchChoice, foodIndex?: number, date?: Date) {
|
||||
if (foodIndex != null) {
|
||||
if (typeof foodIndex !== 'number') {
|
||||
throw Error(`Neplatný index ${foodIndex} typu ${typeof foodIndex}`);
|
||||
throw new Error(`Neplatný index ${foodIndex} typu ${typeof foodIndex}`);
|
||||
}
|
||||
if (foodIndex < 0) {
|
||||
throw Error(`Neplatný index ${foodIndex}`);
|
||||
throw new Error(`Neplatný index ${foodIndex}`);
|
||||
}
|
||||
if (!Object.keys(Restaurant).includes(locationKey)) {
|
||||
throw Error(`Neplatný index ${foodIndex} pro lokalitu ${locationKey} nepodporující indexy`);
|
||||
throw new Error(`Neplatný index ${foodIndex} pro lokalitu ${locationKey} nepodporující indexy`);
|
||||
}
|
||||
const usedDate = date ?? getToday();
|
||||
const menu = await getRestaurantMenu(locationKey as Restaurant, usedDate);
|
||||
@@ -543,7 +543,7 @@ export async function updateDepartureTime(login: string, time?: string, date?: D
|
||||
delete found[login].departureTime;
|
||||
} else {
|
||||
if (!Object.values<string>(DepartureTime).includes(time)) {
|
||||
throw Error(`Neplatný čas odchodu ${time}`);
|
||||
throw new Error(`Neplatný čas odchodu ${time}`);
|
||||
}
|
||||
found[login].departureTime = time;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user