From bef38fddca4e49f97d3c51ae702593169bd66e4a Mon Sep 17 00:00:00 2001 From: Chomp Date: Sun, 19 Jan 2025 18:18:42 +0000 Subject: [PATCH] updated ``getOfferByid` return type to be nullable --- project/src/controllers/RagfairController.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/project/src/controllers/RagfairController.ts b/project/src/controllers/RagfairController.ts index a0d390b5..72b622c3 100644 --- a/project/src/controllers/RagfairController.ts +++ b/project/src/controllers/RagfairController.ts @@ -147,7 +147,7 @@ export class RagfairController { * @param request Request data * @returns IRagfairOffer */ - public getOfferById(sessionId: string, request: IGetRagfairOfferByIdRequest): IRagfairOffer { + public getOfferById(sessionId: string, request: IGetRagfairOfferByIdRequest): IRagfairOffer | undefined { const offers = this.ragfairOfferService.getOffers(); const offerToReturn = offers.find((offer) => offer.intId === request.id); @@ -335,7 +335,7 @@ export class RagfairController { // Figure out how many items the requirementsCost is applying to, and what the per-item price is const offerItemCount = Math.max( - offer.sellInOnePiece ? offer.items[0].upd?.StackObjectsCount ?? 1 : 1, + offer.sellInOnePiece ? (offer.items[0].upd?.StackObjectsCount ?? 1) : 1, ); const perItemPrice = offer.requirementsCost / offerItemCount; @@ -404,7 +404,7 @@ export class RagfairController { } /** - * Create a flea offer for a single item - uncludes an item with > 1 sized stack + * Create a flea offer for a single item - includes an item with > 1 sized stack * e.g. 1 ammo stack of 30 cartridges * @param sessionID Session id * @param offerRequest Offer request from client