Add variable question distractor pools
This commit is contained in:
@@ -103,7 +103,8 @@ func load_questions_from_api(reset_retry: bool = true) -> void:
|
||||
"Authorization: Bearer %s" % AuthState.access_token
|
||||
])
|
||||
var payload := {
|
||||
"limit": 80
|
||||
"limit": 80,
|
||||
"supportsChoicePools": true
|
||||
}
|
||||
var err := request.request(questions_api_url, headers, HTTPClient.METHOD_POST, JSON.stringify(payload))
|
||||
if err != OK:
|
||||
@@ -177,10 +178,10 @@ func clear_questions() -> void:
|
||||
ratings_changed.emit()
|
||||
|
||||
|
||||
func record_first_attempt(question_id: String, choice_id: String) -> void:
|
||||
func record_first_attempt(question_id: String, choice_id: String, presented_choice_ids: Array = []) -> void:
|
||||
if AuthState.access_token.is_empty() or question_id == "" or choice_id == "":
|
||||
return
|
||||
_enqueue_attempt("answer", question_id, choice_id)
|
||||
_enqueue_attempt("answer", question_id, choice_id, presented_choice_ids)
|
||||
|
||||
|
||||
func skip_question(question_id: String) -> void:
|
||||
@@ -294,7 +295,7 @@ func _on_retry_timer_timeout() -> void:
|
||||
load_questions_from_api(false)
|
||||
|
||||
|
||||
func _enqueue_attempt(kind: String, question_id: String, choice_id: String) -> void:
|
||||
func _enqueue_attempt(kind: String, question_id: String, choice_id: String, presented_choice_ids: Array = []) -> void:
|
||||
var account := AuthState.username.strip_edges()
|
||||
if account == "":
|
||||
return
|
||||
@@ -306,6 +307,7 @@ func _enqueue_attempt(kind: String, question_id: String, choice_id: String) -> v
|
||||
"kind": kind,
|
||||
"question_id": question_id,
|
||||
"choice_id": choice_id,
|
||||
"presented_choice_ids": presented_choice_ids.duplicate(),
|
||||
"retry_count": 0
|
||||
})
|
||||
_save_attempt_queue()
|
||||
@@ -335,7 +337,8 @@ func _process_attempt_queue() -> void:
|
||||
var url := question_attempt_api_url
|
||||
var body := JSON.stringify({
|
||||
"questionExternalId": question_id,
|
||||
"choiceId": str(queued.get("choice_id", ""))
|
||||
"choiceId": str(queued.get("choice_id", "")),
|
||||
"presentedChoiceIds": queued.get("presented_choice_ids", [])
|
||||
})
|
||||
if str(queued.get("kind", "answer")) == "skip":
|
||||
url = "%s/%s/skip" % [question_api_base_url.rstrip("/"), question_id.uri_encode()]
|
||||
@@ -457,6 +460,7 @@ func _load_attempt_queue() -> void:
|
||||
"kind": kind,
|
||||
"question_id": question_id,
|
||||
"choice_id": str(item.get("choice_id", "")),
|
||||
"presented_choice_ids": item.get("presented_choice_ids", []).duplicate(),
|
||||
"retry_count": max(0, int(item.get("retry_count", 0)))
|
||||
})
|
||||
|
||||
|
||||
Reference in New Issue
Block a user