Enhance Roadmap Slot Matching and Gap Offer Logic
Deploy Development / deploy (push) Successful in 45s
Test Suite / pytest-backend (push) Successful in 45s
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 1m22s

- Introduced `_roadmap_step_passes_post_match_gate` to validate steps after matching, ensuring only relevant steps proceed.
- Enhanced `_enrich_roadmap_unfilled_gap_offers` to generate AI gap offers for unfilled roadmap slots, improving exercise suggestions.
- Updated `suggest_progression_path` to incorporate new gap offer logic and streamline the handling of roadmap steps.
- Refined frontend logic in `applyMatchStepsToSlots` to better manage step assignments and improve clarity in slot handling.
- Bumped version to 0.8.231 to reflect the new features and improvements.
This commit is contained in:
Lars committed 2026-06-12 08:05:56 +02:00
1 parent d448c3191f
commit 63c99b0ec5
5 files changed
+245 -93

No files matched your search

+37 -25
View File
@@ -856,21 +856,16 @@ export function slotsToEvaluateSteps(draft) {
export function applyMatchStepsToSlots(draft, apiSteps) {
const steps = Array.isArray(apiSteps) ? apiSteps : []
const nextSlots = (draft.slots || []).map((slot) => ({
...slot,
primary: { ...slot.primary },
siblings: [...(slot.siblings || [])],
}))
const touchedMajors = new Set()
const stepByMajor = new Map()
for (const step of steps) {
if (step.roadmap_major_step_index == null || !Number.isFinite(Number(step.roadmap_major_step_index))) {
continue
}
const idx = Number(step.roadmap_major_step_index)
if (idx < 0 || idx >= nextSlots.length) continue
touchedMajors.add(idx)
stepByMajor.set(Number(step.roadmap_major_step_index), step)
}
const mapStepToPrimary = (step, slot) => {
const midx = Number(slot.majorStepIndex)
const isProposal = Boolean(step.is_ai_proposal) || step.exercise_id == null
const hasAiPayload = Boolean(step.ai_suggestion) || Boolean(step.proposal_key)
const isUnfilledSlot =
@@ -880,33 +875,50 @@ export function applyMatchStepsToSlots(draft, apiSteps) {
Boolean(step.gap_offer)
if (isProposal && !hasAiPayload && isUnfilledSlot) {
const offer = step.gap_offer || {}
nextSlots[idx].primary = proposalSlotExercise({
return proposalSlotExercise({
title:
offer.title_hint ||
step.roadmap_learning_goal ||
step.title ||
nextSlots[idx].learning_goal ||
`Slot ${idx + 1}`,
proposalKey: offer.offer_id || step.proposal_key || `roadmap-unfilled-${idx}`,
slot.learning_goal ||
`Slot ${midx + 1}`,
proposalKey: offer.offer_id || step.proposal_key || `roadmap-unfilled-${midx}`,
aiSuggestion: offer.ai_suggestion || null,
})
} else if (isProposal && !hasAiPayload) {
nextSlots[idx].primary = emptySlotExercise()
} else if (isProposal) {
nextSlots[idx].primary = proposalSlotExercise({
title: step.title || nextSlots[idx].learning_goal,
}
if (isProposal && !hasAiPayload) {
return emptySlotExercise()
}
if (isProposal) {
return proposalSlotExercise({
title: step.title || slot.learning_goal,
proposalKey: step.proposal_key,
aiSuggestion: step.ai_suggestion,
})
} else {
nextSlots[idx].primary = librarySlotExercise({
exerciseId: step.exercise_id,
exerciseTitle: step.title || `Übung #${step.exercise_id}`,
variantId: step.variant_id,
})
}
return librarySlotExercise({
exerciseId: step.exercise_id,
exerciseTitle: step.title || `Übung #${step.exercise_id}`,
variantId: step.variant_id,
})
}
const nextSlots = (draft.slots || []).map((slot) => {
const base = {
...slot,
primary: { ...slot.primary },
siblings: [...(slot.siblings || [])],
}
const step = stepByMajor.get(Number(slot.majorStepIndex))
if (!step) {
return base
}
return {
...base,
primary: mapStepToPrimary(step, slot),
}
})
return syncProgressionRoadmapFromSlots({ ...draft, slots: nextSlots, dirty: true })
}