master^2
Varun 7 months ago
parent b5dcc1bf4c
commit 2e59a1a5a8

@ -2236,6 +2236,7 @@ exports.acceptQuotation = async (req, reply) => {
// Find the quotation by ID
const quotation = await SensorQuotation.findOne({ quatationId: quotationId });
console.log(quotation,"quotation")
if (!quotation) {
return reply.status(404).send({ error: "Quotation not found" });
@ -2250,6 +2251,7 @@ exports.acceptQuotation = async (req, reply) => {
});
} else if (action === "accept") {
const { customerId, masters, slaves, sensors, master_connections } = quotation;
console.log(customerId,masters,slaves,sensors,master_connections)
// Convert quotation to an order object and include storeId
const newOrder = new Order({

@ -6120,14 +6120,14 @@ async function processIotData(hw_Id, data) {
await iotTankData.save();
// Delete excess records (keep only the latest three records)
const recordsToKeep = 3;
const recordsToDelete = await IotData.find({ hardwareId: hw_Id })
.sort({ date: -1, time: -1 })
.skip(recordsToKeep);
// const recordsToKeep = 3;
// const recordsToDelete = await IotData.find({ hardwareId: hw_Id })
// .sort({ date: -1, time: -1 })
// .skip(recordsToKeep);
for (const record of recordsToDelete) {
await record.remove();
}
// for (const record of recordsToDelete) {
// await record.remove();
// }
// Process each tank
for (const tank of tanks) {

Loading…
Cancel
Save