Skip to content

Commit

Permalink
Assign default prefix if tournament name has no letters Closes #2074
Browse files Browse the repository at this point in the history
  • Loading branch information
Sendouc committed Feb 4, 2025
1 parent 3fa0f15 commit b990cf8
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion app/features/tournament-bracket/core/Tournament.ts
Original file line number Diff line number Diff line change
Expand Up @@ -695,13 +695,20 @@ export class Tournament {
/[^a-zA-Z ]/g,
"",
);
const prefix = tournamentNameWithoutOnlyLetters
let prefix = tournamentNameWithoutOnlyLetters
.split(" ")
.map((word) => word[0])
.join("")
.toUpperCase()
.slice(0, 3);

// handle tournament name not having letters by using a default prefix
if (!prefix) {
prefix = ["AB", "CD", "EF", "GH", "IJ", "KL", "MN", "OP", "QR", "ST"][
this.ctx.id % 10
];
}

return {
prefix,
suffix: groupLetter ?? bracketNumber ?? hostingTeamId % 10,
Expand Down

0 comments on commit b990cf8

Please sign in to comment.