Fix inflated shopping price estimates and restore feature issues workflow.
Price each list line as one retail purchase instead of 14-day restock qty; convert €/kg AI prices to estimated piece weight; cap smart-shopping suggested conf/pz counts. Stop triage script from bulk-closing feature backlog. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
+20
-9
@@ -12128,19 +12128,11 @@ async function syncShoppingPriceTotal(forceRefresh = false) {
|
||||
function _buildPricePayload() {
|
||||
return shoppingItems.map((item) => {
|
||||
const smart = _matchBringToSmart(item.name, smartShoppingItems);
|
||||
if (smart?.suggested_qty > 0) {
|
||||
return {
|
||||
name: item.name,
|
||||
quantity: smart.suggested_qty,
|
||||
unit: smart.suggested_unit || smart.unit || 'conf',
|
||||
default_quantity: smart.default_qty || 0,
|
||||
package_unit: smart.package_unit || '',
|
||||
};
|
||||
}
|
||||
if (smart) {
|
||||
const unit = smart.unit || 'conf';
|
||||
const defQty = parseFloat(smart.default_qty) || 0;
|
||||
const pkgUnit = smart.package_unit || '';
|
||||
// One shopping-list line ≈ one retail purchase (not 14-day restock qty).
|
||||
if (unit === 'conf' && defQty > 0 && pkgUnit) {
|
||||
return {
|
||||
name: item.name,
|
||||
@@ -12150,6 +12142,25 @@ function _buildPricePayload() {
|
||||
package_unit: pkgUnit,
|
||||
};
|
||||
}
|
||||
if (unit === 'pz') {
|
||||
const gramsPerPiece = defQty >= 20 ? defQty : 200;
|
||||
return {
|
||||
name: item.name,
|
||||
quantity: 2,
|
||||
unit: 'pz',
|
||||
default_quantity: gramsPerPiece,
|
||||
package_unit: 'g',
|
||||
};
|
||||
}
|
||||
if ((unit === 'g' || unit === 'ml') && defQty > 0) {
|
||||
return {
|
||||
name: item.name,
|
||||
quantity: defQty,
|
||||
unit,
|
||||
default_quantity: defQty,
|
||||
package_unit: pkgUnit,
|
||||
};
|
||||
}
|
||||
}
|
||||
return { name: item.name, quantity: 1, unit: 'conf', default_quantity: 0, package_unit: '' };
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user