Skip to content

Commit

Permalink
Check that the last weight entry has actually a weight before dividing
Browse files Browse the repository at this point in the history
Closes #716
  • Loading branch information
rolandgeider committed Jul 13, 2021
1 parent 82cf124 commit 67b82da
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
3 changes: 2 additions & 1 deletion docs/changelog.rst
Expand Up @@ -29,11 +29,12 @@ Upgrade steps from 2.0:
+ /workout/
- ``comment`` was renamed to name
- field ``description`` was added, for longer descriptions
* `#666`_, `#656`_ (thanks `@jackmulligan-ire`_),
* `#666`_, `#656`_ (thanks `@jackmulligan-ire`_), `#716`_

.. _#572: https://github.com/wger-project/wger/issues/572
.. _#656: https://github.com/wger-project/wger/issues/656
.. _#666: https://github.com/wger-project/wger/issues/666
.. _#716: https://github.com/wger-project/wger/issues/716

.. _@jackmulligan-ire: https://github.com/jackmulligan-ire

Expand Down
2 changes: 1 addition & 1 deletion wger/nutrition/models/plan.py
Expand Up @@ -147,7 +147,7 @@ def get_nutritional_values(self):

# Per body weight
weight_entry = self.get_closest_weight_entry()
if weight_entry:
if weight_entry and weight_entry.weight:
for key in result['per_kg'].keys():
result['per_kg'][key] = result['total'][key] / weight_entry.weight

Expand Down

0 comments on commit 67b82da

Please sign in to comment.