|
|
|
@ -2377,10 +2377,14 @@ 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 = new Date().toISOString();
|
|
|
|
|
const currentTime = getFormattedISTTime();
|
|
|
|
|
|
|
|
|
|
const waterLevelRecords = tanks.map(tank => ({
|
|
|
|
|
customerId: tank.customerId,
|
|
|
|
@ -2397,4 +2401,4 @@ const storeWaterLevels = async () => {
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
setInterval(storeWaterLevels, 15 * 60 * 1000); // Run every 15 minutes
|
|
|
|
|
setInterval(storeWaterLevels, 15 * 60 * 1000);
|
|
|
|
|