Add "hours as decimal" hover text for some HH:MM timesheet values

hoping this helps with random troubleshooting...
This commit is contained in:
Lance Edgar 2018-10-12 19:05:14 -05:00
parent 9e065541b9
commit fd0760ed07
3 changed files with 6 additions and 5 deletions

View file

@ -2,7 +2,7 @@
################################################################################ ################################################################################
# #
# Rattail -- Retail Software Framework # Rattail -- Retail Software Framework
# Copyright © 2010-2017 Lance Edgar # Copyright © 2010-2018 Lance Edgar
# #
# This file is part of Rattail. # This file is part of Rattail.
# #
@ -30,7 +30,7 @@ import datetime
from decimal import Decimal from decimal import Decimal
from rattail.time import localtime, make_utc from rattail.time import localtime, make_utc
from rattail.util import pretty_quantity, pretty_hours from rattail.util import pretty_quantity, pretty_hours, hours_as_decimal
from webhelpers2.html import * from webhelpers2.html import *
from webhelpers2.html.tags import * from webhelpers2.html.tags import *

View file

@ -21,7 +21,7 @@
</%def> </%def>
<%def name="render_employee_day_total(day)"> <%def name="render_employee_day_total(day)">
${day['worked_hours_display']} <span title="${h.hours_as_decimal(day['worked_hours'])} hrs">${day['worked_hours_display']}</span>
</%def> </%def>

View file

@ -34,7 +34,7 @@ from rattail.db import model
from rattail.time import localtime from rattail.time import localtime
from rattail.util import pretty_hours, hours_as_decimal from rattail.util import pretty_hours, hours_as_decimal
from webhelpers2.html import tags from webhelpers2.html import tags, HTML
from tailbone.views import MasterView from tailbone.views import MasterView
@ -44,7 +44,8 @@ def render_shift_length(shift, field):
return "" return ""
if shift.end_time < shift.start_time: if shift.end_time < shift.start_time:
return "??" return "??"
return pretty_hours(shift.end_time - shift.start_time) length = shift.end_time - shift.start_time
return HTML.tag('span', title="{} hrs".format(hours_as_decimal(length)), c=[pretty_hours(length)])
class ScheduledShiftsView(MasterView): class ScheduledShiftsView(MasterView):