Move outcome calibration to profile
This commit is contained in:
@@ -6,11 +6,6 @@ var main: Control
|
||||
var score_label: Label
|
||||
var summary_label: Label
|
||||
var category_list: VBoxContainer
|
||||
var outcome_score: SpinBox
|
||||
var outcome_date: LineEdit
|
||||
var outcome_consent: CheckBox
|
||||
var outcome_status: Label
|
||||
var outcome_delete_button: Button
|
||||
var current_simulation := {}
|
||||
var return_screen := "selection"
|
||||
var done_button: Button
|
||||
@@ -52,47 +47,6 @@ func _ready() -> void:
|
||||
review_button.pressed.connect(func(): main.show_screen("simulation_review", {"simulation": current_simulation, "return_screen": return_screen}))
|
||||
content.add_child(review_button)
|
||||
|
||||
var outcome_heading := Label.new()
|
||||
outcome_heading.text = "Help calibrate future predictions"
|
||||
Style.set_label(outcome_heading, 22, Style.TEXT)
|
||||
content.add_child(outcome_heading)
|
||||
var outcome_note := Label.new()
|
||||
outcome_note.text = "After receiving your official result, you may voluntarily submit it. You can edit or delete it at any time; calibration uses de-identified aggregates."
|
||||
outcome_note.autowrap_mode = TextServer.AUTOWRAP_WORD_SMART
|
||||
Style.set_label(outcome_note, 15, Style.MUTED)
|
||||
content.add_child(outcome_note)
|
||||
var outcome_row := HBoxContainer.new()
|
||||
outcome_row.add_theme_constant_override("separation", 10)
|
||||
content.add_child(outcome_row)
|
||||
outcome_score = SpinBox.new()
|
||||
outcome_score.min_value = 1
|
||||
outcome_score.max_value = 300
|
||||
outcome_score.value = 200
|
||||
outcome_score.custom_minimum_size = Vector2(120, 44)
|
||||
outcome_row.add_child(outcome_score)
|
||||
outcome_date = LineEdit.new()
|
||||
outcome_date.placeholder_text = "Exam date: YYYY-MM-DD"
|
||||
outcome_date.custom_minimum_size = Vector2(220, 44)
|
||||
outcome_row.add_child(outcome_date)
|
||||
outcome_consent = CheckBox.new()
|
||||
outcome_consent.text = "I consent to calibration use"
|
||||
outcome_row.add_child(outcome_consent)
|
||||
var save_outcome := Button.new()
|
||||
save_outcome.text = "Save outcome"
|
||||
Style.style_chip(save_outcome, Style.CYAN)
|
||||
save_outcome.pressed.connect(_save_outcome)
|
||||
outcome_row.add_child(save_outcome)
|
||||
outcome_delete_button = Button.new()
|
||||
outcome_delete_button.text = "Delete outcome"
|
||||
Style.style_chip(outcome_delete_button, Style.RED)
|
||||
outcome_delete_button.pressed.connect(ExamSimulationService.delete_outcome)
|
||||
outcome_row.add_child(outcome_delete_button)
|
||||
outcome_status = Label.new()
|
||||
Style.set_label(outcome_status, 15, Style.MUTED)
|
||||
content.add_child(outcome_status)
|
||||
if not ExamSimulationService.outcome_changed.is_connected(_refresh_outcome):
|
||||
ExamSimulationService.outcome_changed.connect(_refresh_outcome)
|
||||
|
||||
done_button = Button.new()
|
||||
done_button.text = "Return to study modes"
|
||||
done_button.custom_minimum_size = Vector2(240, 50)
|
||||
@@ -123,7 +77,6 @@ func on_show(payload: Variant = null) -> void:
|
||||
label.text = "%s: %d/%d" % [category, int(value.get("correct", 0)), int(value.get("total", 0))]
|
||||
Style.set_label(label, 16, Style.TEXT)
|
||||
category_list.add_child(label)
|
||||
ExamSimulationService.load_outcome()
|
||||
|
||||
|
||||
func _return_from_results() -> void:
|
||||
@@ -136,26 +89,3 @@ func _return_from_results() -> void:
|
||||
func _clear(container: Control) -> void:
|
||||
for child in container.get_children():
|
||||
child.queue_free()
|
||||
|
||||
|
||||
func _save_outcome() -> void:
|
||||
if not outcome_consent.button_pressed:
|
||||
outcome_status.text = "Consent is required before saving an outcome."
|
||||
return
|
||||
if outcome_date.text.length() != 10:
|
||||
outcome_status.text = "Enter the exam date as YYYY-MM-DD."
|
||||
return
|
||||
ExamSimulationService.save_outcome(int(outcome_score.value), outcome_date.text)
|
||||
outcome_status.text = "Saving..."
|
||||
|
||||
|
||||
func _refresh_outcome() -> void:
|
||||
if ExamSimulationService.outcome.is_empty():
|
||||
outcome_status.text = "No official outcome is stored."
|
||||
outcome_delete_button.visible = false
|
||||
return
|
||||
outcome_score.value = int(ExamSimulationService.outcome.get("officialScore", 200))
|
||||
outcome_date.text = str(ExamSimulationService.outcome.get("examDate", "")).left(10)
|
||||
outcome_consent.button_pressed = true
|
||||
outcome_delete_button.visible = true
|
||||
outcome_status.text = "Official outcome saved."
|
||||
|
||||
Reference in New Issue
Block a user