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

Create ranking for demo #893

Merged
merged 2 commits into from
Sep 7, 2024
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
7 changes: 6 additions & 1 deletion backend/bracket/logic/subscriptions.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,10 @@

from bracket.models.db.account import UserAccountType
from bracket.models.db.club import ClubCreateBody
from bracket.models.db.ranking import RankingCreateBody
from bracket.models.db.tournament import TournamentBody
from bracket.sql.clubs import create_club
from bracket.sql.rankings import sql_create_ranking
from bracket.sql.tournaments import sql_create_tournament
from bracket.utils.id_types import UserId
from bracket.utils.types import assert_some
Expand Down Expand Up @@ -86,4 +88,7 @@ async def setup_demo_account(user_id: UserId) -> None:
duration_minutes=10,
margin_minutes=5,
)
await sql_create_tournament(tournament)
tournament_id = await sql_create_tournament(tournament)

ranking = RankingCreateBody()
await sql_create_ranking(tournament_id=tournament_id, ranking_body=ranking, position=0)
4 changes: 2 additions & 2 deletions backend/bracket/models/db/ranking.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ class RankingBody(BaseModel):


class RankingCreateBody(BaseModel):
win_points: Decimal = Decimal("3.0")
draw_points: Decimal = Decimal("1.0")
win_points: Decimal = Decimal("1.0")
draw_points: Decimal = Decimal("0.5")
loss_points: Decimal = Decimal("0.0")
add_score_points: bool = False