diff --git a/backend/bracket/routes/teams.py b/backend/bracket/routes/teams.py index 187221a4..e24cf287 100644 --- a/backend/bracket/routes/teams.py +++ b/backend/bracket/routes/teams.py @@ -115,11 +115,6 @@ async def create_team( tournament_id: int, _: UserPublic = Depends(user_authenticated_for_tournament), ) -> SingleTeamResponse: - tournament_teams = await get_teams_with_members(tournament_id) - for team in tournament_teams: - if team.player_ids != [] and sorted(team.player_ids) == sorted(team_to_insert.player_ids): - return SingleTeamResponse(data=team) - last_record_id = await database.execute( query=teams.insert(), values=TeamToInsert( diff --git a/frontend/src/components/buttons/create_matches_auto.tsx b/frontend/src/components/buttons/create_matches_auto.tsx index acc3f841..ccd3ea17 100644 --- a/frontend/src/components/buttons/create_matches_auto.tsx +++ b/frontend/src/components/buttons/create_matches_auto.tsx @@ -1,7 +1,10 @@ import { Button } from '@mantine/core'; import { IconTool } from '@tabler/icons-react'; import React from 'react'; +import { SWRResponse } from 'swr'; +import { SchedulerSettings } from '../../interfaces/match'; +import { Tournament } from '../../interfaces/tournament'; import { createMatchesAuto } from '../../services/round'; export function AutoCreateMatchesButton({ @@ -9,7 +12,14 @@ export function AutoCreateMatchesButton({ swrStagesResponse, swrUpcomingMatchesResponse, roundId, -}: any) { + schedulerSettings, +}: { + schedulerSettings: SchedulerSettings; + roundId: number; + tournamentData: Tournament; + swrStagesResponse: SWRResponse; + swrUpcomingMatchesResponse: SWRResponse; +}) { if (roundId == null) { return null; } @@ -21,9 +31,15 @@ export function AutoCreateMatchesButton({ color="indigo" leftIcon={} onClick={async () => { - await createMatchesAuto(tournamentData.id, roundId); - swrStagesResponse.mutate(); - swrUpcomingMatchesResponse.mutate(); + await createMatchesAuto( + tournamentData.id, + roundId, + schedulerSettings.eloThreshold, + schedulerSettings.onlyRecommended, + schedulerSettings.iterations + ); + await swrStagesResponse.mutate(); + await swrUpcomingMatchesResponse.mutate(); }} > Add new matches automatically diff --git a/frontend/src/components/info/player_list.tsx b/frontend/src/components/info/player_list.tsx index 441df3a7..dd612415 100644 --- a/frontend/src/components/info/player_list.tsx +++ b/frontend/src/components/info/player_list.tsx @@ -9,12 +9,12 @@ export default function PlayerList({ team: TeamInterface; displaySettings?: BracketDisplaySettings | null; }) { - if (team.players.length < 1) { - return No members; - } if (displaySettings != null && displaySettings.teamNamesDisplay === 'team-names') { return {team.name}; } + if (team.players.length < 1) { + return No members; + } const playerNames = team.players .map((player) => truncateString(player.name, 15)) diff --git a/frontend/src/components/scheduling/scheduling.tsx b/frontend/src/components/scheduling/scheduling.tsx index 7cc934bb..4fd69ba5 100644 --- a/frontend/src/components/scheduling/scheduling.tsx +++ b/frontend/src/components/scheduling/scheduling.tsx @@ -12,10 +12,6 @@ import { AutoCreateMatchesButton } from '../buttons/create_matches_auto'; import UpcomingMatchesTable from '../tables/upcoming_matches'; import SwissSettings from './settings/ladder_fixed'; -function StageSettings({ schedulerSettings }: { schedulerSettings: SchedulerSettings }) { - return ; -} - function SchedulingSystem({ activeStage, tournamentData, @@ -73,7 +69,7 @@ export default function Scheduler({ - + @@ -82,6 +78,7 @@ export default function Scheduler({ swrUpcomingMatchesResponse={swrUpcomingMatchesResponse} tournamentData={tournamentData} roundId={roundId} + schedulerSettings={schedulerSettings} /> diff --git a/frontend/src/components/tables/clubs.tsx b/frontend/src/components/tables/clubs.tsx index 97f951c5..c628b757 100644 --- a/frontend/src/components/tables/clubs.tsx +++ b/frontend/src/components/tables/clubs.tsx @@ -18,7 +18,7 @@ export default function ClubsTable({ swrClubsResponse }: { swrClubsResponse: SWR const rows = clubs .sort((p1: Club, p2: Club) => sortTableEntries(p1, p2, tableState)) .map((club) => ( - + {club.name} diff --git a/frontend/src/components/tables/courts.tsx b/frontend/src/components/tables/courts.tsx index fff40992..3c148836 100644 --- a/frontend/src/components/tables/courts.tsx +++ b/frontend/src/components/tables/courts.tsx @@ -24,7 +24,7 @@ export default function CourtsTable({ const rows = courts .sort((s1: Court, s2: Court) => sortTableEntries(s1, s2, tableState)) .map((court) => ( - + {court.name} sortTableEntries(p1, p2, tableState)) .map((player) => ( - + {player.active ? ( Active diff --git a/frontend/src/components/tables/teams.tsx b/frontend/src/components/tables/teams.tsx index e9c08d3a..d9708bc6 100644 --- a/frontend/src/components/tables/teams.tsx +++ b/frontend/src/components/tables/teams.tsx @@ -29,7 +29,7 @@ export default function TeamsTable({ const rows = teams .sort((p1: TeamInterface, p2: TeamInterface) => sortTableEntries(p1, p2, tableState)) .map((team) => ( - + {team.active ? Active : Inactive} diff --git a/frontend/src/components/tables/tournaments.tsx b/frontend/src/components/tables/tournaments.tsx index 8bd9c999..f42e0924 100644 --- a/frontend/src/components/tables/tournaments.tsx +++ b/frontend/src/components/tables/tournaments.tsx @@ -31,7 +31,7 @@ export default function TournamentsTable({ const rows = tournaments .sort((p1: Tournament, p2: Tournament) => sortTableEntries(p1, p2, tableState)) .map((tournament) => ( - + {tournament.name} diff --git a/frontend/src/components/tables/upcoming_matches.tsx b/frontend/src/components/tables/upcoming_matches.tsx index 7b1064f7..ce9b8df2 100644 --- a/frontend/src/components/tables/upcoming_matches.tsx +++ b/frontend/src/components/tables/upcoming_matches.tsx @@ -5,7 +5,6 @@ import { SWRResponse } from 'swr'; import { BracketDisplaySettings } from '../../interfaces/brackets'; import { MatchCreateBodyInterface, UpcomingMatchInterface } from '../../interfaces/match'; -import { TeamInterface } from '../../interfaces/team'; import { Tournament } from '../../interfaces/tournament'; import { createMatch } from '../../services/match'; import PlayerList from '../info/player_list'; @@ -13,10 +12,6 @@ import { EmptyTableInfo } from '../utils/empty_table_info'; import RequestErrorAlert from '../utils/error_alert'; import TableLayout, { ThNotSortable, ThSortable, getTableState, sortTableEntries } from './table'; -function getPlayerIds(team: TeamInterface) { - return team.players.map((p) => p.id.toString()); -} - export default function UpcomingMatchesTable({ round_id, tournamentData, @@ -62,7 +57,7 @@ export default function UpcomingMatchesTable({ sortTableEntries(m1, m2, tableState) ) .map((upcoming_match: UpcomingMatchInterface) => ( - + {upcoming_match.is_recommended ? ( } color="blue"> diff --git a/frontend/src/pages/tournaments/[id]/teams.tsx b/frontend/src/pages/tournaments/[id]/teams.tsx index 533ce473..2860777a 100644 --- a/frontend/src/pages/tournaments/[id]/teams.tsx +++ b/frontend/src/pages/tournaments/[id]/teams.tsx @@ -27,7 +27,7 @@ function StageItemSelect({ return (