diff --git a/src/server/models/productInfo.js b/src/server/models/productInfo.js index e2d195f..54bf702 100755 --- a/src/server/models/productInfo.js +++ b/src/server/models/productInfo.js @@ -138,7 +138,7 @@ const productInfoSchema = new Schema({ }, totVen: Number, - vLastM: Number, + vLast3M: Number, vLast6M: Number, vLastY: Number, vLast2Y: Number, diff --git a/src/server/router/admin_router.js b/src/server/router/admin_router.js index 8148a3b..7a8db33 100755 --- a/src/server/router/admin_router.js +++ b/src/server/router/admin_router.js @@ -679,7 +679,7 @@ router.post('/import', authenticate, async (req, res) => { imported++; // if (imported > 1000) // break; - if (imported % 50 === 0) + if (imported % 100 === 0) console.log('importato ', imported, 'su ', myarr.length); } @@ -757,11 +757,11 @@ router.post('/import', authenticate, async (req, res) => { let risisbn = await ImportaIsbn.findOneAndUpdate({ isbn: product.code }, { $set: recisbn }, { new: true, upsert: true, strict: false }); - // Update ProductInfo - let risrecInfo = await ProductInfo.findOneAndUpdate({ code: productInfo.code }, { $set: productInfo }, { new: true, upsert: true }); + // Update ProductInfo, non crea nuovi record ! + let risrecInfo = await ProductInfo.findOneAndUpdate({ code: productInfo.code }, { $set: productInfo }, { new: true, upsert: false }); indprod++; - if (indprod % 50 === 0) + if (indprod % 100 === 0) console.log(indprod + '/' + numprod); } } @@ -814,7 +814,7 @@ router.post('/import', authenticate, async (req, res) => { let risrec = await ImportaIsbn.findOneAndUpdate(queryprod, { $set: recmacro }, { new: true, upsert: true, strict: false }); if (risrec) { imported++; - if ((imported % 50) === 0) + if ((imported % 100) === 0) console.log('Importati dir TEMPORANEA ... ', imported + '/' + numtot); } @@ -842,7 +842,7 @@ router.post('/import', authenticate, async (req, res) => { let risupdate = await ProductInfo.updateMany({ idapp }, { $set: { totVen: 0, - vLastM: 0, + vLast3M: 0, vLast6M: 0, vLastY: 0, vLast2Y: 0, @@ -882,7 +882,7 @@ router.post('/import', authenticate, async (req, res) => { // name: product.title, totVen: product.totVen || 0, - vLastM: product.vLastM || 0, + vLast3M: product.vLast3M || 0, vLast6M: product.vLast6M || 0, vLastY: product.vLastY || 0, vLast2Y: product.vLast2Y || 0, @@ -905,7 +905,7 @@ router.post('/import', authenticate, async (req, res) => { let risrecInfo = await ProductInfo.findOneAndUpdate({ code: productInfo.code }, { $set: productInfo }, { new: true, upsert: false }); if (risrecInfo) { imported++; - if (imported % 50 === 0) + if (imported % 100 === 0) console.log('Importati... ', imported + '/' + numprod); } } @@ -970,7 +970,7 @@ router.post('/import', authenticate, async (req, res) => { let risrec = await Importamacro.findOneAndUpdate(queryprod, { $set: recmacro }, { new: true, upsert: true, strict: false }); if (risrec) { imported++; - if (imported % 50 === 0) + if (imported % 100 === 0) console.log('Importati su dir Temporanea ', imported); } @@ -1039,7 +1039,7 @@ router.post('/import', authenticate, async (req, res) => { let versione = 0; - if (indprod % 50 === 0) + if (indprod % 100 === 0) console.log(indprod + '/' + numprod); diff --git a/src/server/router/index_router.js b/src/server/router/index_router.js index 298b9bd..4d67345 100755 --- a/src/server/router/index_router.js +++ b/src/server/router/index_router.js @@ -843,6 +843,7 @@ async function duplicatePage(pageId, newpath) { // modifiche ai campi se necessario, per esempio: path: newpath, title: newpath, + inmenu: false, active: true, date_updated: new Date() }); diff --git a/src/server/router/users_router.js b/src/server/router/users_router.js index 1fcbcdc..4433145 100755 --- a/src/server/router/users_router.js +++ b/src/server/router/users_router.js @@ -1561,7 +1561,7 @@ async function eseguiDbOp(idapp, mydata, locale, req, res) { console.log(`Cancellati ${deleteProductInfo.deletedCount} record dalla collezione ProductInfo.`); } - ris = !!deleteProductInfo; + ris = deleteProductInfo ? true : false; } else if (mydata.dbop === 'dropCatProd') {