From 1228c7dbeb93f2fa94a7c28db2e07407191a6d7d Mon Sep 17 00:00:00 2001 From: Erik Vroon Date: Sat, 18 Nov 2023 12:24:13 +0100 Subject: [PATCH] Cleanup unnecessary scheduling code (#333) --- backend/bracket/schema.py | 2 ++ .../src/components/brackets/match_large.tsx | 4 +-- frontend/src/components/brackets/round.tsx | 2 +- .../src/components/scheduling/scheduling.tsx | 29 ++++--------------- .../scheduling/settings/elimination.tsx | 13 --------- .../scheduling/settings/placeholder.tsx | 11 ------- .../scheduling/settings/round_robin.tsx | 13 --------- 7 files changed, 10 insertions(+), 64 deletions(-) delete mode 100644 frontend/src/components/scheduling/settings/elimination.tsx delete mode 100644 frontend/src/components/scheduling/settings/placeholder.tsx delete mode 100644 frontend/src/components/scheduling/settings/round_robin.tsx diff --git a/backend/bracket/schema.py b/backend/bracket/schema.py index f9dd2486..52b8780a 100644 --- a/backend/bracket/schema.py +++ b/backend/bracket/schema.py @@ -27,6 +27,7 @@ tournaments = Table( Column('dashboard_endpoint', String, nullable=True), Column('players_can_be_in_multiple_teams', Boolean, nullable=False, server_default='f'), Column('auto_assign_courts', Boolean, nullable=False, server_default='f'), + Column('duration_minutes', Integer, nullable=False, server_default='15'), ) stages = Table( @@ -96,6 +97,7 @@ matches = Table( Column('created', DateTimeTZ, nullable=False), Column('start_time', DateTimeTZ, nullable=True), Column('duration_minutes', Integer, nullable=True), + Column('custom_duration_minutes', Integer, nullable=True), Column('round_id', BigInteger, ForeignKey('rounds.id'), nullable=False), Column('team1_id', BigInteger, ForeignKey('teams.id'), nullable=True), Column('team2_id', BigInteger, ForeignKey('teams.id'), nullable=True), diff --git a/frontend/src/components/brackets/match_large.tsx b/frontend/src/components/brackets/match_large.tsx index a981dc44..208be089 100644 --- a/frontend/src/components/brackets/match_large.tsx +++ b/frontend/src/components/brackets/match_large.tsx @@ -69,7 +69,7 @@ export default function MatchLarge({ const [opened, setOpened] = useState(false); const bracket = ( - <> +
@@ -84,7 +84,7 @@ export default function MatchLarge({ {match.team2_score}
- +
); if (readOnly) { diff --git a/frontend/src/components/brackets/round.tsx b/frontend/src/components/brackets/round.tsx index 12d4d771..df74be15 100644 --- a/frontend/src/components/brackets/round.tsx +++ b/frontend/src/components/brackets/round.tsx @@ -77,7 +77,7 @@ export default function Round({ if (matches.length < 1) return null; return ( -
+
; - } - const stageItem = getStageItem(activeStage); - if (stageItem.type === 'ROUND_ROBIN') { - return ; - } - if (stageItem.type === 'SINGLE_ELIMINATION') { - return ; - } - return ; +function StageSettings({ schedulerSettings }: { schedulerSettings: SchedulerSettings }) { + return ; } function SchedulingSystem({ @@ -80,13 +61,13 @@ export default function Scheduler({ }) { const draftRound = getRoundsLookup(swrRoundsResponse)[roundId]; return ( -
+

Schedule new matches for {draftRound.name} in {activeStage.name}

- + diff --git a/frontend/src/components/scheduling/settings/elimination.tsx b/frontend/src/components/scheduling/settings/elimination.tsx deleted file mode 100644 index 1fb9f44f..00000000 --- a/frontend/src/components/scheduling/settings/elimination.tsx +++ /dev/null @@ -1,13 +0,0 @@ -import { Alert } from '@mantine/core'; -import { IconAlertCircle } from '@tabler/icons-react'; -import React from 'react'; - -export default function Elimination() { - return ( - } title="No options" color="blue" radius="lg"> - For elimination, scheduling is handled automatically. -
- Therefore, no options are available. -
- ); -} diff --git a/frontend/src/components/scheduling/settings/placeholder.tsx b/frontend/src/components/scheduling/settings/placeholder.tsx deleted file mode 100644 index a12bf010..00000000 --- a/frontend/src/components/scheduling/settings/placeholder.tsx +++ /dev/null @@ -1,11 +0,0 @@ -import { Alert } from '@mantine/core'; -import { IconAlertCircle } from '@tabler/icons-react'; -import React from 'react'; - -export default function SchedulingPlaceholder() { - return ( - } title="No options" color="yellow" radius="lg"> - There is no active stage. - - ); -} diff --git a/frontend/src/components/scheduling/settings/round_robin.tsx b/frontend/src/components/scheduling/settings/round_robin.tsx deleted file mode 100644 index 4545c7d8..00000000 --- a/frontend/src/components/scheduling/settings/round_robin.tsx +++ /dev/null @@ -1,13 +0,0 @@ -import { Alert } from '@mantine/core'; -import { IconAlertCircle } from '@tabler/icons-react'; -import React from 'react'; - -export default function RoundRobin() { - return ( - } title="No options" color="blue" radius="lg"> - For round robin scheduling, scheduling is handled automatically. -
- Therefore, no options are available. -
- ); -}