fix(tours): keep unknown actual tracks unknown and name every track a link replaces (ACT-01)

A tour detail that cannot be read (offline without a cached copy, or a server
error) no longer shows "No actual track yet" while the trip list names tracks
of the tour; the section says they could not be loaded and offers no link over
them.

The day a track was recorded on is the viewer's calendar day of its first time
stamp, not the UTC one, in the tour detail, the link dialog and the GPX
preview alike, through one helper.

Taking a tour off a day keeps its actual track without a day, so "no day" can
hold several. A change now starts on the track it was asked for, and the link
dialog names every track it replaces, as the server clears all of them. The
migration, repository, service and MCP texts say so.

The refusal for linking a tour to itself or a track with tracks of its own now
reads "This track cannot be linked to this tour", which is true of both, and
the offline helper of the tour cache sits above the doc of replaceTripTours
again.
This commit is contained in:
Maurice
2026-10-20 12:50:38 +02:00
parent d0cc6fc2f4
commit a8be1c5b45
46 changed files with 243 additions and 100 deletions
@@ -7,11 +7,12 @@ import { Migration } from '@mikro-orm/migrations';
* name and provenance, and the planned tour keeps its line, measures and times
* untouched. `assignment_id` is the execution, the day assignment of the tour
* the recording belongs to; NULL for a tour done without a day. One recording
* documents one tour (`track_place_id UNIQUE`) and an execution has one
* recording (the partial unique index); an execution without a day is held to
* one by the service, which also refuses a tour as its own recording. Taking
* the tour off a day keeps the recording and only forgets the day; deleting
* either tour takes the assignment with it.
* documents one tour (`track_place_id UNIQUE`) and a day's execution has one
* recording (the partial unique index). Without a day there can be several:
* taking the tour off a day keeps its recording and only forgets the day, so
* it joins any that had none. Linking a recording to "no day" replaces all of
* them, and the app names each before it does. Deleting either tour takes the
* assignment with it.
* `assigned_by` names who assigned it, kept as unknown when that account goes.
*
* Not to be confused with `tours.recorded_route_geometry`: that is the line an
@@ -112,7 +112,8 @@ export class TourActivitiesRepository extends TrekRepository<TourActivities> {
/**
* Clears the way for a new assignment of `track_place_id` to this execution
* of the tour: the recording the execution had, and the execution this
* of the tour: the recordings the execution had (a day has one; "no day" can
* have several once the days they were on are gone), and the execution this
* recording had on the same tour. Inside the caller's transaction, before
* {@link insertActivity}.
*/