feat: Zielhafen des Vortags als Start-Hafen für neuen Reisetag übernehmen

Erweitert die bestehende Vortags-Übernahme um den Starthafen im gleichen Bestätigungsdialog.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
2026-05-29 18:33:43 +02:00
co-authored by Cursor
parent 268500237d
commit 41fb106153
4 changed files with 29 additions and 8 deletions
+18
View File
@@ -41,6 +41,13 @@ export function getClosingTankLevel(tank?: Partial<TankLevels> | null): number {
export interface LogEntryTankSource {
freshwater?: Partial<TankLevels>
fuel?: Partial<TankLevels>
destination?: string
}
export interface CarryOverFromPreviousDay {
freshwater: TankLevels
fuel: TankLevels
departure: string
}
export function emptyTankLevels(morning = 0): TankLevels {
@@ -62,3 +69,14 @@ export function carryOverTankLevelsFromPreviousDay(previousEntry?: LogEntryTankS
fuel: emptyTankLevels(getClosingTankLevel(previousEntry.fuel))
}
}
export function carryOverFromPreviousDay(previousEntry?: LogEntryTankSource | null): CarryOverFromPreviousDay {
const { freshwater, fuel } = carryOverTankLevelsFromPreviousDay(previousEntry)
const departure = previousEntry?.destination?.trim() || ''
return { freshwater, fuel, departure }
}
export function hasCarryOverFromPreviousDay(carryOver: CarryOverFromPreviousDay): boolean {
return carryOver.freshwater.morning > 0 || carryOver.fuel.morning > 0 || carryOver.departure.length > 0
}