feat: enhance exercise management features and UI
Deploy Development / deploy (push) Successful in 40s
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 27s
Deploy Development / deploy (push) Successful in 40s
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 27s
- Introduced new function `club_admin_shares_club_with_creator` to check club admin permissions for shared clubs. - Updated `can_manage_club_org` to incorporate new role checks. - Enhanced exercise deletion logic to include checks for club admin roles and shared club memberships. - Added new filters for exercise visibility and status in the ExercisesListPage, allowing users to exclude specific criteria. - Implemented functionality to save user-specific exercise list preferences, improving user experience. - Updated API interactions to support new filtering options and preferences for exercise management.
This commit is contained in:
1 parent
8eec145393
commit
585ee8c90d
13 files changed
+619
-59
No files matched your search
@@ -0,0 +1,54 @@
|
||||
/** Gemeinsame Default-Filter für Übungslisten (Übersicht + Auswahlmodal). */
|
||||
export const INITIAL_EXERCISE_LIST_FILTERS = {
|
||||
focus_area_ids: [],
|
||||
style_direction_ids: [],
|
||||
training_type_ids: [],
|
||||
target_group_ids: [],
|
||||
skill_ids: [],
|
||||
skill_min_level: '',
|
||||
skill_max_level: '',
|
||||
visibility_any: [],
|
||||
status_any: [],
|
||||
visibility_exclude_any: [],
|
||||
status_exclude_any: [],
|
||||
exclude_without_focus: false,
|
||||
include_archived: false,
|
||||
}
|
||||
|
||||
const PREFS_KEYS = Object.keys(INITIAL_EXERCISE_LIST_FILTERS)
|
||||
|
||||
/**
|
||||
* Ruft aus dem Profilfeld exercise_list_prefs einen gültigen Filter-State ab.
|
||||
*/
|
||||
export function mergeExerciseListPrefsFromApi(raw) {
|
||||
const out = { ...INITIAL_EXERCISE_LIST_FILTERS }
|
||||
if (!raw || typeof raw !== 'object') return out
|
||||
for (const k of PREFS_KEYS) {
|
||||
if (raw[k] === undefined) continue
|
||||
if (k.endsWith('_ids') || k.endsWith('_any')) {
|
||||
if (Array.isArray(raw[k])) out[k] = raw[k].map(String)
|
||||
continue
|
||||
}
|
||||
if (k === 'exclude_without_focus' || k === 'include_archived') {
|
||||
out[k] = !!raw[k]
|
||||
continue
|
||||
}
|
||||
if (k === 'skill_min_level' || k === 'skill_max_level') {
|
||||
out[k] = raw[k] === '' || raw[k] == null ? '' : String(raw[k])
|
||||
}
|
||||
}
|
||||
return out
|
||||
}
|
||||
|
||||
/** Nur von den Defaults abweichende Werte — kompaktes Profil-JSON. */
|
||||
export function compactExerciseListPrefsPayload(filters) {
|
||||
const full = { ...INITIAL_EXERCISE_LIST_FILTERS, ...filters }
|
||||
const o = {}
|
||||
for (const k of PREFS_KEYS) {
|
||||
const v = full[k]
|
||||
const ini = INITIAL_EXERCISE_LIST_FILTERS[k]
|
||||
if (JSON.stringify(v) === JSON.stringify(ini)) continue
|
||||
o[k] = v
|
||||
}
|
||||
return o
|
||||
}
|
||||
Reference in new issue
Block a user