mirror of
https://github.com/Sendouc/sendou.ink.git
synced 2026-11-12 22:29:53 -06:00
Show the division a result came from on the team results page for multi-division tournaments
This commit is contained in:
@@ -12,7 +12,7 @@ import * as TeamRepository from "./TeamRepository.server";
|
||||
import { TEAM } from "./team-constants";
|
||||
|
||||
describe("findResultsById", () => {
|
||||
test("participant who was on the roster at the result's time but left later is not a sub", async () => {
|
||||
const seedTeamResult = async ({ div }: { div: string | null }) => {
|
||||
const [owner, formerMember] = await UserFactory.createMany(2);
|
||||
const team = await TeamFactory.create({
|
||||
memberUserIds: [owner.id, formerMember.id],
|
||||
@@ -42,12 +42,20 @@ describe("findResultsById", () => {
|
||||
placement: 1,
|
||||
participantCount: 8,
|
||||
tournamentTeamId: tournamentTeam.id,
|
||||
div: null,
|
||||
div,
|
||||
})),
|
||||
setResults: new Map(),
|
||||
},
|
||||
});
|
||||
|
||||
return { team, tournament, formerMember };
|
||||
};
|
||||
|
||||
test("participant who was on the roster at the result's time but left later is not a sub", async () => {
|
||||
const { team, tournament, formerMember } = await seedTeamResult({
|
||||
div: null,
|
||||
});
|
||||
|
||||
const { startsAt } = await db
|
||||
.selectFrom("CalendarEventDate")
|
||||
.select("startsAt")
|
||||
@@ -67,6 +75,14 @@ describe("findResultsById", () => {
|
||||
expect(results).toHaveLength(1);
|
||||
expect(results[0].subs).toHaveLength(0);
|
||||
});
|
||||
|
||||
test("returns the division the team placed in", async () => {
|
||||
const { team } = await seedTeamResult({ div: "D2" });
|
||||
|
||||
const results = await TeamRepository.findResultsById(team.id);
|
||||
|
||||
expect(results[0].div).toBe("D2");
|
||||
});
|
||||
});
|
||||
|
||||
describe("insertOwnMembership", () => {
|
||||
|
||||
@@ -234,6 +234,7 @@ export async function findResultsById(teamId: number) {
|
||||
"TournamentResult.tournamentId",
|
||||
"TournamentResult.placement",
|
||||
"TournamentResult.participantCount",
|
||||
"TournamentResult.div",
|
||||
"TournamentTeam.startingBracketIdx",
|
||||
])
|
||||
.where("teamId", "=", teamId)
|
||||
@@ -267,6 +268,7 @@ export async function findResultsById(teamId: number) {
|
||||
"results.tournamentId",
|
||||
"results.participantCount",
|
||||
"results.tournamentTeamId",
|
||||
"results.div",
|
||||
"CalendarEvent.name as tournamentName",
|
||||
"CalendarEventDate.startsAt",
|
||||
sql<
|
||||
|
||||
@@ -71,6 +71,9 @@ export function TeamResultsTable({ results }: TeamResultsTableProps) {
|
||||
>
|
||||
{result.tournamentName}
|
||||
</Link>
|
||||
{result.div ? (
|
||||
<span className="text-lighter">({result.div})</span>
|
||||
) : null}
|
||||
{result.tier ? <TierPill tier={result.tier} /> : null}
|
||||
</div>
|
||||
</td>
|
||||
|
||||
5
changelog/2026-11-08-team-results-division.md
Normal file
5
changelog/2026-11-08-team-results-division.md
Normal file
@@ -0,0 +1,5 @@
|
||||
---
|
||||
navItem: t
|
||||
type: feature
|
||||
---
|
||||
Team results now show the division the team played in for tournaments with several divisions, like user results do
|
||||
Reference in New Issue
Block a user