From 5e8a0a7f098132fe0c7979144c7f38a830d77a71 Mon Sep 17 00:00:00 2001 From: kaifarikman Date: Mon, 28 Sep 2026 01:06:02 +0300 Subject: [PATCH] =?UTF-8?q?fix:=20=D1=81=D0=BA=D1=80=D1=8B=D1=82=20=D0=B0?= =?UTF-8?q?=D0=B4=D1=80=D0=B5=D1=81=20=D0=B4=D0=BE=20=D0=B4=D0=BE=D0=BA?= =?UTF-8?q?=D0=BB=D0=B0=D0=B4=D0=B0=20=D0=B1=D1=80=D0=B8=D0=B3=D0=B0=D0=B4?= =?UTF-8?q?=D1=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- backend/app/session/dds.py | 16 ++++++++++++++-- backend/tests/test_dds_exercise.py | 1 + 2 files changed, 15 insertions(+), 2 deletions(-) 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({