Enhance Exercise Retrieval and Path Handling Logic
Deploy Development / deploy (push) Successful in 44s
Test Suite / pytest-backend (push) Successful in 48s
Test Suite / lint-backend (push) Successful in 0s
Test Suite / build-frontend (push) Successful in 14s
Test Suite / k6 /health Baseline (push) Successful in 33s
Test Suite / playwright-tests (push) Successful in 1m23s
Deploy Development / deploy (push) Successful in 44s
Test Suite / pytest-backend (push) Successful in 48s
Test Suite / lint-backend (push) Successful in 0s
Test Suite / build-frontend (push) Successful in 14s
Test Suite / k6 /health Baseline (push) Successful in 33s
Test Suite / playwright-tests (push) Successful in 1m23s
- Introduced new functions for handling exercise visibility and retrieval based on progression graph context, including `fetch_exercise_rows_by_ids_for_graph`. - Updated `_load_supplemental_exercise_rows` to incorporate graph visibility rules, improving the accuracy of exercise retrieval. - Enhanced `_run_path_step_retrieval` to utilize preloaded supplemental exercise rows, optimizing performance and clarity in path step processing. - Added `exercise_title_equivalent_to_stage_goal` function to improve title matching against learning goals, enhancing exercise relevance. - Updated tests to validate new retrieval logic and title equivalence functionality, ensuring robustness in exercise selection processes.
This commit is contained in:
1 parent
ad051c015f
commit
ca2adbd55e
8 files changed
+500
-81
No files matched your search
@@ -712,7 +712,22 @@ export function draftSiblingEdgePairs(draft) {
|
||||
return pairs
|
||||
}
|
||||
|
||||
/** Bereits zugeordnete Bibliotheks-Übungen — nur Retriever-Boost, kein Pinning. */
|
||||
/** Slot-Zuordnungen für Backend-Reconciliation (validiert, nicht blind gepinnt). */
|
||||
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,
|
||||
}))
|
||||
}
|
||||
|
||||
/** Alle Graph-Übungs-IDs für Retriever-Boost (Slots + Geschwister). */
|
||||
export function draftRetrievalBoostExerciseIds(draft) {
|
||||
const ids = new Set()
|
||||
for (const slot of draft.slots || []) {
|
||||
@@ -784,7 +799,12 @@ export function applyMatchStepsToSlots(draft, apiSteps) {
|
||||
const isProposal = Boolean(step.is_ai_proposal) || step.exercise_id == null
|
||||
const hasAiPayload = Boolean(step.ai_suggestion) || Boolean(step.proposal_key)
|
||||
if (isProposal && !hasAiPayload) {
|
||||
nextSlots[idx].primary = emptySlotExercise()
|
||||
const wasLibrary =
|
||||
nextSlots[idx].primary?.kind === 'library' && nextSlots[idx].primary.exerciseId != null
|
||||
const mustClear = step.slot_status === 'unfilled' || step.slot_status === 'stripped'
|
||||
if (!wasLibrary || mustClear) {
|
||||
nextSlots[idx].primary = emptySlotExercise()
|
||||
}
|
||||
} else if (isProposal) {
|
||||
nextSlots[idx].primary = proposalSlotExercise({
|
||||
title: step.title || nextSlots[idx].learning_goal,
|
||||
@@ -800,12 +820,6 @@ export function applyMatchStepsToSlots(draft, apiSteps) {
|
||||
}
|
||||
}
|
||||
|
||||
for (let i = 0; i < nextSlots.length; i += 1) {
|
||||
if (!touchedMajors.has(i)) {
|
||||
nextSlots[i].primary = emptySlotExercise()
|
||||
}
|
||||
}
|
||||
|
||||
return syncProgressionRoadmapFromSlots({ ...draft, slots: nextSlots, dirty: true })
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user