From 8e84a4909ec3de2360e8009e676c940cb117a7f6 Mon Sep 17 00:00:00 2001 From: Tobias Reiher <15232394+treiher@users.noreply.github.com> Date: Sat, 30 Nov 2024 13:31:31 +0100 Subject: [PATCH] Fix order of training sessions on training page --- CHANGELOG.md | 1 + frontend/src/ui/page/training.rs | 3 ++- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index c0248fe..d7d3fb1 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -32,6 +32,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Fixed - Reject trainings, body weight, body fat and period entries in the future +- Order of training sessions on training page ## [0.4.1] - 2024-05-20 diff --git a/frontend/src/ui/page/training.rs b/frontend/src/ui/page/training.rs index 43b0806..2f51fa8 100644 --- a/frontend/src/ui/page/training.rs +++ b/frontend/src/ui/page/training.rs @@ -252,11 +252,12 @@ pub fn view(model: &Model, data_model: &data::Model) -> Node { }) .copied() .collect::>(); - let training_sessions = data_model + let mut training_sessions = data_model .training_sessions .values() .filter(|t| t.date >= model.interval.first && t.date <= model.interval.last) .collect::>(); + training_sessions.sort_by_key(|t| t.date); let training_sessions_interval: common::Interval = data_model.training_sessions_date_range().into(); div![