- Corretta query di estrapolazione libri su GM (Marco)
- aggiornato bestseller su fatlast1Y - non mostrare piu i libri che non hanno l'immagine (sul catalogo). - metti online i compressi
This commit is contained in:
@@ -250,13 +250,14 @@ CatalogSchema.statics.getCatalogById = async function (id) {
|
||||
product.idProductInfo.code &&
|
||||
product.idProductInfo.code !== '' &&
|
||||
product.idProductInfo.imagefile &&
|
||||
//product.idProductInfo.imagefile !== 'noimg.jpg' &&
|
||||
product.idProductInfo.imagefile !== 'noimg.jpg' &&
|
||||
!product.delete
|
||||
);
|
||||
if (catalog.lista_prodotti.length !== originalLength) {
|
||||
await catalog.save();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
const transformedArrRec = arrrec.map((catalog) => ({
|
||||
...catalog.toObject(), // Converte il documento Mongoose in un oggetto JavaScript puro
|
||||
|
||||
@@ -529,6 +529,23 @@ module.exports.setImgNotFound = async function (id) {
|
||||
|
||||
}
|
||||
|
||||
// imposta tutti i record con image_not_found: false
|
||||
module.exports.resetImageNotFound = async function () {
|
||||
try {
|
||||
const ProductInfo = this;
|
||||
|
||||
await ProductInfo.updateMany(
|
||||
{ image_not_found: true },
|
||||
{ $set: { image_not_found: false } }
|
||||
);
|
||||
console.log('Flag image_not_found reset to false for all records');
|
||||
return true;
|
||||
} catch (error) {
|
||||
console.error('Error resetting image_not_found flag:', error);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// crea una funzione che mi rimuove il record "product" che utilizza productInfo, nel caso in cui date_updated_fromGM non esista
|
||||
module.exports.removeProductInfoWithoutDateUpdatedFromGM = async function (idapp) {
|
||||
const ProductInfo = this;
|
||||
|
||||
Reference in New Issue
Block a user