|
|
@ -121,6 +121,8 @@ exports.getTank = async (req, reply) => {
|
|
|
|
throw boom.boomify(err);
|
|
|
|
throw boom.boomify(err);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//exports.getTanklevels = async (req, reply) => {
|
|
|
|
//exports.getTanklevels = async (req, reply) => {
|
|
|
|
// try {
|
|
|
|
// try {
|
|
|
|
// const customerId = req.params.customerId;
|
|
|
|
// const customerId = req.params.customerId;
|
|
|
@ -150,7 +152,7 @@ exports.updateTanklevels = async (req, reply) => {
|
|
|
|
for (const tank of tanks) {
|
|
|
|
for (const tank of tanks) {
|
|
|
|
const tankId = tank._id;
|
|
|
|
const tankId = tank._id;
|
|
|
|
let capacity = parseInt(tank.capacity.replace(/,/g, ''), 10);
|
|
|
|
let capacity = parseInt(tank.capacity.replace(/,/g, ''), 10);
|
|
|
|
let waterLevel = capacity - 100; // initial water level
|
|
|
|
let waterLevel = parseInt(tank.waterlevel.replace(/,/g, ''), 10);
|
|
|
|
|
|
|
|
|
|
|
|
const intervalId = setInterval(async function () {
|
|
|
|
const intervalId = setInterval(async function () {
|
|
|
|
const newWaterLevel = Math.floor(waterLevel - 200);
|
|
|
|
const newWaterLevel = Math.floor(waterLevel - 200);
|
|
|
|