Implement Learning Goal Candidate Retrieval and Roadmap Fallback Logic
Deploy Development / deploy (push) Successful in 43s
Test Suite / pytest-backend (push) Successful in 43s
Test Suite / lint-backend (push) Successful in 0s
Test Suite / build-frontend (push) Successful in 13s
Test Suite / k6 /health Baseline (push) Successful in 34s
Test Suite / playwright-tests (push) Successful in 1m22s

- Added `_safe_tsquery_fragment` to sanitize learning goal input for SQL queries, improving query safety.
- Introduced `_fetch_learning_goal_library_candidate_ids` to retrieve exercise IDs matching learning goals, enhancing exercise relevance in roadmap suggestions.
- Enhanced `_match_roadmap_slot` to utilize learning goal candidates, improving the accuracy of supplemental exercise selection.
- Implemented `_pick_roadmap_rank_fallback` to provide a fallback mechanism for selecting the best exercise when strict matching fails, ensuring better exercise retrieval.
- Updated tests to validate the new learning goal retrieval and fallback logic, ensuring robustness in exercise selection processes.
This commit is contained in:
Lars committed 2026-06-11 12:54:07 +02:00
1 parent b2fbf6b4af
commit 6d130a7e09
5 files changed
+227 -5

No files matched your search

+8 -1
View File
@@ -727,7 +727,7 @@ export function slotsToSlotAssignments(draft) {
}))
}
/** Alle Graph-Übungs-IDs für Retriever-Boost (Slots + Geschwister). */
/** Alle Graph-Übungs-IDs für Retriever-Boost (Slots + Geschwister + gespeichertes Artefakt). */
export function draftRetrievalBoostExerciseIds(draft) {
const ids = new Set()
for (const slot of draft.slots || []) {
@@ -737,6 +737,13 @@ export function draftRetrievalBoostExerciseIds(draft) {
if (sib.kind === 'library' && sib.exerciseId != null) ids.add(sib.exerciseId)
}
}
const saved = draft?.slot_contents || draft?.planningArtifact?.slot_contents
if (Array.isArray(saved)) {
for (const raw of saved) {
const eid = raw?.primary?.exercise_id ?? raw?.exercise_id
if (eid != null && Number.isFinite(Number(eid))) ids.add(Number(eid))
}
}
return [...ids]
}