Fix error where a blank topset was rendered for a empty workout
This commit is contained in:
@@ -89,7 +89,7 @@
|
|||||||
<span class="text-gray-500 font-semibold">{{ date.day }}</span>
|
<span class="text-gray-500 font-semibold">{{ date.day }}</span>
|
||||||
</div>
|
</div>
|
||||||
<div class="bottom flex-grow h-30 py-1 w-full">
|
<div class="bottom flex-grow h-30 py-1 w-full">
|
||||||
{% if workout %}
|
{% if workout['TopSets']|length > 0 %}
|
||||||
{% for topset in workout['TopSets'] %}
|
{% for topset in workout['TopSets'] %}
|
||||||
<button class="flex items-center flex-shrink-0 h-5 px-1 text-xs">
|
<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>
|
<span class="ml-2 font-medium leading-none truncate">{{ topset['ExerciseName'] }}</span>
|
||||||
|
|||||||
2
utils.py
2
utils.py
@@ -15,7 +15,7 @@ def get_workouts(topsets):
|
|||||||
workouts.append({
|
workouts.append({
|
||||||
'WorkoutId': workout_id,
|
'WorkoutId': workout_id,
|
||||||
'StartDate': topsets_in_workout[0]['StartDate'],
|
'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
|
return workouts
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user