Fix product card chart rendering error when there is no shopping location (references #658)

This commit is contained in:
Bernd Bestel
2020-03-25 19:49:10 +01:00
parent a45317aea1
commit c3d4be352d
4 changed files with 11 additions and 3 deletions

View File

@@ -122,7 +122,12 @@ Grocy.Components.ProductCard.Refresh = function(productId)
var chart = Grocy.Components.ProductCard.PriceHistoryChart.data;
priceHistoryDataPoints.forEach((dataPoint) =>
{
var key = dataPoint.shopping_location || "empty";
var key = __t("Unknown shopping location");
if (dataPoint.shopping_location)
{
key = dataPoint.shopping_location.name
}
if (!datasets[key]) {
datasets[key] = []
}