Lock submitted simulation answers
This commit is contained in:
@@ -256,18 +256,26 @@ func restore_simulation_responses(saved_responses: Array) -> void:
|
||||
"is_correct": false,
|
||||
"eliminated_choice_ids": response.get("eliminatedChoiceIds", []).duplicate(),
|
||||
"flagged": bool(response.get("flagged", false)),
|
||||
"elapsed_seconds": int(response.get("elapsedSeconds", 0))
|
||||
"elapsed_seconds": int(response.get("elapsedSeconds", 0)),
|
||||
"is_submitted": _simulation_response_is_submitted(response)
|
||||
}
|
||||
break
|
||||
|
||||
|
||||
func _simulation_response_is_submitted(response: Dictionary) -> bool:
|
||||
var submitted: Variant = response.get("isSubmitted", null)
|
||||
if submitted == null:
|
||||
return not str(response.get("choiceId", "")).is_empty()
|
||||
return bool(submitted)
|
||||
|
||||
|
||||
func get_current_question() -> Dictionary:
|
||||
if active_questions.is_empty() or current_index < 0 or current_index >= active_questions.size():
|
||||
return {}
|
||||
return active_questions[current_index]
|
||||
|
||||
|
||||
func answer_current(choice_id: String, eliminated: Array, flagged: bool) -> Dictionary:
|
||||
func answer_current(choice_id: String, eliminated: Array, flagged: bool, is_submitted := false) -> Dictionary:
|
||||
var question := get_current_question()
|
||||
if question.is_empty():
|
||||
return {}
|
||||
@@ -284,6 +292,7 @@ func answer_current(choice_id: String, eliminated: Array, flagged: bool) -> Dict
|
||||
answers[current_index] = answer
|
||||
if session_kind == "simulation":
|
||||
answer["is_correct"] = false
|
||||
answer["is_submitted"] = is_submitted
|
||||
answers[current_index] = answer
|
||||
session_changed.emit()
|
||||
return answer
|
||||
|
||||
Reference in New Issue
Block a user