From 0bfd22a459fcb84b71a5ac6a447c3f4300baa8bb Mon Sep 17 00:00:00 2001 From: Sven Czarnian Date: Sun, 23 Oct 2022 23:53:32 +0200 Subject: [PATCH] optimize the performance table selection --- src/performance/performance.service.ts | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/performance/performance.service.ts b/src/performance/performance.service.ts index 12a18af..4c75986 100644 --- a/src/performance/performance.service.ts +++ b/src/performance/performance.service.ts @@ -169,7 +169,11 @@ export class PerformanceService { }); } - async findAircraft(icao: string, wtc: string): Promise { + async findAircraft( + icao: string, + wtc: string, + engineCount: number, + ): Promise { return this.performanceModel .findOne({ icaoCode: icao }) .then(async (response) => { @@ -178,6 +182,9 @@ export class PerformanceService { case 'L': return this.performanceModel.findOne({ icaoCode: 'C172' }); case 'H': + if (engineCount === 2) { + return this.performanceModel.findOne({ icaoCode: 'B764' }); + } return this.performanceModel.findOne({ icaoCode: 'B744' }); case 'J': return this.performanceModel.findOne({ icaoCode: 'A388' });