Refactor TrainingUnitRunPage and trainingPlanUtils for improved section handling
Deploy Development / deploy (push) Successful in 38s
Test Suite / pytest-backend (push) Successful in 37s
Test Suite / lint-backend (push) Successful in 0s
Test Suite / build-frontend (push) Successful in 12s
Test Suite / k6 /health Baseline (push) Successful in 34s
Test Suite / playwright-tests (push) Successful in 1m26s

- Updated TrainingUnitRunPage to utilize new utility functions for managing sections with plan locations, enhancing data representation.
- Refactored trainingPlanUtils to introduce functions for building view models from sections and for displaying sections with plan locations, streamlining the data flow.
- Improved logic for handling phase runs and section indices, ensuring accurate representation of training units during rendering.
This commit is contained in:
Lars committed 2026-05-15 14:00:46 +02:00
1 parent 5338871f36
commit c182ced7cd
2 files changed
+87 -11

No files matched your search

+4 -4
View File
@@ -8,9 +8,9 @@ import api from '../utils/api'
import ExercisePeekModal from '../components/ExercisePeekModal'
import CombinationPlanBracket from '../components/CombinationPlanBracket'
import {
buildPlanRunViewModel,
buildPlanRunViewModelFromSections,
itemStableKey,
sortedSections,
sectionsWithPlanLocForDisplay,
sortedItems,
} from '../utils/trainingPlanUtils'
import { effectiveComboMethodProfile } from '../utils/comboPlanningMethodProfile'
@@ -115,8 +115,8 @@ export default function TrainingUnitRunPage() {
}
}, [idNum, persistChecked])
const sections = useMemo(() => sortedSections(unit), [unit])
const planModel = useMemo(() => buildPlanRunViewModel(unit), [unit])
const sections = useMemo(() => sectionsWithPlanLocForDisplay(unit), [unit])
const planModel = useMemo(() => buildPlanRunViewModelFromSections(sections), [sections])
const printStreamOptions = useMemo(() => {
const opts = []