This commit is contained in:
PxlLoewe
2025-07-08 10:53:43 -07:00
parent 754e8efc47
commit 91d706bc6b
3 changed files with 7 additions and 7 deletions

View File

@@ -44,6 +44,10 @@ export const PUT = async (req: Request) => {
},
});
if (!activeAircraft) {
return Response.json({ message: "No active aircraft found" }, { status: 204 });
}
await prisma.connectedAircraft.update({
where: {
id: activeAircraft?.id,
@@ -60,12 +64,8 @@ export const PUT = async (req: Request) => {
},
});
if (!activeAircraft) {
return Response.json({ message: "No active aircraft found" }, { status: 400 });
}
if (activeAircraft.posLat === position.lat && activeAircraft.posLng === position.lng) {
return Response.json({ message: "Position has not changed" }, { status: 400 });
return Response.json({ message: "Position has not changed" }, { status: 204 });
}
const positionLog = await prisma.positionLog.create({

View File

@@ -53,7 +53,7 @@ export const RecentFlights = () => {
// Find the first log with a station ID that matches the current row's station ID or use the first log if none match
const missionStartLog =
missionStartLogs?.find(
(log) => log.data.station?.id === row.original.Station.id,
(log) => log.data?.station?.id === row.original.Station.id,
) || missionStartLogs?.[0];
const missionEndLog = row.original.Mission.missionLog.find(

View File

@@ -60,7 +60,7 @@ const Page = () => {
// Find the first log with a station ID that matches the current row's station ID or use the first log if none match
const missionStartLog =
missionStartLogs?.find(
(log) => log.data.station?.id === row.original.Station.id,
(log) => log.data?.station?.id === row.original.Station.id,
) || missionStartLogs?.[0];
const missionEndLog = row.original.Mission.missionLog.find(