mirror of
https://github.com/mauriceboe/TREK.git
synced 2026-06-19 13:21:46 +00:00
fix(journey): prevent duplicate skeleton entries for multi-day places (#606)
When syncing trip places to journal, places assigned to multiple days (e.g. multi-night hotels) produced one skeleton entry per day_assignment row. The existing dedup check only looked at DB state, not at entries added within the same sync loop. Add the place ID to the tracking set after insertion so the same place is never inserted twice.
This commit is contained in:
@@ -261,6 +261,7 @@ export function syncTripPlaces(journeyId: number, tripId: number, authorId: numb
|
||||
|
||||
for (const place of places) {
|
||||
if (existingPlaceIds.has(place.id)) continue;
|
||||
existingPlaceIds.add(place.id);
|
||||
|
||||
const entryDate = place.day_date || new Date().toISOString().split('T')[0];
|
||||
const entryTime = place.assignment_time || place.place_time || null;
|
||||
|
||||
Reference in New Issue
Block a user