Use pretty_hours()
function where applicable
This commit is contained in:
parent
ca4d15f06c
commit
43a3b8ae0a
|
@ -33,6 +33,7 @@ import sqlalchemy as sa
|
||||||
from rattail import enum
|
from rattail import enum
|
||||||
from rattail.db import model, api
|
from rattail.db import model, api
|
||||||
from rattail.time import localtime, make_utc, get_sunday
|
from rattail.time import localtime, make_utc, get_sunday
|
||||||
|
from rattail.util import pretty_hours
|
||||||
|
|
||||||
import formencode as fe
|
import formencode as fe
|
||||||
from pyramid_simpleform import Form
|
from pyramid_simpleform import Form
|
||||||
|
@ -396,15 +397,13 @@ class TimeSheetView(View):
|
||||||
|
|
||||||
hours = empday['{}_hours'.format(shift_type)]
|
hours = empday['{}_hours'.format(shift_type)]
|
||||||
if hours:
|
if hours:
|
||||||
minutes = (hours.days * 1440) + (hours.seconds / 60)
|
empday['{}_hours_display'.format(shift_type)] = pretty_hours(hours)
|
||||||
empday['{}_hours_display'.format(shift_type)] = '{}:{:02d}'.format(minutes // 60, minutes % 60)
|
|
||||||
employee.weekdays[i].update(empday)
|
employee.weekdays[i].update(empday)
|
||||||
|
|
||||||
hours = getattr(employee, '{}_hours'.format(shift_type))
|
hours = getattr(employee, '{}_hours'.format(shift_type))
|
||||||
if hours:
|
if hours:
|
||||||
minutes = (hours.days * 1440) + (hours.seconds / 60)
|
|
||||||
setattr(employee, '{}_hours_display'.format(shift_type),
|
setattr(employee, '{}_hours_display'.format(shift_type),
|
||||||
'{}:{:02d}'.format(minutes // 60, minutes % 60))
|
pretty_hours(hours))
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def defaults(cls, config):
|
def defaults(cls, config):
|
||||||
|
|
Loading…
Reference in a new issue