dgtlmoon / changedetection.io

The best and simplest free open source web page change detection, website watcher, restock monitor and notification service. Restock Monitor, change detection. Designed for simplicity - Simply monitor which websites had a text change for free. Free Open source web page change detection, Website defacement monitoring, Price change notification
https://changedetection.io
Apache License 2.0
17.3k stars 965 forks source link

[ui] sorting by # in all group leads to internal server error #1775

Closed c-jaenicke closed 1 year ago

c-jaenicke commented 1 year ago

Describe the bug Sorting by #/date_created in the all group leads to internal error. Sorting by #/date_created in any other group works, but after doing that and going back to all it breaks.

Clearing the cache resets the sorting and fixes the problem until you sort by #/date_created again.

Version v0.45.1

To Reproduce

Steps to reproduce the behavior:

  1. Open overview page / all group
  2. Click on # to sort by date_created
  3. See error Internal Server Error

2nd way:

  1. Open any group
  2. Click on # to sort by date_created
  3. Go to all group
  4. See error Internal Server Error

Expected behavior Should load the all group sorted by date.

Additional context

Docker container logs:

ERROR:changedetectionio:Exception on / [GET]
Traceback (most recent call last):
  File "/usr/local/flask/app.py", line 2073, in wsgi_app
    response = self.full_dispatch_request()
  File "/usr/local/flask/app.py", line 1519, in full_dispatch_request
    rv = self.handle_user_exception(e)
  File "/usr/local/flask_restful/__init__.py", line 298, in error_router
    return original_handler(e)
  File "/usr/local/flask/app.py", line 1517, in full_dispatch_request
    rv = self.dispatch_request()
  File "/usr/local/flask/app.py", line 1503, in dispatch_request
    return self.ensure_sync(self.view_functions[rule.endpoint])(**req.view_args)
  File "/app/changedetectionio/__init__.py", line 208, in decorated_view
    return func(*args, **kwargs)
  File "/app/changedetectionio/__init__.py", line 441, in index
    output = render_template(
  File "/usr/local/flask/templating.py", line 154, in render_template
    return _render(
  File "/usr/local/flask/templating.py", line 128, in _render
    rv = template.render(context)
  File "/usr/local/jinja2/environment.py", line 1301, in render
    self.environment.handle_exception()
  File "/usr/local/jinja2/environment.py", line 936, in handle_exception
    raise rewrite_traceback_stack(source=source)
  File "/app/changedetectionio/templates/watch-overview.html", line 1, in top-level template code
    {% extends 'base.html' %}
  File "/app/changedetectionio/templates/base.html", line 154, in top-level template code
    {% block content %}{% endblock %}
  File "/app/changedetectionio/templates/watch-overview.html", line 84, in block 'content'
    {% for watch in (watches|sort(attribute=sort_attribute, reverse=sort_order == 'asc'))|pagination_slice(skip=pagination.skip) %}
  File "/usr/local/jinja2/filters.py", line 409, in do_sort
    return sorted(value, key=key_func, reverse=reverse)
TypeError: '<' not supported between instances of 'int' and 'NoneType'
dgtlmoon commented 1 year ago

thanks for the report!

dgtlmoon commented 1 year ago

looks like update 11 didnt run correctly - https://github.com/dgtlmoon/changedetection.io/commit/0aa2276afbbe336148226338c68a237090b73787

fixed as a new update

c-jaenicke commented 1 year ago

Just tested locally, can confirm sorting works now.

Thank you

dgtlmoon commented 1 year ago

This one should only affect people who have watches since before the "update 11"