Skip to content
Snippets Groups Projects
Commit ef9c473d authored by Nils Steinger's avatar Nils Steinger
Browse files

Show AK duration in time-like format, not decimal format

parent 79b07e16
No related branches found
No related tags found
No related merge requests found
...@@ -336,6 +336,15 @@ class AKSlot(models.Model): ...@@ -336,6 +336,15 @@ class AKSlot(models.Model):
return f"{self.ak} @ {self.start_simplified} in {self.room}" return f"{self.ak} @ {self.start_simplified} in {self.room}"
return f"{self.ak} @ {self.start_simplified}" return f"{self.ak} @ {self.start_simplified}"
@property
def duration_simplified(self):
"""
Display duration of slot in format hours:minutes, e.g. 1.5 -> "1:30"
"""
hours = int(self.duration)
minutes = (self.duration * 60) % 60
return '%d:%02d' % (hours, minutes)
@property @property
def start_simplified(self): def start_simplified(self):
""" """
......
...@@ -185,7 +185,7 @@ ...@@ -185,7 +185,7 @@
<tbody> <tbody>
{% for slot in ak.akslot_set.all %} {% for slot in ak.akslot_set.all %}
<tr> <tr>
<td>{{ slot.duration }}</td> <td>{{ slot.duration_simplified }}</td>
{% if not ak.event.plan_hidden or user.is_staff %} {% if not ak.event.plan_hidden or user.is_staff %}
<td>{{ slot.time_simplified }}</td> <td>{{ slot.time_simplified }}</td>
<td> <td>
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment