Fixes
This commit is contained in:
@@ -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({
|
await prisma.connectedAircraft.update({
|
||||||
where: {
|
where: {
|
||||||
id: activeAircraft?.id,
|
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) {
|
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({
|
const positionLog = await prisma.positionLog.create({
|
||||||
|
|||||||
@@ -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
|
// 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 =
|
const missionStartLog =
|
||||||
missionStartLogs?.find(
|
missionStartLogs?.find(
|
||||||
(log) => log.data.station?.id === row.original.Station.id,
|
(log) => log.data?.station?.id === row.original.Station.id,
|
||||||
) || missionStartLogs?.[0];
|
) || missionStartLogs?.[0];
|
||||||
|
|
||||||
const missionEndLog = row.original.Mission.missionLog.find(
|
const missionEndLog = row.original.Mission.missionLog.find(
|
||||||
|
|||||||
@@ -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
|
// 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 =
|
const missionStartLog =
|
||||||
missionStartLogs?.find(
|
missionStartLogs?.find(
|
||||||
(log) => log.data.station?.id === row.original.Station.id,
|
(log) => log.data?.station?.id === row.original.Station.id,
|
||||||
) || missionStartLogs?.[0];
|
) || missionStartLogs?.[0];
|
||||||
|
|
||||||
const missionEndLog = row.original.Mission.missionLog.find(
|
const missionEndLog = row.original.Mission.missionLog.find(
|
||||||
|
|||||||
Reference in New Issue
Block a user