From 89459b9e5bf8f5c9e7745e61adfd2bfac5a081ee Mon Sep 17 00:00:00 2001 From: Dev Date: Sat, 8 Jun 2024 19:38:48 +0100 Subject: [PATCH] Small cleanup of `setTraderOfferPurchaseLimits()` --- project/src/controllers/RagfairController.ts | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/project/src/controllers/RagfairController.ts b/project/src/controllers/RagfairController.ts index b77b2374..e8d7d4a9 100644 --- a/project/src/controllers/RagfairController.ts +++ b/project/src/controllers/RagfairController.ts @@ -251,14 +251,11 @@ export class RagfairController protected setTraderOfferPurchaseLimits(offer: IRagfairOffer, fullProfile: ISptProfile): void { // No trader found, create a blank record for them - if (!fullProfile.traderPurchases[offer.user.id]) - { - fullProfile.traderPurchases[offer.user.id] = {}; - } + fullProfile.traderPurchases[offer.user.id] ||= {}; const traderAssorts = this.traderHelper.getTraderAssortsByTraderId(offer.user.id).items; const assortId = offer.items[0]._id; - const assortData = traderAssorts.find((x) => x._id === assortId); + const assortData = traderAssorts.find((item) => item._id === assortId); // Use value stored in profile, otherwise use value directly from in-memory trader assort data offer.buyRestrictionCurrent = fullProfile.traderPurchases[offer.user.id][assortId]