Skip to content

armgit / TREK

Public Imported from GitHub
0

The most complete open-source travel planner: real-time collaboration, bookings, budgets, packing lists, journals, offline PWA, SSO and an AI-ready MCP server, with planet-wide place search and routing built in.

Fix travel-stats: wrong JOIN on days table (d.trip_id not d.id)

Maurice173d6cd95323
diff --git a/server/src/routes/auth.js b/server/src/routes/auth.js
index 10d75b791..470c6c56e 100644
--- a/server/src/routes/auth.js
+++ b/server/src/routes/auth.js
@@ -350,7 +350,7 @@ router.get('/travel-stats', authenticate, (req, res) => {
SELECT COUNT(DISTINCT t.id) as trips,
COUNT(DISTINCT d.id) as days
FROM trips t
- LEFT JOIN days d ON t.id = d.id
+ LEFT JOIN days d ON d.trip_id = t.id
LEFT JOIN trip_members tm ON t.id = tm.trip_id
WHERE (t.user_id = ? OR tm.user_id = ?) AND t.is_archived = 0
`).get(userId, userId);