chore(version): update version and changelog for release 0.8.125
Deploy Development / deploy (push) Successful in 40s
Test Suite / pytest-backend (push) Successful in 36s
Test Suite / lint-backend (push) Successful in 0s
Test Suite / build-frontend (push) Successful in 13s
Test Suite / k6 /health Baseline (push) Successful in 33s
Test Suite / playwright-tests (push) Successful in 1m12s
Deploy Development / deploy (push) Successful in 40s
Test Suite / pytest-backend (push) Successful in 36s
Test Suite / lint-backend (push) Successful in 0s
Test Suite / build-frontend (push) Successful in 13s
Test Suite / k6 /health Baseline (push) Successful in 33s
Test Suite / playwright-tests (push) Successful in 1m12s
- Bumped APP_VERSION to 0.8.125 and updated the changelog to reflect recent changes. - Added new tests for the dashboard API to ensure proper HTTP 200 responses when inner lists are mocked. - Enhanced the ExerciseListBulkToolbar component with a data-testid for improved testing capabilities. - Refactored the TrainingPlanningPage by extracting utility functions to trainingPlanningPageHelpers for better code organization.
This commit is contained in:
1 parent
1631bd2e02
commit
300d916fad
13 files changed
+635
-110
No files matched your search
@@ -17,112 +17,22 @@ import {
|
||||
hydrateExercisePlanningRow,
|
||||
insertTrainingModuleIntoPlanningSections,
|
||||
} from '../utils/trainingUnitSectionsForm'
|
||||
import {
|
||||
trainingVisibilityShortDE,
|
||||
addDaysIsoDate,
|
||||
pad2,
|
||||
toIsoLocal,
|
||||
mondayIndex,
|
||||
getCalendarGridRange,
|
||||
shiftCalendarMonth,
|
||||
enumerateIsoDays,
|
||||
WEEKDAYS_DE,
|
||||
toNumList,
|
||||
sessionAssignDefaults,
|
||||
normalizeGroupCoTrainerIds,
|
||||
filterDirectoryExcludingLead,
|
||||
} from '../utils/trainingPlanningPageHelpers'
|
||||
|
||||
/** Kurz-Anzeige Sichtbarkeit (Trainingsmodule, Übungen) */
|
||||
function trainingVisibilityShortDE(visibility) {
|
||||
const v = String(visibility || '').trim().toLowerCase()
|
||||
if (v === 'official') return 'Öffentliche Bibliothek'
|
||||
if (v === 'club') return 'Verein'
|
||||
if (v === 'private') return 'Privat'
|
||||
return visibility ? String(visibility) : ''
|
||||
}
|
||||
|
||||
function addDaysIsoDate(isoDay, daysDelta) {
|
||||
const d = new Date(`${isoDay}T12:00:00`)
|
||||
d.setDate(d.getDate() + daysDelta)
|
||||
return d.toISOString().slice(0, 10)
|
||||
}
|
||||
|
||||
function pad2(n) {
|
||||
return String(n).padStart(2, '0')
|
||||
}
|
||||
|
||||
function toIsoLocal(d) {
|
||||
return `${d.getFullYear()}-${pad2(d.getMonth() + 1)}-${pad2(d.getDate())}`
|
||||
}
|
||||
|
||||
/** Montag = erster Wochentag (ISO-Woche UI) */
|
||||
function mondayIndex(d) {
|
||||
return (d.getDay() + 6) % 7
|
||||
}
|
||||
|
||||
/** Kalendarische Monatsansicht: erster und letzter Tag des sichtbaren Rasters (Mo–So) */
|
||||
function getCalendarGridRange(ym) {
|
||||
const parts = (ym || '').split('-').map(Number)
|
||||
const y = parts[0]
|
||||
const m = parts[1]
|
||||
if (!y || !m || m < 1 || m > 12) {
|
||||
const t = new Date()
|
||||
return { gridStart: toIsoLocal(t), gridEnd: toIsoLocal(t) }
|
||||
}
|
||||
const first = new Date(y, m - 1, 1)
|
||||
const last = new Date(y, m, 0)
|
||||
const gridStart = new Date(first)
|
||||
gridStart.setDate(first.getDate() - mondayIndex(first))
|
||||
const lastMon = mondayIndex(last)
|
||||
const gridEnd = new Date(last)
|
||||
gridEnd.setDate(last.getDate() + (6 - lastMon))
|
||||
return { gridStart: toIsoLocal(gridStart), gridEnd: toIsoLocal(gridEnd) }
|
||||
}
|
||||
|
||||
function shiftCalendarMonth(ym, delta) {
|
||||
const parts = (ym || '').split('-').map(Number)
|
||||
const y = parts[0] || new Date().getFullYear()
|
||||
const m = parts[1] || 1
|
||||
const d = new Date(y, m - 1 + delta, 1)
|
||||
return `${d.getFullYear()}-${pad2(d.getMonth() + 1)}`
|
||||
}
|
||||
|
||||
function enumerateIsoDays(fromIso, toIso) {
|
||||
const out = []
|
||||
const cur = new Date(`${fromIso}T12:00:00`)
|
||||
const end = new Date(`${toIso}T12:00:00`)
|
||||
while (cur <= end) {
|
||||
out.push(toIsoLocal(cur))
|
||||
cur.setDate(cur.getDate() + 1)
|
||||
}
|
||||
return out
|
||||
}
|
||||
|
||||
const WEEKDAYS_DE = ['Mo', 'Di', 'Mi', 'Do', 'Fr', 'Sa', 'So']
|
||||
|
||||
function toNumList(arr) {
|
||||
if (!Array.isArray(arr)) return []
|
||||
const out = []
|
||||
for (const x of arr) {
|
||||
const n = Number(x)
|
||||
if (Number.isFinite(n) && n >= 1) out.push(n)
|
||||
}
|
||||
return out
|
||||
}
|
||||
|
||||
const sessionAssignDefaults = () => ({
|
||||
lead_trainer_profile_id: '',
|
||||
session_assistants_inherit: true,
|
||||
session_assistant_profile_ids: [],
|
||||
})
|
||||
|
||||
/** Co_trainer_ids aus TrainingGroups (Liste/JSON) → Zahlenliste */
|
||||
function normalizeGroupCoTrainerIds(raw) {
|
||||
if (raw == null) return []
|
||||
const arr = Array.isArray(raw) ? raw : []
|
||||
const out = []
|
||||
for (const x of arr) {
|
||||
const n = Number(x)
|
||||
if (Number.isFinite(n) && n >= 1) out.push(n)
|
||||
}
|
||||
return out
|
||||
}
|
||||
|
||||
/** Mitgliederverzeichnis-Einträge ohne effektiven Leitungsträger als Co‑Option */
|
||||
function filterDirectoryExcludingLead(directory, excludeLeadPid) {
|
||||
const ex =
|
||||
excludeLeadPid != null && excludeLeadPid !== '' && Number.isFinite(Number(excludeLeadPid))
|
||||
? Number(excludeLeadPid)
|
||||
: null
|
||||
if (ex == null) return directory
|
||||
return directory.filter((m) => Number(m.id) !== ex)
|
||||
}
|
||||
function TrainingPlanningPage() {
|
||||
const { user } = useAuth()
|
||||
const toast = useToast()
|
||||
|
||||
Reference in new issue
Block a user