Add synced question bookmarks
This commit is contained in:
@@ -77,6 +77,36 @@ func start_core_run() -> bool:
|
||||
return true
|
||||
|
||||
|
||||
func start_bookmark_question(question: Dictionary) -> bool:
|
||||
if question.is_empty():
|
||||
return false
|
||||
system_name = str(question.get("system", "All Systems"))
|
||||
mode = "Tutor"
|
||||
session_kind = "bookmark"
|
||||
active_questions = [_prepare_question_choices(question)]
|
||||
answers = [null]
|
||||
current_index = 0
|
||||
seconds_remaining = 0.0
|
||||
session_initial_seconds = 90.0
|
||||
current_question_started_at = Time.get_ticks_msec() / 1000.0
|
||||
current_question_pause_started_at = 0.0
|
||||
block_started = true
|
||||
session_changed.emit()
|
||||
return true
|
||||
|
||||
|
||||
func replace_bookmark_question(question: Dictionary) -> bool:
|
||||
if session_kind != "bookmark" or question.is_empty():
|
||||
return false
|
||||
active_questions = [_prepare_question_choices(question)]
|
||||
answers = [null]
|
||||
current_index = 0
|
||||
current_question_started_at = Time.get_ticks_msec() / 1000.0
|
||||
current_question_pause_started_at = 0.0
|
||||
session_changed.emit()
|
||||
return true
|
||||
|
||||
|
||||
func start_simulation_block(questions: Array, block_index: int, total_blocks: int, deadline_unix: float) -> void:
|
||||
system_name = "All Systems"
|
||||
mode = "Simulation"
|
||||
@@ -190,6 +220,44 @@ func submit_core_attempt(choice_id: String, eliminated: Array, flagged: bool) ->
|
||||
}
|
||||
|
||||
|
||||
func submit_bookmark_attempt(choice_id: String, eliminated: Array, flagged: bool) -> Dictionary:
|
||||
var question := get_current_question()
|
||||
if session_kind != "bookmark" or question.is_empty():
|
||||
return {}
|
||||
var answer := {
|
||||
"question": question.duplicate(true),
|
||||
"selected_choice_id": choice_id,
|
||||
"is_correct": choice_id == str(question.get("correct_choice_id", "")),
|
||||
"eliminated_choice_ids": eliminated.duplicate(),
|
||||
"flagged": flagged,
|
||||
"elapsed_seconds": get_current_elapsed_seconds(),
|
||||
"target_seconds": 0.0
|
||||
}
|
||||
if bool(answer.is_correct):
|
||||
answers[current_index] = answer
|
||||
session_changed.emit()
|
||||
return {"answer": answer, "is_correct": bool(answer.is_correct), "final": bool(answer.is_correct)}
|
||||
|
||||
|
||||
func skip_bookmark_question(eliminated: Array, flagged: bool) -> Dictionary:
|
||||
var question := get_current_question()
|
||||
if session_kind != "bookmark" or question.is_empty():
|
||||
return {}
|
||||
var answer := {
|
||||
"question": question.duplicate(true),
|
||||
"selected_choice_id": "",
|
||||
"is_correct": false,
|
||||
"is_skip": true,
|
||||
"eliminated_choice_ids": eliminated.duplicate(),
|
||||
"flagged": flagged,
|
||||
"elapsed_seconds": get_current_elapsed_seconds(),
|
||||
"target_seconds": 0.0
|
||||
}
|
||||
answers[current_index] = answer
|
||||
session_changed.emit()
|
||||
return answer
|
||||
|
||||
|
||||
func skip_core_question(eliminated: Array, flagged: bool) -> Dictionary:
|
||||
var question := get_current_question()
|
||||
if question.is_empty():
|
||||
@@ -248,7 +316,7 @@ func get_progress_text() -> String:
|
||||
|
||||
|
||||
func finish_block() -> Dictionary:
|
||||
if session_kind == "core":
|
||||
if session_kind in ["core", "bookmark"]:
|
||||
block_started = false
|
||||
session_changed.emit()
|
||||
return {}
|
||||
|
||||
Reference in New Issue
Block a user