Track real first attempt question stats

This commit is contained in:
hz
2026-07-11 01:42:18 -05:00
parent e991dccbb2
commit 8a86734a0b
13 changed files with 297 additions and 6 deletions
+15 -1
View File
@@ -39,6 +39,8 @@ var shake_origin := Vector2.ZERO
func _ready() -> void:
set_anchors_preset(Control.PRESET_FULL_RECT)
add_theme_constant_override("separation", 10)
if not QuestionBankService.choice_percentages_updated.is_connected(_on_choice_percentages_updated):
QuestionBankService.choice_percentages_updated.connect(_on_choice_percentages_updated)
var top := HBoxContainer.new()
top.add_theme_constant_override("separation", 12)
@@ -322,6 +324,9 @@ func _submit_or_next() -> void:
if selected_choice == "":
return
if BlockSessionService.session_kind == "core":
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)
var result := BlockSessionService.submit_core_attempt(selected_choice, eliminated, flagged)
if result.is_empty():
return
@@ -330,7 +335,7 @@ func _submit_or_next() -> void:
current_answer = answer
_trigger_correct_feedback()
return
_lock_wrong_choice(selected_choice)
_lock_wrong_choice(attempted_choice)
selected_choice = ""
current_answer = {}
next_button.text = "Submit"
@@ -615,6 +620,15 @@ func _get_choice_selection_percentage(choice_id: String) -> int:
return clamp(int(percentages.get(choice_id, -1)), 0, 100)
func _on_choice_percentages_updated(question_id: String, percentages: Dictionary) -> void:
if not visible:
return
if str(BlockSessionService.get_current_question().get("id", "")) != question_id:
return
BlockSessionService.update_question_choice_percentages(question_id, percentages)
_apply_saved_choice_state()
func _strike_text(value: String) -> String:
var result := ""
for character in value: