Add "?" for daily time sheet total if partial shift present
This commit is contained in:
parent
16ab8b6ffa
commit
699536b1ab
|
@ -442,6 +442,7 @@ class TimeSheetView(View):
|
||||||
'{}_shifts'.format(shift_type): [],
|
'{}_shifts'.format(shift_type): [],
|
||||||
'{}_hours'.format(shift_type): datetime.timedelta(0),
|
'{}_hours'.format(shift_type): datetime.timedelta(0),
|
||||||
'{}_hours_display'.format(shift_type): '',
|
'{}_hours_display'.format(shift_type): '',
|
||||||
|
'hours_incomplete': False,
|
||||||
}
|
}
|
||||||
|
|
||||||
while employee_shifts:
|
while employee_shifts:
|
||||||
|
@ -457,6 +458,7 @@ class TimeSheetView(View):
|
||||||
getattr(employee, '{}_hours'.format(shift_type)) + shift.length)
|
getattr(employee, '{}_hours'.format(shift_type)) + shift.length)
|
||||||
else:
|
else:
|
||||||
hours_incomplete = True
|
hours_incomplete = True
|
||||||
|
empday['hours_incomplete'] = True
|
||||||
del employee_shifts[0]
|
del employee_shifts[0]
|
||||||
else:
|
else:
|
||||||
break
|
break
|
||||||
|
@ -464,9 +466,12 @@ class TimeSheetView(View):
|
||||||
hours = empday['{}_hours'.format(shift_type)]
|
hours = empday['{}_hours'.format(shift_type)]
|
||||||
if hours:
|
if hours:
|
||||||
if hours_style == 'pretty':
|
if hours_style == 'pretty':
|
||||||
empday['{}_hours_display'.format(shift_type)] = pretty_hours(hours)
|
display = pretty_hours(hours)
|
||||||
else: # decimal
|
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)
|
employee.weekdays[i].update(empday)
|
||||||
|
|
||||||
hours = getattr(employee, '{}_hours'.format(shift_type))
|
hours = getattr(employee, '{}_hours'.format(shift_type))
|
||||||
|
|
Loading…
Reference in a new issue