From 3af5209675264a0c07af6943975a9571a78099d5 Mon Sep 17 00:00:00 2001 From: varun Date: Thu, 30 May 2024 02:31:31 -0400 Subject: [PATCH] This is for getting tank levels --- src/controllers/tanksController.js | 8 ++------ src/models/tanks.js | 2 +- 2 files changed, 3 insertions(+), 7 deletions(-) diff --git a/src/controllers/tanksController.js b/src/controllers/tanksController.js index 702b6253..d291a0fa 100644 --- a/src/controllers/tanksController.js +++ b/src/controllers/tanksController.js @@ -2377,14 +2377,10 @@ exports.update_auto_percentage = async (req, reply) => { //storing water level for every 15 minutes -const getFormattedISTTime = () => { - return moment().tz('Asia/Kolkata').format('DD-MM-YYYY hh:mm:ss A'); -}; - const storeWaterLevels = async () => { try { const tanks = await Tank.find({}); - const currentTime = getFormattedISTTime(); + const currentTime = new Date().toISOString(); const waterLevelRecords = tanks.map(tank => ({ customerId: tank.customerId, @@ -2401,4 +2397,4 @@ const storeWaterLevels = async () => { } }; -setInterval(storeWaterLevels, 15 * 60 * 1000); +setInterval(storeWaterLevels, 15 * 60 * 1000); // Run every 15 minutes diff --git a/src/models/tanks.js b/src/models/tanks.js index defcd2d6..a1cc2b34 100644 --- a/src/models/tanks.js +++ b/src/models/tanks.js @@ -76,7 +76,7 @@ const tanksSchema = new mongoose.Schema({ manual_threshold_time:{type: String, default: null}, threshold_type:{type: String, default: "percentage"}, startTime:{type: String,default:null}, - + start_instance_id:{type:String,default:null}, stopTime:{type: String,default:null} } ],