Track real first attempt question stats
This commit is contained in:
@@ -4,6 +4,8 @@ const Style := preload("res://scripts/ui/ui_style.gd")
|
||||
|
||||
var main: Control
|
||||
var profile_text: RichTextLabel
|
||||
var reset_qbank_button: Button
|
||||
var reset_qbank_pending := false
|
||||
|
||||
func _ready() -> void:
|
||||
set_anchors_preset(Control.PRESET_FULL_RECT)
|
||||
@@ -38,10 +40,17 @@ func _ready() -> void:
|
||||
on_show()
|
||||
)
|
||||
row.add_child(reset)
|
||||
|
||||
reset_qbank_button = Button.new()
|
||||
reset_qbank_button.text = "Reset QBank"
|
||||
Style.style_chip(reset_qbank_button, Style.AMBER)
|
||||
reset_qbank_button.pressed.connect(_on_reset_qbank_pressed)
|
||||
row.add_child(reset_qbank_button)
|
||||
add_child(row)
|
||||
|
||||
|
||||
func on_show(_payload: Variant = null) -> void:
|
||||
_reset_qbank_confirmation()
|
||||
var profile := ProfileService.get_profile()
|
||||
var xp_into := ProgressionService.xp_into_level(int(profile["xp"]))
|
||||
var text := "[b]Level %d[/b]\n%d total XP (%d/%d to next level)\nCurrent streak: %d\nBest streak: %d\nToday: %d/%d questions, +%d XP\n\n[b]Badges[/b]\n" % [
|
||||
@@ -82,3 +91,24 @@ func on_show(_payload: Variant = null) -> void:
|
||||
block.get("xp_earned", 0)
|
||||
]
|
||||
profile_text.text = text
|
||||
|
||||
|
||||
func _on_reset_qbank_pressed() -> void:
|
||||
if not reset_qbank_pending:
|
||||
reset_qbank_pending = true
|
||||
reset_qbank_button.text = "Confirm Reset QBank"
|
||||
Style.style_chip(reset_qbank_button, Style.RED)
|
||||
return
|
||||
|
||||
ProfileService.reset_qbank_memory()
|
||||
if BlockSessionService.core_status_message == "All available questions cleared.":
|
||||
BlockSessionService.core_status_message = ""
|
||||
_reset_qbank_confirmation()
|
||||
on_show()
|
||||
|
||||
|
||||
func _reset_qbank_confirmation() -> void:
|
||||
reset_qbank_pending = false
|
||||
if reset_qbank_button != null:
|
||||
reset_qbank_button.text = "Reset QBank"
|
||||
Style.style_chip(reset_qbank_button, Style.AMBER)
|
||||
|
||||
Reference in New Issue
Block a user