Přidání restaurace Zastávka u Michala
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
import { InsufficientPermissions, formatDate, getDayOfWeekIndex, getFirstWorkDayOfWeek, getHumanDate, getIsWeekend, getWeekNumber } from "./utils";
|
||||
import { ClientData, Restaurants, DayMenu, DepartureTime, DayData, WeekMenu, LocationKey } from "../../types";
|
||||
import getStorage from "./storage";
|
||||
import { getMenuSladovnicka, getMenuTechTower, getMenuUMotliku } from "./restaurants";
|
||||
import { getMenuSladovnicka, getMenuTechTower, getMenuUMotliku, getMenuZastavkaUmichala } from "./restaurants";
|
||||
import { getTodayMock } from "./mock";
|
||||
|
||||
const storage = getStorage();
|
||||
@@ -10,7 +10,7 @@ const MENU_PREFIX = 'menu';
|
||||
/** Vrátí dnešní datum, případně fiktivní datum pro účely vývoje a testování. */
|
||||
export function getToday(): Date {
|
||||
if (process.env.MOCK_DATA === 'true') {
|
||||
return new Date(getTodayMock());
|
||||
return getTodayMock();
|
||||
}
|
||||
return new Date();
|
||||
}
|
||||
@@ -61,6 +61,7 @@ export async function getData(date?: Date): Promise<ClientData> {
|
||||
[Restaurants.SLADOVNICKA]: await getRestaurantMenu(Restaurants.SLADOVNICKA, date),
|
||||
// [Restaurants.UMOTLIKU]: await getRestaurantMenu(Restaurants.UMOTLIKU, date),
|
||||
[Restaurants.TECHTOWER]: await getRestaurantMenu(Restaurants.TECHTOWER, date),
|
||||
[Restaurants.ZASTAVKAUMICHALA]: await getRestaurantMenu(Restaurants.ZASTAVKAUMICHALA, date),
|
||||
}
|
||||
clientData = await addVolatileData(clientData);
|
||||
return clientData;
|
||||
@@ -168,6 +169,19 @@ export async function getRestaurantMenu(restaurant: Restaurants, date?: Date): P
|
||||
} catch (e: any) {
|
||||
console.error("Selhalo načtení jídel pro podnik TechTower", e);
|
||||
}
|
||||
case Restaurants.ZASTAVKAUMICHALA:
|
||||
try {
|
||||
const zastavkaUmichalaFood = await getMenuZastavkaUmichala(firstDay, mock);
|
||||
for (let i = 0; i < zastavkaUmichalaFood.length; i++) {
|
||||
menus[i][restaurant]!.food = zastavkaUmichalaFood[i];
|
||||
if (zastavkaUmichalaFood[i]?.length === 1 && zastavkaUmichalaFood[i][0].name === 'Pro tento den není uveřejněna nabídka jídel.') {
|
||||
menus[i][restaurant]!.closed = true;
|
||||
}
|
||||
}
|
||||
break;
|
||||
} catch (e: any) {
|
||||
console.error("Selhalo načtení jídel pro podnik Zastávka u Michala", e);
|
||||
}
|
||||
}
|
||||
await storage.setData(getMenuKey(usedDate), menus);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user