basic flight calc working

This commit is contained in:
2025-09-26 11:22:45 +02:00
parent 4cd422a993
commit 90e958af74
3 changed files with 80 additions and 28 deletions

View File

@@ -17,8 +17,8 @@ export class Flight {
}
summary() {
const s = [];
if (this.origin?.iata) s.push(this.origin.iata);
if (this.destination?.iata) s.push(this.destination.iata);
if (this.departureAirport?.iata) s.push(this.departureAirport.iata);
if (this.arrivalAirport?.iata) s.push(this.arrivalAirport.iata);
const route = s.length ? s.join(' → ') : 'Flight';
const co2 = this.emissions?.co2_total ?? this.co2 ?? null;
return co2 != null ? `${route}: ${co2} kg CO₂e` : route;