feat: increment version to 0.8.51 and update media assets handling
All checks were successful
Deploy Development / deploy (push) Successful in 36s
Test Suite / pytest-backend (push) Successful in 24s
Test Suite / lint-backend (push) Successful in 0s
Test Suite / build-frontend (push) Successful in 7s
Test Suite / playwright-tests (push) Successful in 35s

- Updated APP_VERSION to 0.8.51 and MODULE_VERSIONS for media_assets to 1.5.1.
- Added a new function to check for the presence of the 'training_unit_exercises' table, enhancing conditional handling in media asset queries.
- Updated changelog to reflect the latest changes, including improved handling of media links based on the existence of the training unit exercises table.
This commit is contained in:
Lars 2026-05-07 16:24:05 +02:00
parent 084ac38c2e
commit a8667f4757
2 changed files with 29 additions and 3 deletions

View File

@ -103,6 +103,7 @@ _MAX_TAGS = 40
_MAX_TAG_LEN = 48
_MEDIA_ASSETS_TAGS_COLUMN: Optional[bool] = None
_TRAINING_UNIT_EXERCISES_TABLE: Optional[bool] = None
def _media_assets_tags_column_present(cur: Any) -> bool:
@ -124,6 +125,24 @@ def _media_assets_tags_column_present(cur: Any) -> bool:
return _MEDIA_ASSETS_TAGS_COLUMN
def _training_unit_exercises_table_present(cur: Any) -> bool:
"""True wenn planning-Migration (training_unit_exercises) im Schema liegt — sonst keine Einheiten-Links."""
global _TRAINING_UNIT_EXERCISES_TABLE
if _TRAINING_UNIT_EXERCISES_TABLE is not None:
return _TRAINING_UNIT_EXERCISES_TABLE
cur.execute(
"""
SELECT 1
FROM information_schema.tables
WHERE table_schema = 'public'
AND table_name = 'training_unit_exercises'
LIMIT 1
"""
)
_TRAINING_UNIT_EXERCISES_TABLE = cur.fetchone() is not None
return _TRAINING_UNIT_EXERCISES_TABLE
def _normalize_media_tags(raw: Union[list[str], None]) -> list[str]:
"""PostgreSQL text[]; Einträge gekürzt und ohne Dubletten (case-insensitive)."""
if raw is None:
@ -173,7 +192,7 @@ def _usage_for_media_assets(cur: Any, asset_ids: list[int]) -> dict[int, dict[st
title = (d.get("exercise_title") or "").strip() or f"Übung #{eid}"
ex_by_asset[aid].append({"id": eid, "title": title})
exercise_to_units: dict[int, list[dict]] = {}
if exercise_ids:
if exercise_ids and _training_unit_exercises_table_present(cur):
cur.execute(
"""SELECT tue.exercise_id, tu.id AS unit_id, tu.planned_date,
COALESCE(tg.name, '') AS group_name

View File

@ -1,6 +1,6 @@
# Shinkan Jinkendo Version Information
APP_VERSION = "0.8.50"
APP_VERSION = "0.8.51"
BUILD_DATE = "2026-05-07"
DB_SCHEMA_VERSION = "20260507046"
@ -13,7 +13,7 @@ MODULE_VERSIONS = {
"club_join_requests": "1.0.1", # Depends(get_tenant_context)
"admin_users": "1.0.0", # GET /api/admin/users
"platform_media_storage": "1.0.0", # GET/PUT /api/admin/platform-media-storage (Superadmin-Pfad unter MEDIA_ROOT)
"media_assets": "1.5.0", # tags TEXT[] + erweiterte Suche/Filter; usage Übungen+Einheiten; PATCH/Bulk tags; API media_kind club uploader
"media_assets": "1.5.1", # usage: training_unit_exercises optional (Schema ohne planning-Tabelle)
"groups": "0.1.0",
"skills": "0.1.0",
"methods": "0.1.0",
@ -29,6 +29,13 @@ MODULE_VERSIONS = {
}
CHANGELOG = [
{
"version": "0.8.51",
"date": "2026-05-07",
"changes": [
"Medienbibliothek GET: Verknüpfung zu Trainingseinheiten nur wenn Tabelle training_unit_exercises existiert (ältere/kaputte Schemas → keine 500, Einheiten-Liste leer)",
],
},
{
"version": "0.8.50",
"date": "2026-05-07",