hodooor / Hodoor

Server side for Hodoor - Casual attendance system
GNU General Public License v3.0
8 stars 6 forks source link

End of month ZeroDivisionError #51

Open OndrejVicar opened 7 years ago

OndrejVicar commented 7 years ago

Bug that appears when num_of_workdays == num_of_elapsed_workdays

ZeroDivisionError at /user/ondrej.vicar/
float division by zero
Request Method: GET
Request URL:    https://hodoor.eledus.cz/user/ondrej.vicar/
Django Version: 1.9.6
Exception Type: ZeroDivisionError
Exception Value:    
float division by zero
Exception Location: /home/ondrej.vicar/sites/hodoor.eledus.cz/source/ticker/../attendance/views.py in user, line 138
Python Executable:  /usr/bin/python3
Python Version: 3.4.2
Python Path:    
['/home/ondrej.vicar/sites/hodoor.eledus.cz',
 '/home/ondrej.vicar/sites/hodoor.eledus.cz/virtualenv/lib/python3.4/site-packages',
 '/usr/lib/python3.4',
 '/usr/lib/python3.4/plat-x86_64-linux-gnu',
 '/usr/lib/python3.4/lib-dynload',
 '/usr/local/lib/python3.4/dist-packages',
 '/usr/lib/python3/dist-packages',
 '/home/ondrej.vicar/sites/hodoor.eledus.cz/source/ticker/..',
 '/home/ondrej.vicar/sites/hodoor.eledus.cz/source/ticker/../ticker']
Server time:    Sun, 30 Apr 2017 11:51:20 +0200

This is problematic line: ticker/../attendance/views.py

avg_work_hours_fullfill_quota = (hours_quota - unassigned_closed_session_hours - hours_work_this_month) / (num_of_workdays - num_of_elapsed_workdays)
patriczek2811 commented 7 years ago

I acctually saw this problem 5mins ago on localhost. Yeah this is really a problem. We can try to fix it by our new python programmers.

simonabrejcakova commented 6 years ago

@OndrejVicar merged