mirror of
https://github.com/mauriceboe/TREK.git
synced 2026-10-24 16:03:02 +00:00
fix(tours): count a multi-day tour in the activity sums only once all its stages are on days
The activity sums never read which stage a day holds, so a multi-day tour counted its whole route on the last dated stage day while other stages were on no day yet, and a recording on one stage took the place of the whole plan beside it. With stages on days of their own, the route now counts once every stage is on a dated day of the user's, on the last of them, and is uncounted until then; a recording counts as what was done and the plan is not added beside it.
This commit is contained in:
@@ -52,6 +52,8 @@ export interface TourStatsExecutionRow {
|
||||
trip_title: string;
|
||||
assignment_id: number | null;
|
||||
date: string | null;
|
||||
/** MDT-02: the stage of a multi-day tour the day holds, by the key of its first stop; null for the whole tour. */
|
||||
tour_stage_key: string | null;
|
||||
participant_count: number;
|
||||
joined: number;
|
||||
}
|
||||
@@ -192,6 +194,7 @@ export class TourActivitiesRepository extends TrekRepository<TourActivities> {
|
||||
'tr.title as trip_title',
|
||||
'da.id as assignment_id',
|
||||
'd.date as date',
|
||||
'da.tour_stage_key as tour_stage_key',
|
||||
eb
|
||||
.selectFrom('assignment_participants as ap')
|
||||
.select(eb.fn.countAll<number>().as('n'))
|
||||
|
||||
Reference in New Issue
Block a user