mirror of
https://github.com/mauriceboe/TREK.git
synced 2026-10-19 05:26:47 +00:00
fix(roadtrip): sort a booked night by its check-in, and clear the lint the cut left
Pinning an afternoon stop sorted that one and left the hotel it was booked around sitting behind it. The day's auto-sort reads each stop's own hour, and a booked night has none: nobody types a time into a hotel row, they type a check-in, and that lives on the booking. It counts now, so the night moves with everything else instead of staying where it was dropped. The assignments e2e builds its own tables and had neither the accommodation column nor day_accommodations, so every create in that file 500'd as soon as the insert learned to carry a booking id. Both are there now. And the shared lint, which is stricter than the other two and which I had not run: three leftovers from taking the check-out out of the chain, none of them used any more.
This commit is contained in:
@@ -212,10 +212,16 @@ export class AssignmentsService {
|
||||
if (placeTime) {
|
||||
const assignment = this.dbs.get<{ day_id: number }>('SELECT day_id FROM day_assignments WHERE id = ?', id);
|
||||
if (assignment) {
|
||||
// A booked night's hour lives on the booking, not on the stop: nobody types a
|
||||
// time into a hotel row, they type a check-in. Left out of this, the night
|
||||
// counted as untimed and stayed wherever it had been dropped, so pinning an
|
||||
// afternoon stop sorted that one and left the hotel sitting in front of or
|
||||
// behind it by accident.
|
||||
const dayAssignments = this.dbs.all<{ id: number; effective_time: string | null }>(`
|
||||
SELECT da.id, COALESCE(da.assignment_time, p.place_time) as effective_time
|
||||
SELECT da.id, COALESCE(da.assignment_time, p.place_time, acc.check_in) as effective_time
|
||||
FROM day_assignments da
|
||||
JOIN places p ON da.place_id = p.id
|
||||
LEFT JOIN day_accommodations acc ON acc.id = da.accommodation_id
|
||||
WHERE da.day_id = ?
|
||||
ORDER BY da.order_index ASC
|
||||
`, assignment.day_id);
|
||||
|
||||
Reference in New Issue
Block a user