- corretto scheda prodotto, record salvato

This commit is contained in:
Surya Paolo
2025-05-01 00:20:16 +02:00
parent 97abe8b46d
commit fcc3755c19
13 changed files with 89 additions and 49 deletions

View File

@@ -32,6 +32,9 @@ const CatalogSchema = new Schema({
idCollane: [{
type: String,
}],
idTipoFormato: [{
type: Number,
}],
argomenti: [{
type: String,

View File

@@ -256,7 +256,7 @@ CitySchema.statics.insertGeojsonToMongoDB = async function (nomefilejson) {
if (reccity) {
const ris = await City.updateOne({ _id: reccity._id }, { $set: { geojson: citta } });
if (ris.acknowledged === 1) {
if (ris.acknowledged) {
inseriti++;
}
}

View File

@@ -63,6 +63,7 @@ const catalogo = new Schema(
argomenti: [{ type: String }],
idCollane: [{ type: String }],
idTipologia: [{ type: Number }],
idTipoFormato: [{ type: Number }],
sort_field: { type: String },
sort_dir: { type: Number },
pdf: { type: Boolean },

View File

@@ -130,7 +130,8 @@ const scheletroScheda = {
productTypes: [{ type: Number }],
excludeproductTypes: [{ type: Number }],
idTipologia: [{ type: Number }],
idTipologie: [{ type: Number }],
idTipoFormato: [{ type: Number }],
editore: [{ type: String }],
argomenti: [{ type: String }],
idCollane: [{ type: String }],

View File

@@ -112,6 +112,20 @@ const productSchema = new Schema({
eta: {
type: String
},
verificaprod: {
esito: {
type: Number,
},
data: {
type: Date,
},
username: {
type: String,
},
note: {
type: String,
},
},
}
],
price_acquistato: {

View File

@@ -459,12 +459,14 @@ module.exports.updateProductInfoByStats = async function (idapp) {
const T_WEB_ArticoliFatturati = require('./t_web_articolifatturati');
const T_WEB_Ordini = require('./t_web_ordini');
const statistics = await T_WEB_ArticoliFatturati.getStatistics();
mylog = "Inizio Aggiornamento Statistiche... \n";
mylogtot += mylog;
console.log(mylog);
let countUpdate = 0;
countUpdate = await T_WEB_ArticoliFatturati.updateStatisticsFatt('', idapp, true);
// Itera sui risultati e aggiorna productInfo
mylog = `Aggiornati ${countUpdate} record di productInfo`;

View File

@@ -87,13 +87,16 @@ module.exports.updateStatisticsOrders = async function (CodArticoloGM, idapp, up
try {
let myquery = [];
// Query di aggregazione per calcolare le statistiche
myquery.push(
{
$match: {
CodArticoloGM: CodArticoloGM,
},
});
if (CodArticoloGM) {
// Query di aggregazione per calcolare le statistiche
myquery.push(
{
$match: {
CodArticoloGM: CodArticoloGM,
},
});
}
myquery.push(
{
$group: {