Skip to content

Commit 3bc5f44

Browse files
authored
Merge pull request #261 from HackGT/hg13-cgcsv
hg13
2 parents 7c4032b + 382b5a7 commit 3bc5f44

1 file changed

Lines changed: 30 additions & 1 deletion

File tree

‎services/expo/src/routes/categorygroups.ts‎

Lines changed: 30 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -283,6 +283,35 @@ categoryGroupRoutes.route("/:id/selfAssign").post(
283283
})
284284
);
285285

286+
// HackGT 13 specific: maps a room and table number to the table codes used on the venue layout.
287+
// Rooms not listed here fall back to the raw table number.
288+
const getTableCode = (room: string | undefined, table: number | null) => {
289+
if (table === null) {
290+
return null;
291+
}
292+
if (room === undefined) {
293+
return table;
294+
}
295+
if (room === "Klaus Atrium") {
296+
return `A${table}`;
297+
}
298+
if (room.includes("1116")) {
299+
return `B${table}`;
300+
}
301+
// Klaus Atrium 2 continues code A after Klaus Atrium's 86 tables
302+
if (room === "Klaus Atrium 2") {
303+
return `A${table + 86}`;
304+
}
305+
if (room.includes("1456")) {
306+
return `C${table}`;
307+
}
308+
// 1447 shares code C with 1456, continuing after 1456's 25 tables
309+
if (room.includes("1447")) {
310+
return `C${table + 25}`;
311+
}
312+
return table;
313+
};
314+
286315
categoryGroupRoutes.route("/:id/generate-csv").get(
287316
checkAbility("read", "CategoryGroup"),
288317
asyncHandler(async (req, res) => {
@@ -330,7 +359,7 @@ categoryGroupRoutes.route("/:id/generate-csv").get(
330359
project.githubUrl,
331360
project.expo,
332361
project.tableGroup?.name,
333-
project.table,
362+
getTableCode(project.tableGroup?.name, project.table),
334363
]
335364
.map(escapeCsv)
336365
.join(",")

0 commit comments

Comments
 (0)