ashok 7 months ago
commit 6c417124bc

@ -6526,6 +6526,19 @@ exports.consumptionofparticulartank = async (request, reply) => {
capacity: tank.capacity,
waterlevel: tank.waterlevel,
};
const stopDateMoment = moment(stopDate, "DD-MMM-YYYY - HH:mm");
const today = moment().startOf('day');
if (stopDateMoment.isSame(today, 'day')) {
const latestConsumption = (waterlevel_at_midnight + total_water_added_from_midnight) - waterlevel;
const nowFormatted = moment().format("DD-MMM-YYYY - HH:mm");
filteredConsumptions.push({
tankName: tank.tankName,
consumption: latestConsumption.toString(),
time: nowFormatted
});
}
// Send the response, including both total consumption and filtered consumption records
reply.send({

Loading…
Cancel
Save