Exclude products with hide_on_stock_overview enabled in current stock info on /stockoverview (fixes #2250)

This commit is contained in:
Bernd Bestel
2023-06-08 22:15:33 +02:00
parent de4c6e8b60
commit d05038e311
2 changed files with 4 additions and 2 deletions

View File

@@ -236,7 +236,7 @@ function RefreshStatistics()
{
if (!Grocy.FeatureFlags.GROCY_FEATURE_FLAG_STOCK_PRICE_TRACKING)
{
$("#info-current-stock").text(__n(result.length, '%s Product', '%s Products'));
$("#info-current-stock").text(__n(result.filter(x => !BoolVal(x.product.hide_on_stock_overview)).length, '%s Product', '%s Products'));
}
else
{
@@ -245,7 +245,8 @@ function RefreshStatistics()
{
valueSum += 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 })));
$("#info-current-stock").text(__n(result.filter(x => !BoolVal(x.product.hide_on_stock_overview)).length, '%s Product', '%s Products') + ", " + __t('%s total value', valueSum.toLocaleString(undefined, { style: "currency", currency: Grocy.Currency })));
}
},
function(xhr)