Currently OpenTracks recalculates aggregated seasonal stats each time the stats page is rendered which can lead to unnecessary computational overhead especially when dealing with large amounts of data. To optimize the performance we can implement a caching mechanism for aggregated seasonal stats.
Proposed Solution
Store previously calculated aggregated seasonal stats
When rending the page, first check if cached stats exist and are still valid
If valid stats are found then use them to calculate new stats instead of recalculating from scratch
Update the stored data with the new calculated data
Alternatives
An alternative approach could involve lazy loading of stats where stats are only recalculated when specifically requested by the user
Completeness Requirements
Cached aggregated seasonal stats are used when rendering the stats page
Cached stats are updated appropriately when new stats are added or modified
Feature Request
Proposed Solution
Alternatives
Completeness Requirements
Additional context