|
|
|
@ -3791,7 +3791,7 @@ const updatetotalConsumptiontillmidnight = async () => {
|
|
|
|
|
const formattedDate = moment().tz('Asia/Kolkata').format('DD-MMM-YYYY - HH:mm');
|
|
|
|
|
|
|
|
|
|
// Check if the record already exists
|
|
|
|
|
const existingRecord = await TankConsumptionSchema.findOne({
|
|
|
|
|
const existingRecord = await TankConsumptionOriginalSchema.findOne({
|
|
|
|
|
customerId: tank.customerId,
|
|
|
|
|
tankName: tank.tankName,
|
|
|
|
|
tankLocation: tank.tankLocation,
|
|
|
|
@ -3800,7 +3800,7 @@ const updatetotalConsumptiontillmidnight = async () => {
|
|
|
|
|
|
|
|
|
|
if (!existingRecord) {
|
|
|
|
|
// Create and save the new document if it doesn't exist
|
|
|
|
|
const newTankConsumption = new TankConsumptionSchema({
|
|
|
|
|
const newTankConsumption = new TankConsumptionOriginalSchema({
|
|
|
|
|
customerId: tank.customerId,
|
|
|
|
|
tankName: tank.tankName,
|
|
|
|
|
tankLocation: tank.tankLocation,
|
|
|
|
@ -3826,7 +3826,7 @@ const updatetotalConsumptiontillmidnight = async () => {
|
|
|
|
|
clearConsumptionSchedule();
|
|
|
|
|
|
|
|
|
|
// Schedule the task to run every day at 12:49 PM IST and store the reference
|
|
|
|
|
consumptionTask = cron.schedule('32 15 * * *', updatetotalConsumptiontillmidnight, {
|
|
|
|
|
consumptionTask = cron.schedule('50 23 * * *', updatetotalConsumptiontillmidnight, {
|
|
|
|
|
timezone: "Asia/Kolkata"
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|