fix: screen uses court_number, seed resets sequences

This commit is contained in:
Forge
2026-03-19 01:22:12 +08:00
parent 1be2ba729e
commit 7a4c573d1c
2 changed files with 13 additions and 2 deletions

View File

@@ -15,8 +15,11 @@ router = APIRouter(prefix="/screen", tags=["screen"])
@router.get("/court/{court_id}")
def get_court_display(court_id: int, db: Session = Depends(get_db)):
"""Full court display data for TV screen"""
court = db.query(Court).filter(Court.id == court_id).first()
"""Full court display data for TV screen (court_id = court_number)"""
# Try by court_number first (friendlier URLs), then by id
court = db.query(Court).filter(Court.court_number == court_id).first()
if not court:
court = db.query(Court).filter(Court.id == court_id).first()
if not court:
return {"error": "Court not found"}