From 02b907e764a642c115eb66257d717f026a95cb8a Mon Sep 17 00:00:00 2001 From: Maurice Date: Sun, 29 Mar 2026 22:34:33 +0200 Subject: [PATCH] =?UTF-8?q?fix:=20manually=20marked=20Atlas=20countries=20?= =?UTF-8?q?not=20saved=20when=20no=20trips=20exist=20=E2=80=94=20closes=20?= =?UTF-8?q?#95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- server/src/routes/atlas.ts | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/server/src/routes/atlas.ts b/server/src/routes/atlas.ts index 4b6962b..e692e5f 100644 --- a/server/src/routes/atlas.ts +++ b/server/src/routes/atlas.ts @@ -96,7 +96,10 @@ router.get('/stats', (req: Request, res: Response) => { const tripIds = trips.map(t => t.id); if (tripIds.length === 0) { - return res.json({ countries: [], trips: [], stats: { totalTrips: 0, totalPlaces: 0, totalCountries: 0, totalDays: 0 } }); + // Still include manually marked countries even without trips + const manualCountries = db.prepare('SELECT country_code FROM visited_countries WHERE user_id = ?').all(userId) as { country_code: string }[]; + const countries = manualCountries.map(mc => ({ code: mc.country_code, placeCount: 0, tripCount: 0, firstVisit: null, lastVisit: null })); + return res.json({ countries, trips: [], stats: { totalTrips: 0, totalPlaces: 0, totalCountries: countries.length, totalDays: 0 } }); } const placeholders = tripIds.map(() => '?').join(',');