Update countAllInsuranceItems() to make use of MathUtil.arraySum()

This commit is contained in:
Dev 2023-11-08 09:51:15 +00:00
parent 4f7715825a
commit 98ab19c6fa

View File

@ -26,6 +26,7 @@ import { MailSendService } from "@spt-aki/services/MailSendService";
import { PaymentService } from "@spt-aki/services/PaymentService"; import { PaymentService } from "@spt-aki/services/PaymentService";
import { RandomUtil } from "@spt-aki/utils/RandomUtil"; import { RandomUtil } from "@spt-aki/utils/RandomUtil";
import { TimeUtil } from "@spt-aki/utils/TimeUtil"; import { TimeUtil } from "@spt-aki/utils/TimeUtil";
import { MathUtil } from "@spt-aki/utils/MathUtil";
@injectable() @injectable()
export class InsuranceController export class InsuranceController
@ -35,6 +36,7 @@ export class InsuranceController
constructor( constructor(
@inject("WinstonLogger") protected logger: ILogger, @inject("WinstonLogger") protected logger: ILogger,
@inject("RandomUtil") protected randomUtil: RandomUtil, @inject("RandomUtil") protected randomUtil: RandomUtil,
@inject("MathUtil") protected mathUtil: MathUtil,
@inject("EventOutputHolder") protected eventOutputHolder: EventOutputHolder, @inject("EventOutputHolder") protected eventOutputHolder: EventOutputHolder,
@inject("TimeUtil") protected timeUtil: TimeUtil, @inject("TimeUtil") protected timeUtil: TimeUtil,
@inject("SaveServer") protected saveServer: SaveServer, @inject("SaveServer") protected saveServer: SaveServer,
@ -144,7 +146,7 @@ export class InsuranceController
*/ */
protected countAllInsuranceItems(insurance: Insurance[]): number protected countAllInsuranceItems(insurance: Insurance[]): number
{ {
return insurance.map(ins => ins.items.length).reduce((acc, len) => acc + len, 0); return this.mathUtil.arraySum(insurance.map(ins => ins.items.length));
} }
/** /**