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
@@ -2,7 +2,12 @@
|
||||
import pytest
|
||||
from fastapi import HTTPException
|
||||
|
||||
from tenant_context import library_content_visibility_sql, parse_active_club_header, resolve_tenant_context
|
||||
from tenant_context import (
|
||||
library_content_visibility_for_progression_graph_sql,
|
||||
library_content_visibility_sql,
|
||||
parse_active_club_header,
|
||||
resolve_tenant_context,
|
||||
)
|
||||
|
||||
|
||||
def test_library_visibility_sql_platform_admin_restricts_club_by_membership():
|
||||
@@ -41,6 +46,37 @@ def test_library_visibility_sql_trainer_without_active_club_no_shared_club_branc
|
||||
assert params == [42]
|
||||
|
||||
|
||||
def test_progression_graph_visibility_sql_private_matches_library():
|
||||
base_sql, base_params = library_content_visibility_sql(
|
||||
alias="e", profile_id=5, role="trainer", effective_club_id=12
|
||||
)
|
||||
graph_sql, graph_params = library_content_visibility_for_progression_graph_sql(
|
||||
alias="e",
|
||||
profile_id=5,
|
||||
role="trainer",
|
||||
effective_club_id=12,
|
||||
graph_visibility="private",
|
||||
graph_club_id=None,
|
||||
)
|
||||
assert graph_sql == base_sql
|
||||
assert graph_params == base_params
|
||||
|
||||
|
||||
def test_progression_graph_visibility_sql_club_excludes_private():
|
||||
sql, params = library_content_visibility_for_progression_graph_sql(
|
||||
alias="e",
|
||||
profile_id=5,
|
||||
role="trainer",
|
||||
effective_club_id=12,
|
||||
graph_visibility="club",
|
||||
graph_club_id=12,
|
||||
)
|
||||
assert "official" in sql
|
||||
assert "visibility = 'club'" in sql
|
||||
assert "visibility = 'private'" not in sql
|
||||
assert 12 in params
|
||||
|
||||
|
||||
def test_library_visibility_sql_user_with_active_club_includes_club_branch():
|
||||
sql, params = library_content_visibility_sql(
|
||||
alias="t",
|
||||
|
||||
Reference in new issue
Block a user