Add variable question distractor pools

This commit is contained in:
hz
2026-07-13 10:15:05 -05:00
parent f2c59388eb
commit 93154d5925
24 changed files with 1040 additions and 247 deletions
+20 -3
View File
@@ -442,8 +442,7 @@ func _load_question() -> void:
lead_label.text = question.get("lead_in", "")
_refresh_labs_button()
presented_choices = question.get("choices", []).duplicate(true)
presented_choices.shuffle()
presented_choices = question.get("presented_choices", question.get("choices", [])).duplicate(true)
var choices := presented_choices
for index in range(choice_buttons.size()):
var button := choice_buttons[index]
@@ -613,7 +612,11 @@ func _submit_or_next() -> void:
_collapse_resolved_followups()
var attempted_choice := selected_choice
var attempted_question_id := str(BlockSessionService.get_current_question().get("id", ""))
QuestionBankService.record_first_attempt(attempted_question_id, attempted_choice)
QuestionBankService.record_first_attempt(
attempted_question_id,
attempted_choice,
_presented_choice_ids()
)
var result := BlockSessionService.submit_core_attempt(selected_choice, eliminated, flagged)
if result.is_empty():
return
@@ -632,6 +635,12 @@ func _submit_or_next() -> void:
_trigger_wrong_feedback()
_apply_saved_choice_state()
return
var attempted_question_id := str(BlockSessionService.get_current_question().get("id", ""))
QuestionBankService.record_first_attempt(
attempted_question_id,
selected_choice,
_presented_choice_ids()
)
current_answer = BlockSessionService.answer_current(selected_choice, eliminated, flagged)
if BlockSessionService.mode == "Tutor":
_show_explanation()
@@ -1871,6 +1880,14 @@ func _get_presented_choices() -> Array:
return BlockSessionService.get_current_question().get("choices", [])
func _presented_choice_ids() -> Array:
var ids: Array = []
for choice in _get_presented_choices():
if typeof(choice) == TYPE_DICTIONARY:
ids.append(str(choice.get("id", "")))
return ids
func _display_label_for_index(index: int) -> String:
return String.chr(65 + index)