- Gestore Ordini GAS (aggiornato)
- Possibilità di modificare un record, click sulla matita rossa. - corretto altre sistemazioni sui valori di minimo e massimo quantità.
This commit is contained in:
@@ -146,8 +146,11 @@ class Cart {
|
||||
} else {
|
||||
if (myorder.quantitypreordered === minqta) {
|
||||
step = minqta;
|
||||
} else {
|
||||
if (myorder.quantitypreordered - step < 0) {
|
||||
step = myorder.quantitypreordered - step;
|
||||
}
|
||||
}
|
||||
step = myorder.quantity - stepΩ;
|
||||
}
|
||||
return step;
|
||||
} catch (e) {
|
||||
|
||||
@@ -431,8 +431,8 @@ class AmazonBookScraper {
|
||||
}*/
|
||||
}
|
||||
|
||||
if (product.idProductInfo) {
|
||||
if (!tools.isDateValid(product.idProductInfo.date_pub)) {
|
||||
if (product.productInfo) {
|
||||
if (!tools.isDateValid(product.productInfo.date_pub)) {
|
||||
datimancanti = true;
|
||||
}
|
||||
}
|
||||
@@ -458,7 +458,7 @@ class AmazonBookScraper {
|
||||
}
|
||||
|
||||
includiNelControlloIlRecProduct(product) {
|
||||
return product.idProductInfo && [1, 4, 34, 45, 46].includes(product.idProductInfo.idStatoProdotto);
|
||||
return product.productInfo && [1, 4, 34, 45, 46].includes(product.productInfo.idStatoProdotto);
|
||||
}
|
||||
|
||||
async scrapeMultiple(products, options) {
|
||||
@@ -474,7 +474,7 @@ class AmazonBookScraper {
|
||||
|
||||
if (this.includiNelControlloIlRecProduct(product)) {
|
||||
if (this.datiMancanti(product) || options.caricatutti) {
|
||||
// console.log(`${quanti} / ${products.length} - Scraping: ${product.idProductInfo.name}`);
|
||||
// console.log(`${quanti} / ${products.length} - Scraping: ${product.productInfo.name}`);
|
||||
const data = await this.scrapeISBN(product, isbn, options);
|
||||
|
||||
if (data?.updated) {
|
||||
@@ -485,7 +485,7 @@ class AmazonBookScraper {
|
||||
if (i % 1 === 0) {
|
||||
const percentuale = ((i / products.length) * 100).toFixed(2);
|
||||
console.log(
|
||||
`Scraping: ${product.isbn} - ${product.idProductInfo.name} - ${quanti} su ${i + 1} / ${
|
||||
`Scraping: ${product.isbn} - ${product.productInfo.name} - ${quanti} su ${i + 1} / ${
|
||||
products.length
|
||||
} - [${percentuale}%] - ${this.getRemainingTimeToTheEnd(dataorainizio, i, products.length)}`
|
||||
);
|
||||
@@ -615,9 +615,8 @@ class AmazonBookScraper {
|
||||
const headers = ['isbn', 'titolo', 'pagine', 'misure', 'edizione', 'date_pub' /*'sottotitolo'*/];
|
||||
|
||||
try {
|
||||
// Trova i prodotti e popula 'idProductInfo'
|
||||
// Trova i prodotti
|
||||
const products = await Product.find({ idapp, scraped_updated: true })
|
||||
.populate({ path: 'idProductInfo', select: 'date_pub name sottotitolo' })
|
||||
.lean();
|
||||
|
||||
// Funzione per "appiattire" i dati
|
||||
@@ -634,10 +633,10 @@ class AmazonBookScraper {
|
||||
flattened.ristampa = variation.ristampa || '';
|
||||
}
|
||||
|
||||
// Assicurati che 'idProductInfo' esista prima di usarlo
|
||||
flattened.date_pub = item.idProductInfo ? item.idProductInfo.date_pub : '';
|
||||
flattened.titolo = item.idProductInfo ? item.idProductInfo.name : '';
|
||||
// flattened.sottotitolo = item.idProductInfo ? item.idProductInfo.sottotitolo : '';
|
||||
// Assicurati che 'productInfo' esista prima di usarlo
|
||||
flattened.date_pub = item.productInfo ? item.productInfo.date_pub : '';
|
||||
flattened.titolo = item.productInfo ? item.productInfo.name : '';
|
||||
// flattened.sottotitolo = item.productInfo ? item.productInfo.sottotitolo : '';
|
||||
|
||||
return flattened;
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user