Exclude placeholder teams and league teams from global status

This commit is contained in:
Kalle
2026-09-20 07:33:48 +03:00
parent 5bc7cb9a74
commit 43778b8582
2 changed files with 36 additions and 0 deletions

View File

@@ -5,6 +5,7 @@ import * as SQGroupFactory from "~/db/seed/factories/SQGroupFactory";
import * as SQMatchFactory from "~/db/seed/factories/SQMatchFactory";
import * as SQReadyCheckFactory from "~/db/seed/factories/SQReadyCheckFactory";
import * as TournamentFactory from "~/db/seed/factories/TournamentFactory";
import * as TournamentLFGTeamFactory from "~/db/seed/factories/TournamentLFGTeamFactory";
import * as TournamentTeamFactory from "~/db/seed/factories/TournamentTeamFactory";
import * as UserFactory from "~/db/seed/factories/UserFactory";
import { refreshSendouQInstance } from "~/features/sendouq/core/SendouQ.server";
@@ -204,6 +205,35 @@ describe("resolveGlobalStatus", () => {
expect(await resolveGlobalStatus(users.id(1))).toBeNull();
});
test("resolves nothing for a solo player looking for a team", async () => {
const { id: tournamentId } = await TournamentFactory.create({
authorId: users.id(8),
startTimes: [dateToDatabaseTimestamp(addMinutes(new Date(), 30))],
});
await TournamentLFGTeamFactory.create({
tournamentId,
userId: users.id(1),
});
expect(await resolveGlobalStatus(users.id(1))).toBeNull();
});
test("resolves nothing for a league, which has no check-in", async () => {
const { id: tournamentId } = await TournamentFactory.create(
{
authorId: users.id(8),
startTimes: [dateToDatabaseTimestamp(addMinutes(new Date(), 30))],
},
{ isLeague: true },
);
await TournamentTeamFactory.create({
tournamentId,
memberUserIds: userIds([1, 2, 3, 4]),
});
expect(await resolveGlobalStatus(users.id(1))).toBeNull();
});
test("resolves nothing while check-in has yet to open", async () => {
const { id: tournamentId } = await TournamentFactory.create({
authorId: users.id(8),

View File

@@ -988,11 +988,17 @@ export function findPendingCheckInsStartingBetween({
.where("CalendarEvent.hidden", "=", 0)
.where("Tournament.isFinalized", "=", 0)
.where("TournamentTeam.droppedOut", "=", 0)
.where("TournamentTeam.isPlaceholder", "=", 0)
.where(
sql<number>`json_extract("Tournament"."settings", '$.isTest')`,
"is not",
1,
)
.where(
sql<number>`json_extract("Tournament"."settings", '$.isLeague')`,
"is not",
1,
)
.where(
sql<number>`json_extract("Tournament"."settings", '$.isDraft')`,
"is not",