Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Show start time in matches #319

Merged
merged 2 commits into from
Nov 7, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion backend/bracket/logic/matches.py
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ def has_conflict(
return False


async def schedule_all_matches_2(tournament_id: int) -> None:
async def todo_schedule_all_matches(tournament_id: int) -> None:
tournament = await sql_get_tournament(tournament_id)
stages = await get_full_tournament_details(tournament_id)
courts = await get_all_courts_in_tournament(tournament_id)
Expand Down
19 changes: 0 additions & 19 deletions backend/bracket/sql/courts.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,25 +13,6 @@ async def get_all_courts_in_tournament(tournament_id: int) -> list[Court]:
return [Court.parse_obj(x._mapping) for x in result]


async def get_all_free_courts_in_round(tournament_id: int, round_id: int) -> list[Court]:
query = '''
SELECT *
FROM courts
WHERE NOT EXISTS (
SELECT 1
FROM matches
WHERE matches.court_id = courts.id
AND matches.round_id = :round_id
)
AND courts.tournament_id = :tournament_id
ORDER BY courts.name
'''
result = await database.fetch_all(
query=query, values={'tournament_id': tournament_id, 'round_id': round_id}
)
return [Court.parse_obj(x._mapping) for x in result]


async def update_court(tournament_id: int, court_id: int, court_body: CourtBody) -> list[Court]:
query = '''
UPDATE courts
Expand Down
11 changes: 9 additions & 2 deletions frontend/src/components/brackets/match.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import { MatchInterface, formatMatchTeam1, formatMatchTeam2 } from '../../interf
import { TournamentMinimal } from '../../interfaces/tournament';
import { getMatchLookup, getStageItemLookup } from '../../services/lookups';
import MatchModal from '../modals/match_modal';
import { Time } from '../utils/datetime';

import Visibility = Property.Visibility;

Expand Down Expand Up @@ -43,13 +44,19 @@ export function MatchBadge({ match, theme }: { match: MatchInterface; theme: any
<div
style={{
width: '75%',
backgroundColor: badgeColor,
backgroundColor:
new Date(match.start_time) < new Date() &&
new Date(new Date(match.start_time).getTime() + 60000 * 15) > new Date()
? theme.colors.grape[9]
: badgeColor,
borderRadius: '8px 8px 0px 0px',
padding: '4px 12px 4px 12px',
}}
>
<Center>
<b>{match.court?.name}</b>
<b>
{match.court?.name} | <Time datetime={match.start_time} />
</b>
</Center>
</div>
</Center>
Expand Down