Private
Public Access
1
0

ranking pieces in reverse chronological order on CP view

This commit is contained in:
Sander Roosendaal
2018-02-27 16:15:00 +01:00
parent 5709669dc5
commit 8e0de9163f
3 changed files with 31 additions and 17 deletions

View File

@@ -24,14 +24,16 @@ def do_update(user,mode='rower',days=42):
now_date = timezone.now().strftime('%Y-%m-%d')
ms = PowerTimeFitnessMetric.objects.filter(
user=user,
workoutmode=mode)
workoutmode=mode).order_by("-date")
if len(ms) == 0:
max_workout_id = 0
last_update_date = '1972-01-01'
else:
max_workout_id = max([m.last_workout for m in ms])
last_update_date = max([m.date.strftime('%Y-%m-%d') for m in ms])
last_update_date = ms[0].date.strftime('%Y-%m-%d')
#last_update_date = max([m.date.strftime('%Y-%m-%d') for m in ms])