Replace 1h KO with a catch all category - display only when required

This commit is contained in:
Timothy Armes
2023-07-07 09:42:05 +02:00
parent 88e75511d7
commit d8a5b4393a
10 changed files with 67 additions and 47 deletions
+2 -3
View File
@@ -14,7 +14,7 @@ export interface TournamentData {
department: string;
tournament: string;
url: string;
time_control: "Cadence Lente" | "Rapide" | "Blitz" | "1h KO";
time_control: "Cadence Lente" | "Rapide" | "Blitz" | string;
date: string;
coordinates: [number, number];
}
@@ -23,7 +23,6 @@ const tcMap: Record<TournamentData["time_control"], TimeControl> = {
"Cadence Lente": TimeControl.Classic,
Rapide: TimeControl.Rapid,
Blitz: TimeControl.Blitz,
"1h KO": TimeControl.KO,
};
const getTournaments = async () => {
@@ -57,7 +56,7 @@ const getTournaments = async () => {
return data.map<Tournament>((t) => ({
...t,
_id: t._id.toString(),
timeControl: tcMap[t.time_control],
timeControl: tcMap[t.time_control] ?? TimeControl.Other,
latLng: { lat: t.coordinates[0], lng: t.coordinates[1] },
}));
} catch (error) {