Fixed live line and auto scrolling on courts page
This commit is contained in:
@@ -59,22 +59,24 @@ def get_court_schedule(court_id: int, db: Session = Depends(get_db)):
|
||||
.all()
|
||||
)
|
||||
|
||||
schedule = []
|
||||
for m in matches:
|
||||
schedule.append(
|
||||
return {
|
||||
"court": court.name,
|
||||
"matches": [
|
||||
{
|
||||
"id": m.id,
|
||||
"tournament_id": m.tournament_id,
|
||||
"tournament_id": m.tournament.id,
|
||||
"tournament_name": m.tournament.name,
|
||||
"time": m.start_time.strftime("%H:%M") if m.start_time else "TBD",
|
||||
"status": m.status,
|
||||
"duration": m.tournament.duration,
|
||||
"time": m.start_time.strftime("%H:%M") if m.start_time else None,
|
||||
"status": m.status.value,
|
||||
"match_number": m.match_number,
|
||||
"p1": m.p1_team.name if m.p1_team else "TBD",
|
||||
"p2": m.p2_team.name if m.p2_team else "TBD",
|
||||
"p1_sets": sum(1 for s in m.sets if s["p1"] > s["p2"]) if m.sets else 0,
|
||||
"p2_sets": sum(1 for s in m.sets if s["p2"] > s["p1"]) if m.sets else 0,
|
||||
"p1_sets": len([s for s in m.sets if s.get("p1", 0) > s.get("p2", 0)]),
|
||||
"p2_sets": len([s for s in m.sets if s.get("p2", 0) > s.get("p1", 0)]),
|
||||
"ref_name": m.ref_team.name if m.ref_team else m.ref_label,
|
||||
}
|
||||
)
|
||||
|
||||
return {"court": court.name, "matches": schedule}
|
||||
for m in matches
|
||||
if m.start_time
|
||||
],
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user