fix: скрыт адрес до доклада бригады

This commit is contained in:
kaifarikman 2026-09-28 01:06:02 +03:00 • committed by gglamer
commit 5e8a0a7f09
2 changed files with 15 additions and 2 deletions

View file

@ -172,6 +172,19 @@ def build_card(
}, },
) )
else: else:
description_facts = scenario.facts[:3]
if scenario.dds_card_error is not None:
# Иначе верный адрес из вводной попадёт в описание ошибочной КИО
# и курсант увидит расхождение до доклада бригады.
description_facts = [
fact for fact in scenario.facts
if "address" not in fact.id.lower()
and not address_matches(truth.address, fact.value)
][:3]
description = "; ".join(fact.value for fact in description_facts)
if not description:
description = ("Происшествие по выданной карточке"
if scenario.dds_card_error is not None else scenario.first_line)
kio = KIO( kio = KIO(
registered_at=now_utc(), registered_at=now_utc(),
caller_number=caller_phone, caller_number=caller_phone,
@ -190,8 +203,7 @@ def build_card(
signs=list(scenario.signs), signs=list(scenario.signs),
notify=scenario.notify_services(), notify=scenario.notify_services(),
victims_count=truth.victims, victims_count=truth.victims,
description="; ".join(fact.value for fact in scenario.facts[:3]) description=description,
or scenario.first_line,
) )
if service: if service:
kio = apply_patch(kio, {"dds": service}) kio = apply_patch(kio, {"dds": service})

View file

@ -844,6 +844,7 @@ def test_crew_discovers_card_address_error_and_dispatcher_reports_it_to_112(clie
card = state.desk.active card = state.desk.active
assert card.dispatched_card.address == "улица Ленина, 16" assert card.dispatched_card.address == "улица Ленина, 16"
assert card.scenario.ground_truth.address == "улица Ленина, 14" assert card.scenario.ground_truth.address == "улица Ленина, 14"
assert "Ленина, 14" not in card.dispatched_card.description
with client.websocket_connect(f"/ws/station/{session_id}") as station: with client.websocket_connect(f"/ws/station/{session_id}") as station:
service = accept_with_crew(station) service = accept_with_crew(station)
station.send_json({ station.send_json({