From fd0760ed07f6639c5136894c14ceadfb0603c6dc Mon Sep 17 00:00:00 2001 From: Lance Edgar Date: Fri, 12 Oct 2018 19:05:14 -0500 Subject: [PATCH] Add "hours as decimal" hover text for some HH:MM timesheet values hoping this helps with random troubleshooting... --- tailbone/helpers.py | 4 ++-- tailbone/templates/shifts/timesheet.mako | 2 +- tailbone/views/shifts/core.py | 5 +++-- 3 files changed, 6 insertions(+), 5 deletions(-) diff --git a/tailbone/helpers.py b/tailbone/helpers.py index 67e90fb5..a21eb0bd 100644 --- a/tailbone/helpers.py +++ b/tailbone/helpers.py @@ -2,7 +2,7 @@ ################################################################################ # # Rattail -- Retail Software Framework -# Copyright © 2010-2017 Lance Edgar +# Copyright © 2010-2018 Lance Edgar # # This file is part of Rattail. # @@ -30,7 +30,7 @@ import datetime from decimal import Decimal 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.tags import * diff --git a/tailbone/templates/shifts/timesheet.mako b/tailbone/templates/shifts/timesheet.mako index 45e103c0..562cdb35 100644 --- a/tailbone/templates/shifts/timesheet.mako +++ b/tailbone/templates/shifts/timesheet.mako @@ -21,7 +21,7 @@ <%def name="render_employee_day_total(day)"> - ${day['worked_hours_display']} + ${day['worked_hours_display']} diff --git a/tailbone/views/shifts/core.py b/tailbone/views/shifts/core.py index 7bd56752..1bf4ebc6 100644 --- a/tailbone/views/shifts/core.py +++ b/tailbone/views/shifts/core.py @@ -34,7 +34,7 @@ from rattail.db import model from rattail.time import localtime 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 @@ -44,7 +44,8 @@ def render_shift_length(shift, field): return "" if shift.end_time < shift.start_time: 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):