NEO-153: fix completion rewards when first GET is already completed.
Match quest HUD transition detection so issue-then-complete races still populate reward lines.pull/195/head
parent
8289f2076d
commit
ad29b4e930
|
|
@ -198,7 +198,7 @@ func _detect_and_apply_completion_transitions(snapshot: Dictionary) -> void:
|
|||
_tracked_instance_id = iid
|
||||
var prev_status := str(_previous_status_by_instance.get(iid, ""))
|
||||
var can_detect := not boot_seed or bool(_contract_was_active_in_session.get(iid, false))
|
||||
if can_detect and prev_status == "active" and new_status == "completed":
|
||||
if can_detect and prev_status != "completed" and new_status == "completed":
|
||||
var summary := ContractClient.completion_reward_summary(iid, snapshot)
|
||||
if not summary.is_empty():
|
||||
_last_reward_instance_id = iid
|
||||
|
|
|
|||
|
|
@ -220,6 +220,20 @@ func test_reward_label_populates_on_active_to_completed_transition() -> void:
|
|||
assert_str(built["reward_label"].text).contains("Salvage +15 XP")
|
||||
|
||||
|
||||
func test_reward_label_populates_when_first_get_is_already_completed() -> void:
|
||||
# Arrange — issue marks session active; encounter completes before GET returns active
|
||||
var built: Dictionary = await _build_controller(
|
||||
NoopHttpTransport.new(), NoopHttpTransport.new()
|
||||
)
|
||||
var issue_row: Dictionary = (_active_snapshot()["contracts"] as Array)[0] as Dictionary
|
||||
built["controller"].call("_on_issue_result_received", {"issued": true, "contract": issue_row})
|
||||
# Act
|
||||
built["controller"].call("_on_contracts_received", _completed_snapshot())
|
||||
# Assert
|
||||
assert_str(built["reward_label"].text).contains("Contract rewards:")
|
||||
assert_str(built["reward_label"].text).contains("Salvage +15 XP")
|
||||
|
||||
|
||||
func test_completed_get_clears_stale_issue_patch_on_active_label() -> void:
|
||||
# Arrange — simulate successful issue patch still held when encounter-complete GET arrives
|
||||
var built: Dictionary = await _build_controller(
|
||||
|
|
|
|||
Loading…
Reference in New Issue