Fix subtracking by the right stock value

This commit is contained in:
Max Wofford 2024-09-03 23:00:02 -04:00
parent ee71d14d63
commit 942f26b77e

View file

@ -19,7 +19,7 @@ export const shopParts = async () => {
let stock = fields["Stock"]
if (stock && fields["Count of Orders Fulfilled"]) {
fields["Stock"] -= fields["Count of Orders Fulfilled"]
stock -= fields["Count of Orders Fulfilled"]
}
return { id: record.id, ...record.fields, "Stock": (stock == null)? null : (stock >= 0 ? stock : 0) }
})