Show selection percentages on unselected distractors during review
Previously only the correct choice and any choice the student actually selected got a percentage badge once reviewing; never-selected distractors were left blank. Now every choice shows its selection percentage as soon as the question is answered, matching the earlier change that made unselected distractors render red like the rest of the review UI.
This commit is contained in:
@@ -3098,7 +3098,8 @@ func _set_choice_button_text(index: int, choice: Dictionary) -> void:
|
|||||||
choice_badges[index].text = display_label
|
choice_badges[index].text = display_label
|
||||||
_set_choice_percent_label(index, "")
|
_set_choice_percent_label(index, "")
|
||||||
_set_choice_top_label(index, "")
|
_set_choice_top_label(index, "")
|
||||||
if locked_wrong_choice_ids.has(choice_id) or _should_show_correct_choice_percentage(choice_id):
|
var reviewing := pending_correct_advance or not current_answer.is_empty()
|
||||||
|
if locked_wrong_choice_ids.has(choice_id) or reviewing:
|
||||||
var percentage := _get_choice_selection_percentage(choice_id)
|
var percentage := _get_choice_selection_percentage(choice_id)
|
||||||
if percentage >= 0:
|
if percentage >= 0:
|
||||||
_set_choice_percent_label(index, "%d%%" % percentage)
|
_set_choice_percent_label(index, "%d%%" % percentage)
|
||||||
@@ -3188,11 +3189,6 @@ func _get_choice_selection_percentage(choice_id: String) -> int:
|
|||||||
return clamp(int(percentages.get(choice_id, -1)), 0, 100)
|
return clamp(int(percentages.get(choice_id, -1)), 0, 100)
|
||||||
|
|
||||||
|
|
||||||
func _should_show_correct_choice_percentage(choice_id: String) -> bool:
|
|
||||||
var question := BlockSessionService.get_current_question()
|
|
||||||
return choice_id == str(question.get("correct_choice_id", "")) and (pending_correct_advance or not current_answer.is_empty())
|
|
||||||
|
|
||||||
|
|
||||||
func _apply_correct_answer_preview() -> void:
|
func _apply_correct_answer_preview() -> void:
|
||||||
var question := BlockSessionService.get_current_question()
|
var question := BlockSessionService.get_current_question()
|
||||||
var correct_id := str(question.get("correct_choice_id", ""))
|
var correct_id := str(question.get("correct_choice_id", ""))
|
||||||
|
|||||||
Reference in New Issue
Block a user