From 46fdd2e0c272b956f34bd342b7ce4cc2bf2630fc Mon Sep 17 00:00:00 2001 From: PxlLoewe <72106766+PxlLoewe@users.noreply.github.com> Date: Tue, 15 Jul 2025 23:46:59 -0700 Subject: [PATCH] Added Status 6 for MissionAuto-close --- apps/dispatch-server/modules/chron.ts | 17 ++++++++++++++--- apps/hub/app/_components/Nav.tsx | 4 ++-- 2 files changed, 16 insertions(+), 5 deletions(-) diff --git a/apps/dispatch-server/modules/chron.ts b/apps/dispatch-server/modules/chron.ts index 02811e7b..97f75693 100644 --- a/apps/dispatch-server/modules/chron.ts +++ b/apps/dispatch-server/modules/chron.ts @@ -51,10 +51,21 @@ const removeClosedMissions = async () => { l.data?.newFMSstatus === "1" ); }); + const status6Log = (mission.missionLog as unknown as MissionLog[]).findIndex((l) => { + return ( + l.type === "station-log" && + l.data?.stationId === stationId && + l.data?.newFMSstatus === "6" + ); + }); + return ( status4Log !== -1 && - status1Log !== -1 && - (status4Log < status1Log || status8Log < status1Log) + (status1Log !== -1 || status6Log !== -1) && + (status4Log < status1Log || + status8Log < status1Log || + status8Log < status6Log || + status1Log < status6Log) ); }, ); @@ -104,7 +115,7 @@ const removeClosedMissions = async () => { io.to("dispatchers").emit("notification", { type: "mission-auto-close", status: "chron", - message: `Einsatz ${updatedMission.publicId} wurde aufgrund von Inaktivität geschlossen.`, + message: `Einsatz ${updatedMission.publicId} wurde aufgrund ${allStationsInMissionChangedFromStatus4to1Or8to1 ? "des Freimeldens aller Stationen" : "von Inaktivität"} geschlossen.`, data: { missionId: updatedMission.id, publicMissionId: updatedMission.publicId, diff --git a/apps/hub/app/_components/Nav.tsx b/apps/hub/app/_components/Nav.tsx index a645de2e..ee5e96e7 100644 --- a/apps/hub/app/_components/Nav.tsx +++ b/apps/hub/app/_components/Nav.tsx @@ -151,7 +151,7 @@ export const HorizontalNav = async () => { target="_blank" > )} @@ -162,7 +162,7 @@ export const HorizontalNav = async () => { target="_blank" > )}