Bhaskar 6 months ago
commit 0dfd77800f

@ -1317,7 +1317,7 @@ exports.updateSensorQC = async (req, reply) => {
// Ensure qccheck is handled properly // Ensure qccheck is handled properly
if (filteredUpdateData.qccheck) { if (filteredUpdateData.qccheck) {
const qccheckLower = filteredUpdateData.qccheck.toLowerCase(); const qccheckLower = filteredUpdateData.qccheck.toLowerCase();
filteredUpdateData.status = qccheckLower === 'Pass' ? 'available' : 'qcfailed'; filteredUpdateData.status = qccheckLower === 'pass' ? 'available' : 'qcfailed';
} }
// Update qccheckdate with the current date in "DD-MMM-YYYY - HH:MM" format // Update qccheckdate with the current date in "DD-MMM-YYYY - HH:MM" format

@ -6221,7 +6221,7 @@ async function processIotData(hw_Id, data) {
// Case 1: First time signal is lost // Case 1: First time signal is lost
if ( if (
existingTank.slave_status !== "signal_lost1" && existingTank.slave_status !== "signal_lost1" &&
existingTank.slave_status !== "not_working" existingTank.slave_status !== "not_working1"
) { ) {
existingTank.slave_status = "signal_lost1"; existingTank.slave_status = "signal_lost1";
existingTank.slave_disconnected_time = now.format('DD-MMM-YYYY - HH:mm:ss'); existingTank.slave_disconnected_time = now.format('DD-MMM-YYYY - HH:mm:ss');
@ -6240,7 +6240,7 @@ async function processIotData(hw_Id, data) {
const minutesElapsed = now.diff(lostTime, 'minutes'); const minutesElapsed = now.diff(lostTime, 'minutes');
if (minutesElapsed >= 15) { if (minutesElapsed >= 15) {
existingTank.slave_status = "not_working"; existingTank.slave_status = "not_working1";
existingTank.slave_disconnected_time = now.format('DD-MMM-YYYY - HH:mm:ss'); existingTank.slave_disconnected_time = now.format('DD-MMM-YYYY - HH:mm:ss');
await existingTank.save(); await existingTank.save();
@ -6257,7 +6257,7 @@ async function processIotData(hw_Id, data) {
if (linkedTank) { if (linkedTank) {
for (const inputConnection of linkedTank.connections.inputConnections) { for (const inputConnection of linkedTank.connections.inputConnections) {
if (inputConnection.inputConnections === tank_name) { if (inputConnection.inputConnections === tank_name) {
inputConnection.slave_status = "not_working"; inputConnection.slave_status = "not_working1";
await linkedTank.save(); await linkedTank.save();
console.log(`🔗 Linked tank [${linkedTank.tankName}] inputConnection updated to not_working`); console.log(`🔗 Linked tank [${linkedTank.tankName}] inputConnection updated to not_working`);
} }

@ -444,6 +444,7 @@ const insensorsSchema = new mongoose.Schema({
connected_status: { type: String, enum: ["connected", "Not connected", "unknown"], default: "unknown" }, connected_status: { type: String, enum: ["connected", "Not connected", "unknown"], default: "unknown" },
masterName: { type: String, default: null }, masterName: { type: String, default: null },
location: { type: String, default: null }, location: { type: String, default: null },
tankhardwareId: { type: String, default: null },
motor_switches: [ motor_switches: [
{ {
from_tank: { type: String, default: null }, from_tank: { type: String, default: null },

Loading…
Cancel
Save