Skip to content

Commit

Permalink
Merge branch 'rewrite' into rewrite
Browse files Browse the repository at this point in the history
  • Loading branch information
Sendouc authored Dec 19, 2024
2 parents d5a8495 + b8880e3 commit 4872c32
Show file tree
Hide file tree
Showing 14 changed files with 40 additions and 3 deletions.
15 changes: 15 additions & 0 deletions app/features/badges/homemade.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,21 @@ export const homemadeBadges: BadgeInfo[] = [
fileName: "academy_showcase",
authorDiscordId: "643355948265766912",
},
{
displayName: "50 Caliber League (First Place)",
fileName: "50-cal-fir",
authorDiscordId: "530093822806458368",
},
{
displayName: "50 Caliber League (Second Place)",
fileName: "50-cal-sec",
authorDiscordId: "530093822806458368",
},
{
displayName: "50 Caliber League (Third Place)",
fileName: "50-cal-thi",
authorDiscordId: "530093822806458368",
},
{
displayName: "Turf War Takedown",
fileName: "turf1230",
Expand Down
13 changes: 12 additions & 1 deletion app/features/tournament-bracket/core/rounds.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ export function getRounds(args: {
const hasThirdPlaceMatch =
args.type === "single" &&
removeDuplicates(args.bracketData.match.map((m) => m.group_id)).length > 1;
return rounds.map((round, i) => {
const namedRounds = rounds.map((round, i) => {
const name = () => {
if (
showingBracketReset &&
Expand Down Expand Up @@ -100,4 +100,15 @@ export function getRounds(args: {
name: name(),
};
});

return adjustRoundNumbers(namedRounds);
}

// adjusting losers bracket round numbers to start from 1, can sometimes start with 2 if byes are certain way
export function adjustRoundNumbers<T extends { number: number }>(rounds: T[]) {
if (rounds.at(0)?.number === 1) {
return rounds;
}

return rounds.map((round) => ({ ...round, number: round.number - 1 }));
}
Original file line number Diff line number Diff line change
Expand Up @@ -810,7 +810,9 @@ function MatchHeader() {
return (
<div className="line-height-tight" data-testid="match-header">
<h2 className="text-lg">{roundName}</h2>
<div className="text-lighter text-xs font-bold">{bracketName}</div>
{tournament.ctx.settings.bracketProgression.length > 1 ? (
<div className="text-lighter text-xs font-bold">{bracketName}</div>
) : null}
</div>
);
}
Expand Down
6 changes: 6 additions & 0 deletions app/features/tournament/core/Standings.ts
Original file line number Diff line number Diff line change
Expand Up @@ -91,9 +91,15 @@ export function tournamentStandings(tournament: Tournament): Standing[] {
const result: Standing[] = [];
const alreadyIncludedTeamIds = new Set<number>();

const finalBracketIsOver = tournament.brackets.some(
(bracket) => bracket.isFinals && bracket.everyMatchOver,
);

for (const bracketIdx of bracketIdxs) {
const bracket = tournament.bracketByIdx(bracketIdx);
if (!bracket) continue;
// sometimes a bracket might not be played so then we ignore it from the standings
if (finalBracketIsOver && bracket.preview) continue;

const standings = standingsToMergeable({
alreadyIncludedTeamIds,
Expand Down
5 changes: 4 additions & 1 deletion app/features/tournament/routes/to.$id.teams.$tid.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,10 @@ function SetInfo({ set, team }: { set: PlayedSet; team: TournamentDataTeam }) {
})}
className="tournament__team__set__round-name"
>
{roundNameWithoutMatchIdentifier} - {bracketName}
{roundNameWithoutMatchIdentifier}{" "}
{tournament.ctx.settings.bracketProgression.length > 1 ? (
<>- {bracketName}</>
) : null}
</Link>
</div>
<div className="overlap-divider">
Expand Down
Binary file added public/static-assets/badges/50-cal-fir.avif
Binary file not shown.
Binary file added public/static-assets/badges/50-cal-fir.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added public/static-assets/badges/50-cal-fir.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added public/static-assets/badges/50-cal-sec.avif
Binary file not shown.
Binary file added public/static-assets/badges/50-cal-sec.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added public/static-assets/badges/50-cal-sec.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added public/static-assets/badges/50-cal-thi.avif
Binary file not shown.
Binary file added public/static-assets/badges/50-cal-thi.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added public/static-assets/badges/50-cal-thi.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 4872c32

Please sign in to comment.