Remove sample creation control
This commit is contained in:
@@ -8,7 +8,6 @@ signal state_changed
|
|||||||
signal request_failed(message: String)
|
signal request_failed(message: String)
|
||||||
signal outcome_changed
|
signal outcome_changed
|
||||||
signal history_changed
|
signal history_changed
|
||||||
signal sample_created
|
|
||||||
|
|
||||||
var api_url := DEFAULT_API_URL
|
var api_url := DEFAULT_API_URL
|
||||||
var outcome_api_url := "https://s3q.ranaze.com/api/step3-outcomes"
|
var outcome_api_url := "https://s3q.ranaze.com/api/step3-outcomes"
|
||||||
@@ -60,10 +59,6 @@ func load_results_preview() -> void:
|
|||||||
_send("preview", HTTPClient.METHOD_GET, "/preview-results")
|
_send("preview", HTTPClient.METHOD_GET, "/preview-results")
|
||||||
|
|
||||||
|
|
||||||
func create_sample_completed() -> void:
|
|
||||||
_send("sample_create", HTTPClient.METHOD_POST, "/sample-completed")
|
|
||||||
|
|
||||||
|
|
||||||
func start_next_block() -> void:
|
func start_next_block() -> void:
|
||||||
if simulation.is_empty():
|
if simulation.is_empty():
|
||||||
return
|
return
|
||||||
@@ -182,9 +177,6 @@ func _on_request_completed(result: int, response_code: int, _headers: PackedStri
|
|||||||
history_next_before = "" if next_before == null else str(next_before)
|
history_next_before = "" if next_before == null else str(next_before)
|
||||||
history_changed.emit()
|
history_changed.emit()
|
||||||
return
|
return
|
||||||
if action == "sample_create":
|
|
||||||
sample_created.emit()
|
|
||||||
return
|
|
||||||
if action.begins_with("outcome_"):
|
if action.begins_with("outcome_"):
|
||||||
outcome = parsed
|
outcome = parsed
|
||||||
outcome_changed.emit()
|
outcome_changed.emit()
|
||||||
|
|||||||
@@ -7,7 +7,6 @@ var list: VBoxContainer
|
|||||||
var status_label: Label
|
var status_label: Label
|
||||||
var load_more_button: Button
|
var load_more_button: Button
|
||||||
var pending_simulation_id := ""
|
var pending_simulation_id := ""
|
||||||
var sample_button: Button
|
|
||||||
|
|
||||||
|
|
||||||
func _ready() -> void:
|
func _ready() -> void:
|
||||||
@@ -19,8 +18,6 @@ func _ready() -> void:
|
|||||||
ExamSimulationService.state_changed.connect(_on_simulation_loaded)
|
ExamSimulationService.state_changed.connect(_on_simulation_loaded)
|
||||||
if not ExamSimulationService.request_failed.is_connected(_on_request_failed):
|
if not ExamSimulationService.request_failed.is_connected(_on_request_failed):
|
||||||
ExamSimulationService.request_failed.connect(_on_request_failed)
|
ExamSimulationService.request_failed.connect(_on_request_failed)
|
||||||
if not ExamSimulationService.sample_created.is_connected(_on_sample_created):
|
|
||||||
ExamSimulationService.sample_created.connect(_on_sample_created)
|
|
||||||
var top := HBoxContainer.new()
|
var top := HBoxContainer.new()
|
||||||
add_child(top)
|
add_child(top)
|
||||||
var back := Button.new()
|
var back := Button.new()
|
||||||
@@ -41,14 +38,6 @@ func _ready() -> void:
|
|||||||
status_label.autowrap_mode = TextServer.AUTOWRAP_WORD_SMART
|
status_label.autowrap_mode = TextServer.AUTOWRAP_WORD_SMART
|
||||||
Style.set_label(status_label, 16, Style.MUTED)
|
Style.set_label(status_label, 16, Style.MUTED)
|
||||||
add_child(status_label)
|
add_child(status_label)
|
||||||
sample_button = Button.new()
|
|
||||||
sample_button.text = "Create Sample Completed Simulation"
|
|
||||||
sample_button.tooltip_text = "SUPER only; creates test review data without changing QBank statistics"
|
|
||||||
sample_button.visible = AuthState.role.to_upper() == "SUPER"
|
|
||||||
sample_button.size_flags_horizontal = Control.SIZE_SHRINK_BEGIN
|
|
||||||
Style.style_chip(sample_button, Style.AMBER)
|
|
||||||
sample_button.pressed.connect(_create_sample)
|
|
||||||
add_child(sample_button)
|
|
||||||
var scroll := ScrollContainer.new()
|
var scroll := ScrollContainer.new()
|
||||||
scroll.size_flags_vertical = Control.SIZE_EXPAND_FILL
|
scroll.size_flags_vertical = Control.SIZE_EXPAND_FILL
|
||||||
scroll.size_flags_horizontal = Control.SIZE_EXPAND_FILL
|
scroll.size_flags_horizontal = Control.SIZE_EXPAND_FILL
|
||||||
@@ -146,28 +135,12 @@ func _load_more() -> void:
|
|||||||
ExamSimulationService.load_history(ExamSimulationService.history_next_before)
|
ExamSimulationService.load_history(ExamSimulationService.history_next_before)
|
||||||
|
|
||||||
|
|
||||||
func _create_sample() -> void:
|
|
||||||
sample_button.disabled = true
|
|
||||||
status_label.text = "Creating sample simulation..."
|
|
||||||
ExamSimulationService.create_sample_completed()
|
|
||||||
|
|
||||||
|
|
||||||
func _on_sample_created() -> void:
|
|
||||||
if not visible:
|
|
||||||
return
|
|
||||||
sample_button.disabled = false
|
|
||||||
status_label.text = "Sample created. Refreshing history..."
|
|
||||||
ExamSimulationService.load_history()
|
|
||||||
|
|
||||||
|
|
||||||
func _on_request_failed(message: String) -> void:
|
func _on_request_failed(message: String) -> void:
|
||||||
if not visible:
|
if not visible:
|
||||||
return
|
return
|
||||||
pending_simulation_id = ""
|
pending_simulation_id = ""
|
||||||
status_label.text = message
|
status_label.text = message
|
||||||
load_more_button.disabled = false
|
load_more_button.disabled = false
|
||||||
if sample_button != null:
|
|
||||||
sample_button.disabled = false
|
|
||||||
|
|
||||||
|
|
||||||
static func _action_for_state(state: String) -> String:
|
static func _action_for_state(state: String) -> String:
|
||||||
|
|||||||
Reference in New Issue
Block a user