Skip to content

armgit / wger

Public Imported from GitHub
0

Self hosted FLOSS fitness/workout, nutrition and weight tracker

Check that both the entry and the max variant are set

Roland Geidere4fd8995a0af
diff --git a/wger/manager/models/slot_entry.py b/wger/manager/models/slot_entry.py
index 15b5a2ab9..2105d2f5b 100644
--- a/wger/manager/models/slot_entry.py
+++ b/wger/manager/models/slot_entry.py
@@ -251,18 +251,18 @@ class SlotEntry(models.Model):
exercise=self.exercise.id,
sets=sets if sets is not None else 1,
weight=weight,
- max_weight=max_weight if max_weight and max_weight > weight else None,
+ max_weight=max_weight if max_weight and weight and max_weight > weight else None,
weight_rounding=self.weight_rounding if weight is not None else None,
# weight_unit=self.weight_unit.pk if weight is not None else None,
weight_unit=self.weight_unit.pk,
reps=reps,
- max_reps=max_reps if max_reps and max_reps > reps else None,
+ max_reps=max_reps if max_reps and reps and max_reps > reps else None,
reps_rounding=self.repetition_rounding if reps is not None else None,
reps_unit=self.repetition_unit.pk,
# reps_unit=self.repetition_unit.pk if reps is not None else None,
rir=self.get_rir(iteration),
rest=rest,
- max_rest=max_rest if max_rest and max_rest > rest else None,
+ max_rest=max_rest if max_rest and rest and max_rest > rest else None,
type=str(self.type),
comment=self.comment,
)