mirror of
https://github.com/grocy/grocy.git
synced 2025-08-17 19:16:37 +00:00
Fix rounding error on total value calculation (#1347)
* Fix rounding error on total value calculation * Remove unused 'amountSum' calculation
This commit is contained in:
@@ -214,12 +214,6 @@ function RefreshStatistics()
|
||||
Grocy.Api.Get('stock',
|
||||
function(result)
|
||||
{
|
||||
var amountSum = 0;
|
||||
result.forEach(element =>
|
||||
{
|
||||
amountSum += parseInt(element.amount);
|
||||
});
|
||||
|
||||
if (!Grocy.FeatureFlags.GROCY_FEATURE_FLAG_STOCK_PRICE_TRACKING)
|
||||
{
|
||||
$("#info-current-stock").text(__n(result.length, '%s Product', '%s Products'));
|
||||
@@ -229,7 +223,7 @@ function RefreshStatistics()
|
||||
var valueSum = 0;
|
||||
result.forEach(element =>
|
||||
{
|
||||
valueSum += parseInt(element.value);
|
||||
valueSum += parseFloat(element.value);
|
||||
});
|
||||
$("#info-current-stock").text(__n(result.length, '%s Product', '%s Products') + ", " + __t('%s total value', valueSum.toLocaleString(undefined, { style: "currency", currency: Grocy.Currency })));
|
||||
}
|
||||
|
Reference in New Issue
Block a user