2
0
Fork 0

Append 'h' to shift duration

This commit is contained in:
Luca 2023-05-08 12:16:40 +02:00
parent 3957c659e6
commit 8f22997ac1
3 changed files with 6 additions and 4 deletions

View File

@ -1,4 +1,5 @@
{% load shift_extras %} {% load shift_extras %}
<div class="column is-one-quarter"> <div class="column is-one-quarter">
<div class="box"> <div class="box">
<div class="content"> <div class="content">

View File

@ -1,4 +1,5 @@
{% extends "helper_base.html" %} {% extends "helper_base.html" %}
{% load shift_extras %} {% load shift_extras %}
{% block title %}Schichtansicht{% endblock %} {% block title %}Schichtansicht{% endblock %}

View File

@ -5,8 +5,8 @@ register = template.Library()
@register.filter(name="duration") @register.filter(name="duration")
def duration(value): def duration(value):
secs = value.total_seconds() secs = int(value.total_seconds())
hours = int(secs // (60 * 60)) hours = secs // (60 * 60)
secs = secs % (hours * 60 * 60) secs = secs % (hours * 60 * 60)
minutes = int(secs // 60) minutes = secs // 60
return f"{hours}:{minutes:02d}" return f"{hours}:{minutes:02d}h"