[templates] Fix geolocation templates
All checks were successful
build & deploy / test (push) Successful in 1m59s
build & deploy / build-and-deploy (push) Successful in 37s

This commit is contained in:
2026-05-01 20:50:24 -04:00
parent 9d519138aa
commit 5175a9a39a
4 changed files with 20 additions and 19 deletions

View File

@ -11,11 +11,18 @@ def natural_duration(value):
total_minutes = int(value / 60)
hours = int(total_minutes / 60)
minutes = total_minutes - (hours * 60)
seconds = value % 60
value_str = ""
if seconds:
value_str = f"{seconds} seconds"
if minutes:
value_str = f"{minutes} minutes"
if value_str:
value_str = f"{minutes} minutes, " + value_str
else:
value_str = f"{minutes} minutes"
if hours:
if not value_str:
return f"{hours} hours"
value_str = f"{hours} hours, " + value_str
if value_str:
value_str = f"{hours} hours, " + value_str
else:
value_str = f"{hours} hours"
return value_str

View File

@ -12,6 +12,9 @@
{% if object_list.0.domain %}
<th scope="col">Domain</th>
{% endif %}
{% if object_list.0.lat %}
<th scope="col">Movement</th>
{% endif %}
<th scope="col">Scrobbles</th>
<th scope="col">Start</th>
</tr>

View File

@ -58,18 +58,7 @@
<div class="col-md">
<div class="table-responsive">
<table class="table table-striped table-sm">
<thead>
<tr>
<th scope="col">Scrobbles</th>
<th scope="col">Title</th>
<th scope="col">Point</th>
</tr>
</thead>
<tbody>
{% include "_scrobblable_list.html" %}
</tbody>
</table>
{% include "_scrobblable_list.html" %}
</div>
</div>

View File

@ -3,10 +3,12 @@
<tr {% if scrobble.in_progress %}class="in-progress"{% endif %}>
<td>{% if scrobble.in_progress %}<a href="{{scrobble.get_absolute_url}}">{{scrobble.media_obj.strings.verb}} now</a> | <a class="right" href="{% url "scrobbles:finish" scrobble.uuid %}">Finish</a>{% else %}<a href="{{scrobble.get_absolute_url}}">{{scrobble.local_timestamp|naturaltime}}</a>{% endif %}</td>
<td>
{% if scrobble.media_type == "Task" %}
<p><em><a href="{{scrobble.media_obj.get_absolute_url}}">{{scrobble.media_obj.title|truncatechars_html:45}} - {% if scrobble.logdata %}{% if scrobble.logdata.title%}{{scrobble.logdata.title}}{% endif %}{% endif %}</a></em></p>
{% if scrobble.media_type in "Task" %}
<p><em><a href="{{scrobble.media_obj.get_absolute_url}}">{{scrobble.media_obj.title|truncatechars_html:45}} - {% if scrobble.logdata %}{% if scrobble.logdata.title %}{{scrobble.logdata.title}}{% endif %}{% endif %}</a></em></p>
{% elif scrobble.media_type == "GeoLocation" %}
<p><a href="{{scrobble.media_obj.get_absolute_url}}">{{scrobble.media_obj|truncatechars_html:45}} - {{scrobble.logdata.movement_type}}</a></>
{% else %}
<a href="{{scrobble.media_obj.get_absolute_url}}">{{scrobble.media_obj|truncatechars_html:45}}</a>
<p><a href="{{scrobble.media_obj.get_absolute_url}}">{{scrobble.media_obj|truncatechars_html:45}}</a></>
{% endif %}
</td>
<td>{{scrobble.elapsed_time|natural_duration}}</td>