Simplify wrong answer percentage display
This commit is contained in:
@@ -601,10 +601,10 @@ func _set_choice_button_text(index: int, choice: Dictionary) -> void:
|
||||
var choice_id := str(choice.get("id", ""))
|
||||
var choice_text := str(choice.get("text", ""))
|
||||
if locked_wrong_choice_ids.has(choice_id):
|
||||
var text := "%s. [wrong] %s" % [choice_id, _strike_text(choice_text)]
|
||||
var text := "%s. %s" % [choice_id, _strike_text(choice_text)]
|
||||
var percentage := _get_choice_selection_percentage(choice_id)
|
||||
if percentage >= 0:
|
||||
text += "\n %d%% chose this on first attempt" % percentage
|
||||
text += "\n %d%%" % percentage
|
||||
choice_buttons[index].text = text
|
||||
elif eliminated.has(choice_id):
|
||||
choice_buttons[index].text = "%s. [eliminated] %s" % [choice_id, _strike_text(choice_text)]
|
||||
@@ -615,8 +615,10 @@ func _set_choice_button_text(index: int, choice: Dictionary) -> void:
|
||||
func _get_choice_selection_percentage(choice_id: String) -> int:
|
||||
var question := BlockSessionService.get_current_question()
|
||||
var percentages: Dictionary = question.get("choice_selection_percentages", {})
|
||||
if not percentages.has(choice_id):
|
||||
if percentages.is_empty():
|
||||
return -1
|
||||
if not percentages.has(choice_id):
|
||||
return 0
|
||||
return clamp(int(percentages.get(choice_id, -1)), 0, 100)
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user