fix(demo): skip the example trips when the demo account owns its own

The seed put the example trips in whenever the admin owned none, so a demo
whose content belongs to the demo account got them back on every reopen,
the hourly reset included, and the next baseline saved them along.
This commit is contained in:
Maurice
2026-10-25 00:10:21 +02:00
parent 270a13ff60
commit 2ac333f842
2 changed files with 35 additions and 1 deletions
+10
View File
@@ -69,6 +69,16 @@ async function seedDemoData(): Promise<{ adminId: number; demoId: number }> {
return { adminId, demoId };
}
// A demo whose content belongs to the demo account itself (built over the
// API, then saved as the baseline) is left alone. Without this the old
// example trips would come back on every reopen, the hourly reset included,
// and the mark below would save them into the next baseline.
const demoTripCount = await demo.countTripsByUser(demoId);
if (demoTripCount > 0) {
console.log('[Demo] The demo account owns its own trips, skipping the example trips');
return { adminId, demoId };
}
console.log('[Demo] Seeding example trips...');
await seedExampleTrips(demo, adminId, demoId);