Skip to content

Fix CodeTailor question lookup failing in cloned courses - #1450

Open
aspadiyath wants to merge 1 commit into
RunestoneInteractive:mainfrom
aspadiyath:fix-codetailor-cloned-course-question-lookup
Open

Fix CodeTailor question lookup failing in cloned courses#1450
aspadiyath wants to merge 1 commit into
RunestoneInteractive:mainfrom
aspadiyath:fix-codetailor-cloned-course-question-lookup

Conversation

@aspadiyath

Copy link
Copy Markdown
Contributor

parsons_scaffolding resolved the activecode's question row with fetch_question(problem_id, basecourse=course.base_course). A cloned course keeps the original book's base_course on its question rows, and selectquestion can pull an exercise from another book, so that base-course-scoped lookup returns nothing and the endpoint 400s with "question '' not found" -- the student's "get help" button is dead.

Fall back to a global name match (fetch_question(problem_id) with no basecourse) when the scoped lookup misses, the same resolution get_question_source and /htmlsrc already use. The scoped lookup still runs first so the single-book case is unchanged, and a warning is logged when the fallback fires so a genuine duplicate div_id across books stays diagnosable.

parsons_scaffolding resolved the activecode's question row with
fetch_question(problem_id, basecourse=course.base_course). A cloned
course keeps the original book's base_course on its question rows, and
selectquestion can pull an exercise from another book, so that
base-course-scoped lookup returns nothing and the endpoint 400s with
"question '<id>' not found" -- the student's "get help" button is dead.

Fall back to a global name match (fetch_question(problem_id) with no
basecourse) when the scoped lookup misses, the same resolution
get_question_source and /htmlsrc already use. The scoped lookup still
runs first so the single-book case is unchanged, and a warning is logged
when the fallback fires so a genuine duplicate div_id across books stays
diagnosable. The validated test case still comes from the resolved DB
row -- no client-supplied code path.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
@aspadiyath
aspadiyath requested a review from bnmnetp as a code owner August 29, 2026 21:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant