d231a7fb40
Maschinenstunden sind im Journal erfassbar; der Kraftstoffverbrauch pro Maschinenstunde wird aus Tagesverbrauch und Maschinenstunden berechnet und in Journal sowie Statistik als Read-only angezeigt. Co-authored-by: Cursor <cursoragent@cursor.com>
14 lines
468 B
TypeScript
14 lines
468 B
TypeScript
/** Liters per motor hour from daily fuel consumption and motor hours. */
|
|
export function computeFuelPerMotorHour(
|
|
fuelConsumptionL: number,
|
|
motorHours: number
|
|
): number | null {
|
|
if (motorHours <= 0) return null
|
|
return Number((fuelConsumptionL / motorHours).toFixed(2))
|
|
}
|
|
|
|
export function formatFuelPerMotorHour(value: number | null | undefined): string {
|
|
if (value == null) return '—'
|
|
return Number.isInteger(value) ? String(value) : value.toFixed(2)
|
|
}
|