Fixed price history chart data parsing (fixes #1914)

This commit is contained in:
Bernd Bestel 2022-06-09 22:14:00 +02:00
parent 48e9467a99
commit fe92caaed4
No known key found for this signature in database
GPG Key ID: 71BD34C0D4891300
2 changed files with 3 additions and 1 deletions

View File

@ -14,6 +14,7 @@
- The stock setting "Decimal places allowed for prices" has been split into separate settings for input and displaying prices (the existing setting will be set for both new options on migration, so no changed behavior when not configured)
- Optimized that when the plural form(s) of a quantity unit is/are not provided, the singular form is used to display plural amounts
- Fixed "Automatically add products that are below their defined min. stock amount to the shopping list" (stock setting) was only done when consuming products, not when opening them
- Fixed that the price history chart (product card) showed the price on a wrong date when having multiple purchases on the same date from different stores
### Shopping list

View File

@ -151,7 +151,7 @@ Grocy.Components.ProductCard.Refresh = function(productId)
datasets[key] = []
}
chart.labels.push(moment(dataPoint.date).toDate());
datasets[key].push(Number.parseFloat(dataPoint.price) * Number.parseFloat(productDetails.product.qu_factor_purchase_to_stock));
datasets[key].push({ x: moment(dataPoint.date).toDate(), y: Number.parseFloat(dataPoint.price) * Number.parseFloat(productDetails.product.qu_factor_purchase_to_stock) });
});
Object.keys(datasets).forEach((key) =>
@ -163,6 +163,7 @@ Grocy.Components.ProductCard.Refresh = function(productId)
label: key,
});
});
Grocy.Components.ProductCard.PriceHistoryChart.update();
}
else