BUILD138 — исправление 500 в справочнике стадионов

This commit is contained in:
2026-09-15 14:28:05 +03:00
parent eef824ed4e
commit dc4c7e53f7
2 changed files with 8 additions and 1 deletions

2
app.py
View File

@@ -29,7 +29,7 @@ from ui_builder import install_ui_builder
from khl_site.khl_data_center import APP as khl_site_app
BASE_DIR = Path(__file__).resolve().parent
BUILD_VERSION = "2026.09.15.5"
BUILD_VERSION = "2026.09.15.6"
# compatibility: BUILD_VERSION = "2026.08.26.1"
# compatibility: BUILD_VERSION = "2026.08.25.1"
# compatibility: BUILD_VERSION = "2026.08.24.15"

View File

@@ -867,6 +867,13 @@ class HockeyDataService:
if row is None:
row = Stadium(external_id=identity, source=str(source or "stat2tv")[:32], active=True)
session.add(row)
# BUILD138: HockeyDatabase intentionally uses autoflush=False.
# Flush a newly created stadium immediately so another game in the
# same sync transaction can find the same external_id instead of
# creating a duplicate pending row and failing the UNIQUE constraint
# on commit. Stadium has no FK dependencies, so a targeted flush is
# safe and avoids flushing unrelated match-sync changes.
session.flush([row])
manual = str(row.source or "").casefold() == "manual"
for field, value in values.items():