mirror of
https://github.com/grocy/grocy.git
synced 2025-04-29 09:39:57 +00:00
Fix product card chart rendering error when there is no shopping location (references #658)
This commit is contained in:
parent
a45317aea1
commit
c3d4be352d
@ -3767,7 +3767,7 @@
|
||||
"format": "number"
|
||||
},
|
||||
"shopping_location": {
|
||||
"type": "string"
|
||||
"$ref": "#/components/schemas/ShoppingLocation"
|
||||
}
|
||||
}
|
||||
},
|
||||
|
@ -1762,3 +1762,6 @@ msgstr ""
|
||||
|
||||
msgid "Group ingredients by their product group"
|
||||
msgstr ""
|
||||
|
||||
msgid "Unknown shopping location"
|
||||
msgstr ""
|
||||
|
@ -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] = []
|
||||
}
|
||||
|
@ -178,7 +178,7 @@ class StockService extends BaseService
|
||||
$returnData[] = array(
|
||||
'date' => $row->purchased_date,
|
||||
'price' => $row->price,
|
||||
'shopping_location' => FindObjectInArrayByPropertyValue($shoppingLocations, 'id', $row->shopping_location_id)->name,
|
||||
'shopping_location' => FindObjectInArrayByPropertyValue($shoppingLocations, 'id', $row->shopping_location_id),
|
||||
);
|
||||
}
|
||||
return $returnData;
|
||||
|
Loading…
x
Reference in New Issue
Block a user