From 7fdd01d01ed799bc505eda75c9348889307165df Mon Sep 17 00:00:00 2001 From: "nicolas.dorier" Date: Fri, 13 Jun 2025 09:36:13 +0900 Subject: [PATCH] Fix flaky CanUsePOSCart --- BTCPayServer/Views/Shared/PointOfSale/Public/Cart.cshtml | 4 ++-- .../Views/Shared/PointOfSale/Public/VueLight.cshtml | 2 +- BTCPayServer/wwwroot/pos/common.js | 8 -------- 3 files changed, 3 insertions(+), 11 deletions(-) diff --git a/BTCPayServer/Views/Shared/PointOfSale/Public/Cart.cshtml b/BTCPayServer/Views/Shared/PointOfSale/Public/Cart.cshtml index 357c3be96..8d5b25780 100644 --- a/BTCPayServer/Views/Shared/PointOfSale/Public/Cart.cshtml +++ b/BTCPayServer/Views/Shared/PointOfSale/Public/Cart.cshtml @@ -96,10 +96,10 @@ } @if (item.Inventory.HasValue) { - + @if (item.Inventory > 0) { - @ViewLocalizer["{0} left", item.Inventory.ToString()] + @StringLocalizer["{0} left", item.Inventory.ToString()] } else { diff --git a/BTCPayServer/Views/Shared/PointOfSale/Public/VueLight.cshtml b/BTCPayServer/Views/Shared/PointOfSale/Public/VueLight.cshtml index e75c453d7..066fa6c59 100644 --- a/BTCPayServer/Views/Shared/PointOfSale/Public/VueLight.cshtml +++ b/BTCPayServer/Views/Shared/PointOfSale/Public/VueLight.cshtml @@ -140,7 +140,7 @@ } @if (item.Inventory.HasValue) { - + @if (item.Inventory > 0) { @ViewLocalizer["{0} left", item.Inventory.ToString()] diff --git a/BTCPayServer/wwwroot/pos/common.js b/BTCPayServer/wwwroot/pos/common.js index 21f9959c0..d67b2f211 100644 --- a/BTCPayServer/wwwroot/pos/common.js +++ b/BTCPayServer/wwwroot/pos/common.js @@ -291,14 +291,6 @@ const posCommon = { return item.inventory == null || item.inventory > (itemInCart ? itemInCart.count : 0) }, - inventoryText(index) { - const item = this.items[index] - if (item.inventory == null) return null - - const itemInCart = this.cart.find(lineItem => lineItem.id === item.id) - const left = item.inventory - (itemInCart ? itemInCart.count : 0) - return left > 0 ? `${item.inventory} left` : 'Sold out' - }, addToCart(index, count) { if (!this.inStock(index)) return null;