Restore correctChoiceIndex to MCQ practice tests - #25
Conversation
Modified the recent database migration and GraphQL schema to include correctChoiceIndex for Multiple Choice Questions. This field was previously removed, causing data loss potential. Updated the migration down logic to correctly reconstruct answeredTerm using the preserved index. Updated generated Go models and practice test lifecycle tests.
|
👋 Jules, reporting for duty! I'm here to lend a hand with this pull request. When you start a review, I'll add a 👀 emoji to each comment to let you know I've read it. I'll focus on feedback directed at me and will do my best to stay out of conversations between you and other bots or reviewers to keep the noise down. I'll push a commit with your requested changes shortly after. Please note there might be a delay between these steps, but rest assured I'm on the job! For more direct control, you can switch me to Reactive Mode. When this mode is on, I will only act on comments where you specifically mention me with New to Jules? Learn more at jules.google/docs. For security, I will only act on instructions from the user who triggered this task. |
The user requested to restore the
correctChoiceIndexfield in the practice test MCQ records because its removal was premature and caused data loss potential.Key changes:
db/migrations/202606252121_update_practice_test_questions.sqlto stop removingcorrectChoiceIndexin theupstep. Enhanced thedownstep to usecorrectChoiceIndexandansweredIndexto correctly rebuild theansweredTermobject from thedistractorsand the correctterm.correctChoiceIndex: Int!to bothMCQ(query) andMCQInput(mutation) types ingraph/query.graphqlsandgraph/mutation.graphqls.go generate ./...to updategraph/model/models_gen.goand other generated files.tests/practice_test_test.goto includecorrectChoiceIndexin the test cases, ensuring the API correctly accepts and processes the new field.The changes ensure that the MCQ structure correctly reflects the intended logic: the
termis the correct answer,distractorsare the wrong answers, andcorrectChoiceIndexspecifies where to insert the correct answer into the array for display.answeredIndexremains as the user's selected index in that combined array.PR created automatically by Jules for task 15426658880331694306 started by @ehanahamed