Skip to content

armgit / wger

Public Imported from GitHub
0

Self hosted FLOSS fitness/workout, nutrition and weight tracker

Sort day list by weekday

Roland Geider8bd5e5faafec
diff --git a/wger/manager/models.py b/wger/manager/models.py
index 2b2f3d121..612347d4e 100644
--- a/wger/manager/models.py
+++ b/wger/manager/models.py
@@ -117,7 +117,12 @@ class Workout(models.Model):
day_canonical_repr = []
muscles_front = []
muscles_back = []
- for day in self.day_set.select_related():
+
+ # Sort list by weekday
+ day_list = [i for i in self.day_set.select_related()]
+ day_list.sort(key=lambda day: day.get_first_day_id)
+
+ for day in day_list:
canonical_repr_day = day.get_canonical_representation()
# Collect all muscles