diff --git a/backend/app/session/dds.py b/backend/app/session/dds.py index ad0cfbe..4adf234 100644 --- a/backend/app/session/dds.py +++ b/backend/app/session/dds.py @@ -172,6 +172,19 @@ def build_card( }, ) 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( registered_at=now_utc(), caller_number=caller_phone, @@ -190,8 +203,7 @@ def build_card( signs=list(scenario.signs), notify=scenario.notify_services(), victims_count=truth.victims, - description="; ".join(fact.value for fact in scenario.facts[:3]) - or scenario.first_line, + description=description, ) if service: kio = apply_patch(kio, {"dds": service}) diff --git a/backend/tests/test_dds_exercise.py b/backend/tests/test_dds_exercise.py index 683d397..48bb437 100644 --- a/backend/tests/test_dds_exercise.py +++ b/backend/tests/test_dds_exercise.py @@ -844,6 +844,7 @@ def test_crew_discovers_card_address_error_and_dispatcher_reports_it_to_112(clie card = state.desk.active assert card.dispatched_card.address == "улица Ленина, 16" 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: service = accept_with_crew(station) station.send_json({