mirror of
https://github.com/Sendouc/sendou.ink.git
synced 2026-09-26 13:17:15 -05:00
Exclude placeholder teams and league teams from global status
This commit is contained in:
@@ -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),
|
||||
|
||||
@@ -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",
|
||||
|
||||
Reference in New Issue
Block a user