Fix KeyError at /children/x/reports/sleep/pattern/

This commit is contained in:
Marco H 2022-04-18 05:03:46 +02:00 committed by Christopher Charbonneau Wells
parent 767dac44f4
commit 1d5780154e
1 changed files with 2 additions and 0 deletions

View File

@ -190,6 +190,8 @@ def _add_adjustment(adjustment, days):
:param blocks: List of days :param blocks: List of days
""" """
column = adjustment.pop("column") column = adjustment.pop("column")
if not column in days:
days[column] = []
# Fake (0) entry to keep the color switching logic working. # Fake (0) entry to keep the color switching logic working.
days[column].append({"time": 0, "label": 0}) days[column].append({"time": 0, "label": 0})