Add "?" for daily time sheet total if partial shift present

This commit is contained in:
Lance Edgar 2018-07-10 17:45:33 -05:00
parent 16ab8b6ffa
commit 699536b1ab

View file

@ -442,6 +442,7 @@ class TimeSheetView(View):
'{}_shifts'.format(shift_type): [],
'{}_hours'.format(shift_type): datetime.timedelta(0),
'{}_hours_display'.format(shift_type): '',
'hours_incomplete': False,
}
while employee_shifts:
@ -457,6 +458,7 @@ class TimeSheetView(View):
getattr(employee, '{}_hours'.format(shift_type)) + shift.length)
else:
hours_incomplete = True
empday['hours_incomplete'] = True
del employee_shifts[0]
else:
break
@ -464,9 +466,12 @@ class TimeSheetView(View):
hours = empday['{}_hours'.format(shift_type)]
if hours:
if hours_style == 'pretty':
empday['{}_hours_display'.format(shift_type)] = pretty_hours(hours)
display = pretty_hours(hours)
else: # decimal
empday['{}_hours_display'.format(shift_type)] = six.text_type(hours_as_decimal(hours))
display = six.text_type(hours_as_decimal(hours))
if empday['hours_incomplete']:
display = '{} ?'.format(display)
empday['{}_hours_display'.format(shift_type)] = display
employee.weekdays[i].update(empday)
hours = getattr(employee, '{}_hours'.format(shift_type))