Enhance Exercise Progression Graph Functionality and Visibility Logic
Deploy Development / deploy (push) Successful in 50s
Test Suite / pytest-backend (push) Successful in 44s
Test Suite / lint-backend (push) Successful in 0s
Test Suite / build-frontend (push) Successful in 14s
Test Suite / k6 /health Baseline (push) Successful in 33s
Test Suite / playwright-tests (push) Successful in 1m16s
Deploy Development / deploy (push) Successful in 50s
Test Suite / pytest-backend (push) Successful in 44s
Test Suite / lint-backend (push) Successful in 0s
Test Suite / build-frontend (push) Successful in 14s
Test Suite / k6 /health Baseline (push) Successful in 33s
Test Suite / playwright-tests (push) Successful in 1m16s
- Introduced new functions for handling exercise visibility in progression graphs, including `library_content_visibility_for_progression_graph_sql` to manage visibility based on graph context. - Added `_supplemental_exercise_ids_from_body` to extract exercise IDs from request bodies, improving data handling in path suggestions. - Implemented visibility promotion candidate retrieval in the API, allowing for the identification of private exercises that need visibility adjustments when promoting graph visibility. - Enhanced existing SQL queries and retrieval functions to incorporate new visibility logic, ensuring accurate exercise visibility based on user roles and graph settings. - Updated frontend components to support visibility promotion workflows, including user prompts for managing private exercises during graph visibility changes. - Added tests to validate new visibility logic and ensure robustness in exercise retrieval and promotion processes.
This commit is contained in:
1 parent
7203c871fc
commit
b464047c3a
7 files changed
+447
-11
No files matched your search
@@ -108,6 +108,57 @@ def library_content_visibility_sql(
|
||||
return "(" + " OR ".join(parts) + ")", params
|
||||
|
||||
|
||||
def library_content_visibility_for_progression_graph_sql(
|
||||
*,
|
||||
alias: str,
|
||||
profile_id: int,
|
||||
role: str,
|
||||
effective_club_id: Optional[int],
|
||||
graph_visibility: str,
|
||||
graph_club_id: Optional[int] = None,
|
||||
) -> tuple[str, List[Any]]:
|
||||
"""
|
||||
Übungs-Sichtbarkeit für Progressionsgraph-Match/Planung.
|
||||
|
||||
- private Graph: private (eigene) + Verein + offiziell — volle Nutzer-Bibliothek
|
||||
- club Graph: nur Verein (aktiver Graph-Verein) + offiziell
|
||||
- official Graph: nur offiziell
|
||||
"""
|
||||
gvis = (graph_visibility or "private").strip().lower()
|
||||
if gvis == "private":
|
||||
return library_content_visibility_sql(
|
||||
alias=alias,
|
||||
profile_id=profile_id,
|
||||
role=role,
|
||||
effective_club_id=effective_club_id,
|
||||
)
|
||||
if gvis == "club":
|
||||
parts: List[str] = [f"{alias}.visibility = 'official'"]
|
||||
params: List[Any] = []
|
||||
club_id = graph_club_id if graph_club_id is not None else effective_club_id
|
||||
if club_id is not None:
|
||||
plat = is_platform_admin(role)
|
||||
if plat:
|
||||
parts.append(f"({alias}.visibility = 'club' AND {alias}.club_id = %s)")
|
||||
params.append(int(club_id))
|
||||
else:
|
||||
parts.append(
|
||||
f"""(
|
||||
{alias}.visibility = 'club'
|
||||
AND {alias}.club_id = %s
|
||||
AND EXISTS (
|
||||
SELECT 1 FROM club_members cm
|
||||
WHERE cm.profile_id = %s
|
||||
AND cm.club_id = {alias}.club_id
|
||||
AND cm.status = 'active'
|
||||
)
|
||||
)"""
|
||||
)
|
||||
params.extend([int(club_id), profile_id])
|
||||
return "(" + " OR ".join(parts) + ")", params
|
||||
return f"({alias}.visibility = 'official')", []
|
||||
|
||||
|
||||
def club_library_visibility_sql(
|
||||
*,
|
||||
alias: str,
|
||||
|
||||
Reference in new issue
Block a user