Add trailing '?' for employee time sheet when hours are incomplete

This commit is contained in:
Lance Edgar 2017-03-14 12:31:10 -05:00
parent 693c2dce57
commit 9a8fa43c6a

View file

@ -372,6 +372,7 @@ class TimeSheetView(View):
employee.weekdays = [{} for day in weekdays]
setattr(employee, '{}_hours'.format(shift_type), datetime.timedelta(0))
setattr(employee, '{}_hours_display'.format(shift_type), '0')
hours_incomplete = False
for i, day in enumerate(weekdays):
empday = {
@ -391,6 +392,8 @@ class TimeSheetView(View):
empday['{}_hours'.format(shift_type)] += shift.length
setattr(employee, '{}_hours'.format(shift_type),
getattr(employee, '{}_hours'.format(shift_type)) + shift.length)
else:
hours_incomplete = True
del employee_shifts[0]
else:
break
@ -402,8 +405,10 @@ class TimeSheetView(View):
hours = getattr(employee, '{}_hours'.format(shift_type))
if hours:
setattr(employee, '{}_hours_display'.format(shift_type),
pretty_hours(hours))
display = pretty_hours(hours)
if hours_incomplete:
display = '{} ?'.format(display)
setattr(employee, '{}_hours_display'.format(shift_type), display)
@classmethod
def defaults(cls, config):