diff --git a/app/routers/games.py b/app/routers/games.py index ee4dfc0..1422a6a 100644 --- a/app/routers/games.py +++ b/app/routers/games.py @@ -158,7 +158,7 @@ async def games_list(request: Request, user: dict = Depends(get_current_user), async def new_game_page(request: Request, user: dict = Depends(get_current_user), db: aiosqlite.Connection = Depends(get_db)): async with db.execute( - "SELECT id, name, avatar FROM users WHERE is_onboarded = 1 ORDER BY name" + "SELECT id, name, avatar, handicap FROM users WHERE is_onboarded = 1 ORDER BY name" ) as c: all_users = [dict(r) for r in await c.fetchall()] async with db.execute("SELECT id, name, holes, location FROM courses ORDER BY name") as c: @@ -216,7 +216,7 @@ async def create_game(request: Request, holes_count: int = Form(...), if error: async with db.execute( - "SELECT id, name, avatar FROM users WHERE is_onboarded = 1 ORDER BY name" + "SELECT id, name, avatar, handicap FROM users WHERE is_onboarded = 1 ORDER BY name" ) as c: all_users = [dict(r) for r in await c.fetchall()] async with db.execute( diff --git a/app/templates/games/new_game.html b/app/templates/games/new_game.html index 62df216..9085862 100644 --- a/app/templates/games/new_game.html +++ b/app/templates/games/new_game.html @@ -5,11 +5,16 @@ {% endblock %} @@ -22,7 +27,10 @@ courseOpen: false, courseSearch: '', format: 'bingo_bango_bongo', + carryoverEnabled: true, + holesCount: '', selectedPlayers: ['{{ user.id }}'], + selectedTees: {}, playerSearch: '', filteredCourses() { const q = this.courseSearch.toLowerCase(); @@ -44,7 +52,18 @@ else if (id !== '{{ user.id }}') this.selectedPlayers.splice(idx, 1); }, hasTees() { return (TEES_BY_COURSE[this.courseId] || []).length > 0; }, - tees() { return TEES_BY_COURSE[this.courseId] || []; } + tees() { return TEES_BY_COURSE[this.courseId] || []; }, + getPlayer(uid) { return ALL_PLAYERS.find(p => p.id === uid) || {}; }, + getTee(uid) { + const id = this.selectedTees[uid]; + return id ? (TEES_BY_COURSE[this.courseId] || []).find(t => t.id === id) : null; + }, + goToConfirm() { this.step = 3; }, + backFromConfirm() { this.step = this.hasTees() ? 2 : 1; }, + formatLabel() { + if (this.format === 'skins') return 'Skins'; + return 'Bingo Bango Bongo'; + } }">