мини защита от сброса данных в базе данных, если данных нет

This commit is contained in:
2026-05-25 12:34:29 +03:00
parent 18bac0d12d
commit 801936518a
3 changed files with 12 additions and 10 deletions

View File

@@ -165,6 +165,7 @@ def parse_schedule(html: str) -> list[dict]:
def run_parser_schedule() -> None: def run_parser_schedule() -> None:
html = fetch_html(URL_SCHEDULE) html = fetch_html(URL_SCHEDULE)
matches_data = parse_schedule(html) matches_data = parse_schedule(html)
if matches_data:
sync_matches(matches_data) sync_matches(matches_data)
print(f"[parser_schedule] Matches synced: {len(matches_data)}") print(f"[parser_schedule] Matches synced: {len(matches_data)}")

View File

@@ -68,7 +68,7 @@ def parse_standings(html: str) -> list[dict]:
def run_parser_standings() -> None: def run_parser_standings() -> None:
html = fetch_html(URL_STANDINGS) html = fetch_html(URL_STANDINGS)
standings_rows = parse_standings(html) standings_rows = parse_standings(html)
if standings_rows:
sync_standings( sync_standings(
season=SEASON, season=SEASON,
standings_rows=standings_rows, standings_rows=standings_rows,

View File

@@ -80,6 +80,7 @@ def parse_teams_html(html: str) -> dict:
def run_parser_teams() -> None: def run_parser_teams() -> None:
teams_data = get_url_teams() teams_data = get_url_teams()
if teams_data:
sync_teams(teams_data) sync_teams(teams_data)
print(f"Teams synced: {len(teams_data)}") print(f"Teams synced: {len(teams_data)}")