Skip to content

Commit

Permalink
fix error if only a single measurement is present
Browse files Browse the repository at this point in the history
If only one measurement is present, the week_list will have a length of 0 thus invoking an error
  • Loading branch information
nlwach committed Apr 23, 2022
1 parent 6570c31 commit f88d1d9
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions gcampus/core/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -167,6 +167,8 @@ def get_measurements_per_week(
"""
if not measurement_list:
return []
if len(week_list) <= 1:
return []
measurements_per_week = [0] * (len(week_list) - 1)

for measurement_date in measurement_list:
Expand Down

0 comments on commit f88d1d9

Please sign in to comment.