- aggiornamento 1.2.71
This commit is contained in:
@@ -143,6 +143,7 @@ async function filterValidItems(mycart) {
|
||||
try {
|
||||
mycart.newitems = [];
|
||||
let haschanged = false;
|
||||
|
||||
for (let item of mycart.items) {
|
||||
try {
|
||||
if (
|
||||
|
||||
@@ -329,7 +329,7 @@ module.exports.updateTotals = async function (order, codice_sconto) {
|
||||
|
||||
module.exports.getTotalOrderById = async function (id) {
|
||||
const query = [
|
||||
{ $match: { _id: new mongoose.Types.ObjectId(id) } },
|
||||
{ $match: { _id: new ObjectId(id) } },
|
||||
{
|
||||
$lookup: {
|
||||
from: 'products',
|
||||
@@ -543,6 +543,8 @@ module.exports.getTotalOrderById = async function (id) {
|
||||
},
|
||||
];
|
||||
|
||||
|
||||
|
||||
const ris = await Order.aggregate(query);
|
||||
return ris;
|
||||
};
|
||||
|
||||
@@ -1,7 +1,11 @@
|
||||
// @ts-check
|
||||
export function pick(obj, keys) {
|
||||
/** @type {any} */
|
||||
const out = {};
|
||||
for (const k of keys) if (k in obj) out[k] = obj[k];
|
||||
return out;
|
||||
function pick(obj, keys) {
|
||||
const result = {};
|
||||
for (const key of keys) {
|
||||
if (obj[key] !== undefined) {
|
||||
result[key] = obj[key];
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
module.exports = { pick };
|
||||
|
||||
Reference in New Issue
Block a user