Refactor and optimize: deduplicate, batch queries, fix bugs
- Remove unused DATABASE_PATH import from games.py - Extract _new_game_context(db) helper to deduplicate GET/POST error path - Extract _parse_hole_form() helper to deduplicate hole validation in create/edit course - Batch N+1 player handicap and tee queries in create_game into two IN() queries - Fix hole count import bug: use max() across all tees instead of first match - Fix migration exception handling: re-raise unless "duplicate column name" - Cache calcSkins() result in _skinsCache; invalidate on score/skip changes - Collapse two identical Next buttons into one in new_game.html - Fix stale skinDoubleBackNine checkbox: reset on mode change, use x-model Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
+3
-2
@@ -139,5 +139,6 @@ async def init_db():
|
||||
try:
|
||||
await db.execute(migration)
|
||||
await db.commit()
|
||||
except Exception:
|
||||
pass # column already exists
|
||||
except Exception as e:
|
||||
if "duplicate column name" not in str(e).lower():
|
||||
raise
|
||||
|
||||
Reference in New Issue
Block a user