Inter-Actief / amelie

De website van Inter-/Actief/. Vernoemd naar de film Amélie.
https://www.inter-actief.utwente.nl/
BSD 3-Clause "New" or "Revised" License
10 stars 5 forks source link

Division by Zero error in member statistics #892

Open Kurocon opened 2 months ago

Kurocon commented 2 months ago

When a date in the future (or in the past where no member data exists) is selected, a ZeroDivisionError is thrown on the member statistics page.

https://github.com/Inter-Actief/amelie/blob/6f36f1e71aff8815b9bbdc31fa22680d916c1c62/amelie/members/views.py#L128

ZeroDivisionError:float division by zero
File "django/core/handlers/exception.py", line 47, in inner
     response = get_response(request)
File "django/core/handlers/base.py", line 181, in _get_response
     response = wrapped_callback(request, *callback_args, **callback_kwargs)
File "amelie/tools/decorators.py", line 33, in _do_test_request
     return view_func(request, *args, **kwargs)
File "amelie/members/views.py", line 128, in statistics
     percent_active_members = '{0:.2f}'.format((active_members_count*100.0)/members_count)