diff --git a/app/features/team/TeamRepository.server.test.ts b/app/features/team/TeamRepository.server.test.ts index 33da1e810..639df0323 100644 --- a/app/features/team/TeamRepository.server.test.ts +++ b/app/features/team/TeamRepository.server.test.ts @@ -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", () => { diff --git a/app/features/team/TeamRepository.server.ts b/app/features/team/TeamRepository.server.ts index 7723ee095..ceef06d8d 100644 --- a/app/features/team/TeamRepository.server.ts +++ b/app/features/team/TeamRepository.server.ts @@ -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< diff --git a/app/features/team/components/TeamResultsTable.tsx b/app/features/team/components/TeamResultsTable.tsx index 939f1a0a0..f84c5013d 100644 --- a/app/features/team/components/TeamResultsTable.tsx +++ b/app/features/team/components/TeamResultsTable.tsx @@ -71,6 +71,9 @@ export function TeamResultsTable({ results }: TeamResultsTableProps) { > {result.tournamentName} + {result.div ? ( + ({result.div}) + ) : null} {result.tier ? : null} diff --git a/changelog/2026-11-08-team-results-division.md b/changelog/2026-11-08-team-results-division.md new file mode 100644 index 000000000..bcfcf182a --- /dev/null +++ b/changelog/2026-11-08-team-results-division.md @@ -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