- risolto Ordinamento Bestseller (a 6 mesi ora)

- EditOn anche per gli Editori
This commit is contained in:
Surya Paolo
2024-12-17 21:38:10 +01:00
parent 300bab2125
commit 7f6ed73763
4 changed files with 13 additions and 12 deletions

View File

@@ -138,7 +138,7 @@ const productInfoSchema = new Schema({
},
totVen: Number,
vLastM: Number,
vLast3M: Number,
vLast6M: Number,
vLastY: Number,
vLast2Y: Number,

View File

@@ -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);

View File

@@ -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()
});

View File

@@ -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') {