Skip to content

Commit a0a53ac

Browse files
authored
Merge pull request #83 from coder13/codex/update-nametag-csv-export-for-natshelper-stages
Include natshelper stage prefixes in nametag CSV export
2 parents 93f21e4 + 9ef21d9 commit a0a53ac

1 file changed

Lines changed: 8 additions & 1 deletion

File tree

src/pages/Competition/Export/index.tsx

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,8 +69,15 @@ const groupNumber = ({ activityCode }: Pick<Activity, 'activityCode'>) =>
6969
const staffingAssignmentToText = ({ assignmentCode, activity }: AssignmentWithActivity) =>
7070
`${assignmentCode.split('-')[1][0].toUpperCase()}${groupNumber(activity)}`;
7171

72+
const stagePrefixForNametags = (room: Room, activity: ActivityWithParent) => {
73+
const stageName = getStageName(room, activity);
74+
const stagePrefix = stageName.match(/[A-Za-z]+/)?.[0];
75+
76+
return stagePrefix || room.name[0];
77+
};
78+
7279
const competingAssignmentToText = (activity: ActivityWithParent) =>
73-
`${activity.parent.room.name[0]}${groupNumber(activity)}`;
80+
`${stagePrefixForNametags(activity.parent.room, activity)}${groupNumber(activity)}`;
7481

7582
const getStageName = (room: Room, activity: ActivityWithParent) => {
7683
const stages = getRoomExtensionData(room)?.stages;

0 commit comments

Comments
 (0)