milesmcc / shynet

Modern, privacy-friendly, and detailed web analytics that works without cookies or JS.
Apache License 2.0
2.93k stars 191 forks source link

Server error when defining a date range in sessions view #104

Closed seriousm4x closed 3 years ago

seriousm4x commented 3 years ago

When I open the sessions view and I define a date range, I get an error 500 (https://domain.com/dashboard/service/---id---/sessions/?startDate=2021-2-1&endDate=2021-2-20). Heres the log:

shynet_main | 2021-03-03T21:24:45.438365728Z ERROR Internal Server Error: /dashboard/service/---id---/sessions/
shynet_main | 2021-03-03T21:24:45.438400704Z Traceback (most recent call last):
shynet_main | 2021-03-03T21:24:45.438414460Z   File "/usr/local/lib/python3.9/site-packages/django/core/handlers/exception.py", line 47, in inner
shynet_main | 2021-03-03T21:24:45.438421012Z     response = get_response(request)
shynet_main | 2021-03-03T21:24:45.438426322Z   File "/usr/local/lib/python3.9/site-packages/django/core/handlers/base.py", line 202, in _get_response
shynet_main | 2021-03-03T21:24:45.438432163Z     response = response.render()
shynet_main | 2021-03-03T21:24:45.438437604Z   File "/usr/local/lib/python3.9/site-packages/django/template/response.py", line 105, in render
shynet_main | 2021-03-03T21:24:45.438443194Z     self.content = self.rendered_content
shynet_main | 2021-03-03T21:24:45.438448214Z   File "/usr/local/lib/python3.9/site-packages/django/template/response.py", line 83, in rendered_content
shynet_main | 2021-03-03T21:24:45.438453704Z     return template.render(context, self._request)
shynet_main | 2021-03-03T21:24:45.438458734Z   File "/usr/local/lib/python3.9/site-packages/django/template/backends/django.py", line 61, in render
shynet_main | 2021-03-03T21:24:45.438464625Z     return self.template.render(context)
shynet_main | 2021-03-03T21:24:45.438469845Z   File "/usr/local/lib/python3.9/site-packages/django/template/base.py", line 170, in render
shynet_main | 2021-03-03T21:24:45.438475054Z     return self._render(context)
shynet_main | 2021-03-03T21:24:45.438479994Z   File "/usr/local/lib/python3.9/site-packages/django/template/base.py", line 162, in _render
shynet_main | 2021-03-03T21:24:45.438498950Z     return self.nodelist.render(context)
shynet_main | 2021-03-03T21:24:45.438504180Z   File "/usr/local/lib/python3.9/site-packages/django/template/base.py", line 938, in render
shynet_main | 2021-03-03T21:24:45.438509309Z     bit = node.render_annotated(context)
shynet_main | 2021-03-03T21:24:45.438513978Z   File "/usr/local/lib/python3.9/site-packages/django/template/base.py", line 905, in render_annotated
shynet_main | 2021-03-03T21:24:45.438519298Z     return self.render(context)
shynet_main | 2021-03-03T21:24:45.438523917Z   File "/usr/local/lib/python3.9/site-packages/django/template/loader_tags.py", line 150, in render
shynet_main | 2021-03-03T21:24:45.438529197Z     return compiled_parent._render(context)
shynet_main | 2021-03-03T21:24:45.438534126Z   File "/usr/local/lib/python3.9/site-packages/django/template/base.py", line 162, in _render
shynet_main | 2021-03-03T21:24:45.438539326Z     return self.nodelist.render(context)
shynet_main | 2021-03-03T21:24:45.438544075Z   File "/usr/local/lib/python3.9/site-packages/django/template/base.py", line 938, in render
shynet_main | 2021-03-03T21:24:45.438549315Z     bit = node.render_annotated(context)
shynet_main | 2021-03-03T21:24:45.438554234Z   File "/usr/local/lib/python3.9/site-packages/django/template/base.py", line 905, in render_annotated
shynet_main | 2021-03-03T21:24:45.438559514Z     return self.render(context)
shynet_main | 2021-03-03T21:24:45.438564153Z   File "/usr/local/lib/python3.9/site-packages/django/template/loader_tags.py", line 150, in render
shynet_main | 2021-03-03T21:24:45.438570866Z     return compiled_parent._render(context)
shynet_main | 2021-03-03T21:24:45.438575795Z   File "/usr/local/lib/python3.9/site-packages/django/template/base.py", line 162, in _render
shynet_main | 2021-03-03T21:24:45.438580995Z     return self.nodelist.render(context)
shynet_main | 2021-03-03T21:24:45.438586064Z   File "/usr/local/lib/python3.9/site-packages/django/template/base.py", line 938, in render
shynet_main | 2021-03-03T21:24:45.438591525Z     bit = node.render_annotated(context)
shynet_main | 2021-03-03T21:24:45.438596915Z   File "/usr/local/lib/python3.9/site-packages/django/template/base.py", line 905, in render_annotated
shynet_main | 2021-03-03T21:24:45.438602395Z     return self.render(context)
shynet_main | 2021-03-03T21:24:45.438607455Z   File "/usr/local/lib/python3.9/site-packages/django/template/loader_tags.py", line 62, in render
shynet_main | 2021-03-03T21:24:45.438612725Z     result = block.nodelist.render(context)
shynet_main | 2021-03-03T21:24:45.438617434Z   File "/usr/local/lib/python3.9/site-packages/django/template/base.py", line 938, in render
shynet_main | 2021-03-03T21:24:45.438622624Z     bit = node.render_annotated(context)
shynet_main | 2021-03-03T21:24:45.438627473Z   File "/usr/local/lib/python3.9/site-packages/django/template/base.py", line 905, in render_annotated
shynet_main | 2021-03-03T21:24:45.438633073Z     return self.render(context)
shynet_main | 2021-03-03T21:24:45.438637692Z   File "/usr/local/lib/python3.9/site-packages/django/template/loader_tags.py", line 62, in render
shynet_main | 2021-03-03T21:24:45.438642601Z     result = block.nodelist.render(context)
shynet_main | 2021-03-03T21:24:45.438647461Z   File "/usr/local/lib/python3.9/site-packages/django/template/base.py", line 938, in render
shynet_main | 2021-03-03T21:24:45.438658632Z     bit = node.render_annotated(context)
shynet_main | 2021-03-03T21:24:45.438663782Z   File "/usr/local/lib/python3.9/site-packages/django/template/base.py", line 905, in render_annotated
shynet_main | 2021-03-03T21:24:45.438669052Z     return self.render(context)
shynet_main | 2021-03-03T21:24:45.438673841Z   File "/usr/local/lib/python3.9/site-packages/django/template/loader_tags.py", line 62, in render
shynet_main | 2021-03-03T21:24:45.438679070Z     result = block.nodelist.render(context)
shynet_main | 2021-03-03T21:24:45.438683799Z   File "/usr/local/lib/python3.9/site-packages/django/template/base.py", line 938, in render
shynet_main | 2021-03-03T21:24:45.438688919Z     bit = node.render_annotated(context)
shynet_main | 2021-03-03T21:24:45.438693628Z   File "/usr/local/lib/python3.9/site-packages/django/template/base.py", line 905, in render_annotated
shynet_main | 2021-03-03T21:24:45.438698748Z     return self.render(context)
shynet_main | 2021-03-03T21:24:45.438703607Z   File "/usr/local/lib/python3.9/site-packages/django/template/library.py", line 214, in render
shynet_main | 2021-03-03T21:24:45.438708847Z     _dict = self.func(*resolved_args, **resolved_kwargs)
shynet_main | 2021-03-03T21:24:45.438713836Z   File "/usr/src/shynet/a17t/templatetags/pagination.py", line 19, in pagination
shynet_main | 2021-03-03T21:24:45.438718956Z     [
shynet_main | 2021-03-03T21:24:45.438723595Z   File "/usr/src/shynet/a17t/templatetags/pagination.py", line 20, in <listcomp>
shynet_main | 2021-03-03T21:24:45.438729275Z     f"&{urlencode(key)}={urlencode(value)}"
shynet_main | 2021-03-03T21:24:45.438735157Z   File "/usr/local/lib/python3.9/site-packages/django/utils/http.py", line 114, in urlencode
shynet_main | 2021-03-03T21:24:45.438740417Z     for key, value in query:
shynet_main | 2021-03-03T21:24:45.438745236Z ValueError: not enough values to unpack (expected 2, got 1)
milesmcc commented 3 years ago

Fixed in v0.8.0. Good catch, and thanks!