feat: update version and enhance exercise filtering features
Deploy Development / deploy (push) Successful in 45s
Test Suite / pytest-backend (push) Successful in 6s
Test Suite / lint-backend (push) Successful in 0s
Test Suite / build-frontend (push) Successful in 6s
Test Suite / playwright-tests (push) Failing after 29s
Deploy Development / deploy (push) Successful in 45s
Test Suite / pytest-backend (push) Successful in 6s
Test Suite / lint-backend (push) Successful in 0s
Test Suite / build-frontend (push) Successful in 6s
Test Suite / playwright-tests (push) Failing after 29s
- Bumped application version to 0.8.40 and updated module versions accordingly. - Introduced new focus area filtering options in the ExercisesListPage, allowing users to include or exclude exercises based on specified focus areas. - Added utility functions for deduplicating and merging focus area IDs to improve filtering logic. - Enhanced the ExercisePickerModal and ExercisesListPage components to support new focus rules and improve user experience with focus area selections.
This commit is contained in:
1 parent
cfd40889ac
commit
518918a6e5
7 files changed
+357
-41
No files matched your search
@@ -645,6 +645,21 @@ def _merge_ids(multi: list[int], single: Optional[int]) -> list[int]:
|
||||
return out
|
||||
|
||||
|
||||
def _dedupe_positive_ids(ids: list[int]) -> list[int]:
|
||||
seen: set[int] = set()
|
||||
out: list[int] = []
|
||||
for raw in ids or []:
|
||||
try:
|
||||
xi = int(raw)
|
||||
except (TypeError, ValueError):
|
||||
continue
|
||||
if xi < 1 or xi in seen:
|
||||
continue
|
||||
seen.add(xi)
|
||||
out.append(xi)
|
||||
return out
|
||||
|
||||
|
||||
def _merge_str_any(multi: list[str], single: Optional[str]) -> list[str]:
|
||||
seen = set()
|
||||
out = []
|
||||
@@ -954,6 +969,18 @@ def list_exercises(
|
||||
default=False,
|
||||
description="Wenn true: nur Übungen mit mindestens einem Fokusbereich",
|
||||
),
|
||||
focus_only_without_focus_areas: bool = Query(
|
||||
default=False,
|
||||
description="Nur Übungen ohne einen einzigen Fokusbereich (M:N exercise_focus_areas leer)",
|
||||
),
|
||||
focus_area_must_include_ids: list[int] = Query(
|
||||
default=[],
|
||||
description="Alle genannten Fokusbereiche müssen gesetzt sein (UND / „+“)",
|
||||
),
|
||||
focus_area_must_exclude_ids: list[int] = Query(
|
||||
default=[],
|
||||
description="Keiner dieser Fokusbereiche darf gesetzt sein („−“)",
|
||||
),
|
||||
include_archived: bool = Query(
|
||||
default=False,
|
||||
description="Archivierte einbeziehen; Standard false (außer Statusfilter enthält archived)",
|
||||
@@ -1022,18 +1049,58 @@ def list_exercises(
|
||||
where.append(f"(e.status IS NULL OR LOWER(TRIM(e.status::text)) NOT IN ({ph}))")
|
||||
params.extend(st_excl)
|
||||
|
||||
if exclude_without_focus:
|
||||
where.append(
|
||||
"EXISTS (SELECT 1 FROM exercise_focus_areas efa WHERE efa.exercise_id = e.id)"
|
||||
)
|
||||
focus_only = focus_only_without_focus_areas
|
||||
must_inc = _dedupe_positive_ids(list(focus_area_must_include_ids))
|
||||
must_exc = _dedupe_positive_ids(list(focus_area_must_exclude_ids))
|
||||
fa_or = _merge_ids(focus_area_ids, focus_area)
|
||||
|
||||
fa_ids = _merge_ids(focus_area_ids, focus_area)
|
||||
if fa_ids:
|
||||
ph = ",".join(["%s"] * len(fa_ids))
|
||||
if focus_only:
|
||||
if exclude_without_focus:
|
||||
raise HTTPException(
|
||||
status_code=400,
|
||||
detail="focus_only_without_focus_areas schließt exclude_without_focus aus.",
|
||||
)
|
||||
if fa_or:
|
||||
raise HTTPException(
|
||||
status_code=400,
|
||||
detail="focus_only_without_focus_areas darf nicht zusammen mit focus_area_ids (ODER-Liste) verwendet werden.",
|
||||
)
|
||||
if must_inc:
|
||||
raise HTTPException(
|
||||
status_code=400,
|
||||
detail="focus_only_without_focus_areas darf nicht zusammen mit focus_area_must_include_ids verwendet werden.",
|
||||
)
|
||||
if must_exc:
|
||||
raise HTTPException(
|
||||
status_code=400,
|
||||
detail="focus_only_without_focus_areas darf nicht zusammen mit focus_area_must_exclude_ids verwendet werden.",
|
||||
)
|
||||
where.append(
|
||||
f"EXISTS (SELECT 1 FROM exercise_focus_areas efa WHERE efa.exercise_id = e.id AND efa.focus_area_id IN ({ph}))"
|
||||
"NOT EXISTS (SELECT 1 FROM exercise_focus_areas efa WHERE efa.exercise_id = e.id)"
|
||||
)
|
||||
params.extend(fa_ids)
|
||||
else:
|
||||
if exclude_without_focus:
|
||||
where.append(
|
||||
"EXISTS (SELECT 1 FROM exercise_focus_areas efa WHERE efa.exercise_id = e.id)"
|
||||
)
|
||||
if fa_or:
|
||||
ph = ",".join(["%s"] * len(fa_or))
|
||||
where.append(
|
||||
f"EXISTS (SELECT 1 FROM exercise_focus_areas efa WHERE efa.exercise_id = e.id AND efa.focus_area_id IN ({ph}))"
|
||||
)
|
||||
params.extend(fa_or)
|
||||
for fid in must_inc:
|
||||
where.append(
|
||||
"EXISTS (SELECT 1 FROM exercise_focus_areas efa WHERE efa.exercise_id = e.id AND efa.focus_area_id = %s)"
|
||||
)
|
||||
params.append(fid)
|
||||
if must_exc:
|
||||
ph = ",".join(["%s"] * len(must_exc))
|
||||
where.append(
|
||||
f"NOT EXISTS (SELECT 1 FROM exercise_focus_areas efa "
|
||||
f"WHERE efa.exercise_id = e.id AND efa.focus_area_id IN ({ph}))"
|
||||
)
|
||||
params.extend(must_exc)
|
||||
|
||||
sk_ids = _merge_ids(skill_ids, skill_id)
|
||||
if sk_ids:
|
||||
|
||||
+9
-2
@@ -1,6 +1,6 @@
|
||||
# Shinkan Jinkendo Version Information
|
||||
|
||||
APP_VERSION = "0.8.39"
|
||||
APP_VERSION = "0.8.40"
|
||||
BUILD_DATE = "2026-05-06"
|
||||
DB_SCHEMA_VERSION = "20260506043"
|
||||
|
||||
@@ -15,7 +15,7 @@ MODULE_VERSIONS = {
|
||||
"groups": "0.1.0",
|
||||
"skills": "0.1.0",
|
||||
"methods": "0.1.0",
|
||||
"exercises": "2.9.0", # DELETE RBAC (Trainer/Vereinsadmin/Plattform); Nutzungs-409; Listenfilter Negativlisten + Archiv-Standard; exercise_list_prefs
|
||||
"exercises": "2.10.0", # GET /exercises: focus_area_must_include/exclude_ids, focus_only_without_focus_areas; UI +/- Fokusregeln
|
||||
"training_units": "0.2.0",
|
||||
"training_programs": "0.1.0",
|
||||
"planning": "0.8.1", # Vorlagen Leseprüfung library_content_visible_to_profile
|
||||
@@ -27,6 +27,13 @@ MODULE_VERSIONS = {
|
||||
}
|
||||
|
||||
CHANGELOG = [
|
||||
{
|
||||
"version": "0.8.40",
|
||||
"date": "2026-05-06",
|
||||
"changes": [
|
||||
"Übungen Liste: Fokusfilter mit UND-+ (must_include) und UND-− (must_exclude), nur ohne Fokusbereich (focus_only_without); Frontend Dropdown + Mit / − Ohne",
|
||||
],
|
||||
},
|
||||
{
|
||||
"version": "0.8.39",
|
||||
"date": "2026-05-06",
|
||||
|
||||
Reference in new issue
Block a user