lct-55: ошибка адреса и сообщение в 112
This commit is contained in:
parent
29aca65e8c
commit
f0c9015f2b
14 changed files with 267 additions and 7 deletions
|
|
@ -195,6 +195,9 @@ def build_card(
|
|||
)
|
||||
if service:
|
||||
kio = apply_patch(kio, {"dds": service})
|
||||
if scenario.dds_card_error is not None:
|
||||
# Ошибка относится к выданному снимку; эталон сценария остаётся верным.
|
||||
kio = kio.model_copy(update={"address": scenario.dds_card_error.card_value})
|
||||
kio.response_status = ResponseStatus.TRANSFERRED
|
||||
timers = SessionTimers(limits=dict(limits))
|
||||
timers.on_event("dds.dispatch")
|
||||
|
|
@ -401,7 +404,14 @@ def _deliver_card_adjacent(state: "SessionState", card: DdsLiveCard, now: dateti
|
|||
def _finish_phone_call(card: DdsLiveCard) -> list[Any]:
|
||||
call = card.phone_pending
|
||||
assert call is not None
|
||||
text = _report_text(call.phase, call.crew, card.dispatched_card.address or "из карточки")
|
||||
error = card.scenario.dds_card_error
|
||||
if call.phase == "arrived" and error is not None and error.field == "address":
|
||||
actual = card.scenario.ground_truth.address
|
||||
text = (f"{call.crew}: прибыли по адресу {actual}. "
|
||||
f"В карточке указан {card.dispatched_card.address}; "
|
||||
"адрес не совпадает. Сообщите об ошибке в 112.")
|
||||
else:
|
||||
text = _report_text(call.phase, call.crew, card.dispatched_card.address or "из карточки")
|
||||
line = _line(card, "crew", text)
|
||||
report = PhoneReportRecord(service=call.service, crew=call.crew,
|
||||
phase=call.phase, text=text, at=now_utc())
|
||||
|
|
@ -749,6 +759,16 @@ class DdsDesk(BaseModel):
|
|||
return DeskOutcome()
|
||||
card.reply_text = command.text
|
||||
card.reply_log.append((now_utc(), command.text))
|
||||
case "card.error_report_112":
|
||||
if command.card_id != card.card_id:
|
||||
return _refused("Сообщение относится не к текущей карточке")
|
||||
if card.scenario.dds_card_error is None or not any(
|
||||
report.phase == "arrived" for report in card.phone_reports
|
||||
):
|
||||
return _refused("Сначала получите доклад бригады с места об ошибке карточки")
|
||||
if any(action == "card.error_report_112" for action, _at, _detail in card.dds_log):
|
||||
return DeskOutcome()
|
||||
card.dds_log.append(("card.error_report_112", now_utc(), command.text.strip()))
|
||||
case "card.open":
|
||||
if not dds_lesson or not self.open(command.card_id):
|
||||
return _refused("Карточка отсутствует в текущей очереди")
|
||||
|
|
|
|||
Loading…
Reference in a new issue