ashok 7 months ago
commit 751fc90bad

@ -603,7 +603,6 @@ exports.assignTeamMemberToQuotation = async (request, reply) => {
// Step 2: Get GSM Time from first tank time if available // Step 2: Get GSM Time from first tank time if available
const firstTankTime = latestRecord.tanks?.[0]?.time || new Date(latestRecord.date).toTimeString().split(' ')[0]; const firstTankTime = latestRecord.tanks?.[0]?.time || new Date(latestRecord.date).toTimeString().split(' ')[0];
const connected_gsm_time = firstTankTime; const connected_gsm_time = firstTankTime;
// Step 3: Update Insensor // Step 3: Update Insensor
@ -624,10 +623,23 @@ exports.assignTeamMemberToQuotation = async (request, reply) => {
console.log("Updated connected_gsm_date/time:", connected_gsm_date, connected_gsm_time); console.log("Updated connected_gsm_date/time:", connected_gsm_date, connected_gsm_time);
} }
// Step 4: Check tank connection status
const tanksWithStatus = latestRecord.tanks.map(tank => {
const height = parseFloat(tank.tankHeight || "0");
const connectionStatus = height > 0 ? "GSM Connected" : "GSM Not Connected";
return {
...tank,
connectionStatus
};
});
return reply.send({ return reply.send({
status_code: 200, status_code: 200,
message: "Success", message: "Success",
data: iotData data: {
...latestRecord,
tanks: tanksWithStatus
}
}); });
} catch (err) { } catch (err) {
@ -637,6 +649,7 @@ exports.assignTeamMemberToQuotation = async (request, reply) => {
}; };
exports.getByHardwareAndTankId = async (req, reply) => { exports.getByHardwareAndTankId = async (req, reply) => {

Loading…
Cancel
Save