You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm getting a key error when accessing the sleep pattern.
I'm using the current version from docker hub, but I'm using data I've migrated from an older version (can't say which version, probably from around March 2020.
Environment:
Request Method: GET
Request URL: http://babybuddy/children/XXX/reports/sleep/pattern/
Django Version: 3.2
Python Version: 3.8.9
Installed Applications:
['api',
'babybuddy',
'core',
'dashboard',
'reports',
'django_filters',
'rest_framework',
'rest_framework.authtoken',
'widget_tweaks',
'easy_thumbnails',
'storages',
'import_export',
'django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
'django.contrib.humanize']
Installed Middleware:
['django.middleware.security.SecurityMiddleware',
'whitenoise.middleware.WhiteNoiseMiddleware',
'django.contrib.sessions.middleware.SessionMiddleware',
'babybuddy.middleware.RollingSessionMiddleware',
'django.middleware.locale.LocaleMiddleware',
'babybuddy.middleware.UserTimezoneMiddleware',
'django.middleware.common.CommonMiddleware',
'django.middleware.csrf.CsrfViewMiddleware',
'django.contrib.auth.middleware.AuthenticationMiddleware',
'django.contrib.messages.middleware.MessageMiddleware',
'django.middleware.clickjacking.XFrameOptionsMiddleware']
Traceback (most recent call last):
File "/usr/local/lib/python3.8/site-packages/django/core/handlers/exception.py", line 47, in inner
response = get_response(request)
File "/usr/local/lib/python3.8/site-packages/django/core/handlers/base.py", line 181, in _get_response
response = wrapped_callback(request, *callback_args, **callback_kwargs)
File "/usr/local/lib/python3.8/site-packages/django/views/generic/base.py", line 70, in view
return self.dispatch(request, *args, **kwargs)
File "/usr/local/lib/python3.8/site-packages/django/contrib/auth/mixins.py", line 104, in dispatch
return super().dispatch(request, *args, **kwargs)
File "/usr/local/lib/python3.8/site-packages/django/views/generic/base.py", line 98, in dispatch
return handler(request, *args, **kwargs)
File "/usr/local/lib/python3.8/site-packages/django/views/generic/detail.py", line 107, in get
context = self.get_context_data(object=self.object)
File "/app/reports/views.py", line 131, in get_context_data
context['html'], context['js'] = graphs.sleep_pattern(instances)
File "/app/reports/graphs/sleep_pattern.py", line 88, in sleep_pattern
times[yesterday][len(times[yesterday]) - 1] = duration.seconds/60
Exception Type: KeyError at /children/XXX/reports/sleep/pattern/
Exception Value: '2020-10-23'
Looks like a regression caused by e6838a0 (for #198). That sleep pattern code is unfortunately pretty messy and tough to maintain. I'll take a look when I can.
Glad you were able to work it out. Sorry that I haven't a chance to dig in on this yet. At this rate I'll be to the DST change before I really look at it 😭
I'm getting a key error when accessing the sleep pattern.
I'm using the current version from docker hub, but I'm using data I've migrated from an older version (can't say which version, probably from around March 2020.
Relevant local variables:
The text was updated successfully, but these errors were encountered: