Fix error where a blank topset was rendered for a empty workout

This commit is contained in:
Peter Stockings
2022-12-03 17:55:51 +11:00
parent d9d2dc01a5
commit afeba8a244
2 changed files with 2 additions and 2 deletions

View File

@@ -89,7 +89,7 @@
<span class="text-gray-500 font-semibold">{{ date.day }}</span>
</div>
<div class="bottom flex-grow h-30 py-1 w-full">
{% if workout %}
{% if workout['TopSets']|length > 0 %}
{% for topset in workout['TopSets'] %}
<button class="flex items-center flex-shrink-0 h-5 px-1 text-xs">
<span class="ml-2 font-medium leading-none truncate">{{ topset['ExerciseName'] }}</span>

View File

@@ -15,7 +15,7 @@ def get_workouts(topsets):
workouts.append({
'WorkoutId': workout_id,
'StartDate': topsets_in_workout[0]['StartDate'],
'TopSets': [{"TopSetId": t['TopSetId'], "ExerciseId": t['ExerciseId'], "ExerciseName": t['ExerciseName'], "Weight": t['Weight'], "Repetitions": t['Repetitions']} for t in topsets_in_workout]
'TopSets': [{"TopSetId": t['TopSetId'], "ExerciseId": t['ExerciseId'], "ExerciseName": t['ExerciseName'], "Weight": t['Weight'], "Repetitions": t['Repetitions']} for t in topsets_in_workout if t['TopSetId'] is not None]
})
return workouts