логотипы каналов, тест 2

This commit is contained in:
2026-07-02 14:47:37 +03:00
parent e32fdcb74e
commit 03a68ee8ca
9 changed files with 130 additions and 72 deletions

View File

@@ -355,7 +355,7 @@ def get_tour_schedule_by_match_id(match_id: int) -> list[dict]:
with conn.cursor() as cur:
cur.execute(
"""
SELECT m.tour
SELECT m.tour, m.season, m.source_key
FROM matches m
WHERE m.id = %s
""",
@@ -366,6 +366,8 @@ def get_tour_schedule_by_match_id(match_id: int) -> list[dict]:
return []
tour = row[0]
season = row[1]
source_key = resolve_match_source_key(match_id, row[2] if len(row) > 2 else None)
cur.execute(
"""
@@ -384,11 +386,13 @@ def get_tour_schedule_by_match_id(match_id: int) -> list[dict]:
LEFT JOIN teams ht ON ht.id = m.home_team_id
LEFT JOIN teams at ON at.id = m.away_team_id
WHERE m.tour = %s
AND (%s IS NULL OR m.season = %s)
AND COALESCE(NULLIF(m.source_key, ''), %s) = %s
ORDER BY
m.match_date NULLS LAST,
m.id
""",
(tour,),
(tour, season, season, source_key, source_key),
)
rows = cur.fetchall()