Lista Doni Navi

This commit is contained in:
Paolo Arena
2020-03-25 09:25:31 +01:00
parent b2696d1898
commit b9d899ba72
6 changed files with 183 additions and 73 deletions

View File

@@ -433,7 +433,7 @@ router.post('/dbop', authenticate, async (req, res) => {
} else if (mydata.dbop === 'delNaviNoStarted') {
await Nave.setRiga(idapp, 1);
await Nave.setCol(idapp, 1);
const num = await Nave.remove({ idapp, date_start : { $gte: tools.IncDateNow(-1000 * 60 * 60 * 24 * 3) } });
const num = await Nave.remove({ idapp, date_start: { $gte: tools.IncDateNow(-1000 * 60 * 60 * 24 * 3) } });
ris = { num };
} else if (mydata.dbop === 'delNaviProvvisorie') {
const num = await Nave.remove({ idapp, provvisoria: true });
@@ -491,6 +491,23 @@ router.post('/dbop', authenticate, async (req, res) => {
}
ris = { num };
} else if (mydata.dbop === 'Corregginumtess') {
const listanavi = await Nave.find({ idapp });
let num = 0;
for (let rec of listanavi) {
const myarrrec = await Nave.find({ idapp, ind_order: rec.ind_order }).sort({ riga: 1, col: 1 });
let indextess = 1;
for (let ind = 0; ind < myarrrec.length; ind++) {
if (myarrrec[ind].num_tess !== indextess) {
myarrrec[ind].num_tess = indextess;
const risu = await Nave.findOneAndUpdate({ _id: myarrrec[ind]._id }, { $set: { num_tess: myarrrec[ind].num_tess } }, { new: false });
num++;
}
indextess++;
}
}
ris = { num };
} else if (mydata.dbop === 'creaUtentiTest') {