fix(dawarich): name stays never read before reading unnamed ones again

Unnamed stays are now read again at the end of a run, from the budget the others left and at most 20 per window, so new stays get their names and a Dawarich without a geocoder is not asked about every stay on each run.
This commit is contained in:
Maurice
2026-11-23 15:42:09 +01:00
parent 5e8cc0b90a
commit 8349c5066b
4 changed files with 89 additions and 10 deletions
@@ -355,6 +355,18 @@ describe('DawarichVisitSuggestionsRepository', () => {
last_seen_at: '2026-03-01T00:00:00Z',
});
});
it('DVSREPO-033: renameNewVisit names a stay nobody acted on, and leaves an accepted one as it is', async () => {
const { user } = createUser(testDb);
const fresh = await seed(user.id, { source_visit_id: 'a', name: 'Unnamed stay' });
const accepted = await seed(user.id, { source_visit_id: 'b', name: 'Mine', state: 'accepted' });
await suggestions.renameNewVisit(fresh, 'Cinisi, Italy');
await suggestions.renameNewVisit(accepted, 'Cinisi, Italy');
expect(await rawRow(fresh)).toMatchObject({ name: 'Cinisi, Italy', state: 'new' });
expect(await rawRow(accepted)).toMatchObject({ name: 'Mine', state: 'accepted' });
});
});
describe('listCandidatesForWindow/deleteById/stampMissingIfUnset (DSY7/DSY8/DSY9)', () => {