Add Slot Assignments and Enhance Path Handling Logic
Deploy Development / deploy (push) Successful in 44s
Test Suite / pytest-backend (push) Successful in 44s
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 1m17s

- Introduced `slot_assignments` to `ProgressionPathSuggestRequest` for improved handling of existing slot assignments in path building.
- Implemented `_slot_assignments_by_major_index` and `_path_step_from_slot_assignment` functions to facilitate the integration of slot assignments into the path generation process.
- Updated `_build_steps_roadmap_first` to utilize slot assignments, enhancing the accuracy of path steps based on existing exercise slots.
- Enhanced `detect_path_gaps` to skip empty slots, preventing unnecessary errors during gap detection.
- Added tests to validate the new slot assignment handling and ensure robustness in path generation logic.
This commit is contained in:
Lars committed 2026-06-11 12:02:04 +02:00
1 parent 480890d0c6
commit 7203c871fc
5 files changed
+128 -1

No files matched your search

@@ -41,6 +41,7 @@ import {
SLOT_MAX,
slotsAsPathStepRows,
slotsToEvaluateSteps,
slotsToSlotAssignments,
syncProgressionRoadmapFromSlots,
syncSlotPhasesFromRoadmap,
} from '../utils/progressionGraphDraft'
@@ -414,6 +415,7 @@ export default function ProgressionGraphEditor({ graphId, embedded = false, onSa
include_llm_roadmap: false,
roadmap_first: true,
roadmap_override: override,
slot_assignments: slotsToSlotAssignments(synced),
progression_graph_id: Number(graphId),
...roadmapStructuredPayload(draft.startSituation, draft.targetState, draft.roadmapNotes),
})
+20 -1
View File
@@ -712,6 +712,21 @@ export function draftSiblingEdgePairs(draft) {
return pairs
}
/** Bereits zugeordnete Bibliotheks-Übungen für Re-Match (Pins). */
export function slotsToSlotAssignments(draft) {
return (draft.slots || [])
.filter((slot) => slot.primary?.kind === 'library' && slot.primary.exerciseId != null)
.map((slot) => ({
exercise_id: slot.primary.exerciseId,
variant_id: slot.primary.variantId || null,
title: slot.primary.exerciseTitle || null,
is_ai_proposal: false,
roadmap_major_step_index: slot.majorStepIndex,
roadmap_phase: slot.phase || null,
roadmap_learning_goal: slot.learning_goal || null,
}))
}
export function slotsToEvaluateSteps(draft) {
return (draft.slots || []).map((slot) => {
const p = slot.primary
@@ -789,7 +804,11 @@ export function applyMatchStepsToSlots(draft, apiSteps) {
for (let i = 0; i < nextSlots.length; i += 1) {
if (!touchedMajors.has(i)) {
nextSlots[i].primary = emptySlotExercise()
const keep =
nextSlots[i].primary?.kind === 'library' && nextSlots[i].primary.exerciseId != null
if (!keep) {
nextSlots[i].primary = emptySlotExercise()
}
}
}