master^2
Bhaskar 6 months ago
parent 66a0de9b03
commit d6ea747138

@ -696,6 +696,15 @@ exports.assignTeamMemberToQuotation = async (request, reply) => {
const tankHeight = parseFloat(matchedTank.tankHeight || "0");
const isLoraConnected = isGSMConnected && tankHeight > 0;
const matchedTankDateObj = new Date(matchedTank.date);
const day = String(matchedTankDateObj.getDate()).padStart(2, '0');
const month = String(matchedTankDateObj.getMonth() + 1).padStart(2, '0');
const year = matchedTankDateObj.getFullYear();
const formattedDate = `${day}-${month}-${year}`;
// Add formatted date to matchedTank
matchedTank.date = formattedDate;
const updateFields = {
connected_status: isLoraConnected ? "connected" : "disconnected",
};
@ -704,8 +713,8 @@ exports.assignTeamMemberToQuotation = async (request, reply) => {
let connected_lora_time = null;
if (isLoraConnected) {
connected_lora_date = new Date(matchedTank.date).toISOString().split("T")[0];
connected_lora_time = matchedTank.time || new Date(matchedTank.date).toTimeString().split(" ")[0];
connected_lora_date = formattedDate;
connected_lora_time = matchedTank.time || matchedTankDateObj.toTimeString().split(" ")[0];
updateFields.connected_lora_date = connected_lora_date;
updateFields.connected_lora_time = connected_lora_time;
@ -738,6 +747,8 @@ exports.assignTeamMemberToQuotation = async (request, reply) => {
exports.getAllocatedSensorsByTank = async (req, reply) => {
try {
let { customerId, tankName } = req.params;
@ -1268,7 +1279,7 @@ exports.getIotDataByCustomer = async (req, reply) => {
message,
masterName: relatedSensors[0]?.masterName ?? null,
location: relatedSensors[0]?.location ?? null,
tanks: tanksStatus
tanks: tanksStatus.slice(1) // 👈 Skip the first tank
};
});

Loading…
Cancel
Save