Add multi-day entries and area stay blocks
Entries gain an optional inclusive end_date (backfilled via migration): flights and travel longer than 24h show a continuation marker on following days, and a new stay entry type marks a time frame in one area (e.g. 3 days Venice) rendered as continuous bands across the calendar weeks. Stays feed the map route as stops; the route summary gains stays count and a chronological areas list with day spans. 49 API tests.
This commit is contained in:
@@ -331,6 +331,13 @@ export default function tripsRoutes(db) {
|
||||
}
|
||||
}
|
||||
if (includedKm !== null) includedKm = Math.round(includedKm * 10) / 10;
|
||||
// Stay "area blocks" in chronological order (allEntries is date-ordered).
|
||||
const areas = allEntries
|
||||
.filter((e) => e.type === 'stay')
|
||||
.map((e) => ({
|
||||
name: e.location_name || e.title,
|
||||
days: e.end_date ? daysInclusive(e.date, e.end_date) : 1,
|
||||
}));
|
||||
const days = daysInclusive(trip.start_date, trip.end_date);
|
||||
const locations = [];
|
||||
for (const s of stops) {
|
||||
@@ -352,6 +359,8 @@ export default function tripsRoutes(db) {
|
||||
travelLegs: countType('travel'),
|
||||
activities: countType('activity'),
|
||||
rentals: countType('rental'),
|
||||
stays: countType('stay'),
|
||||
areas,
|
||||
kmAir: Math.round(kmAir * 10) / 10,
|
||||
kmDriven: Math.round(kmDriven * 10) / 10,
|
||||
includedKm,
|
||||
|
||||
Reference in New Issue
Block a user