[templates] Fix geolocation templates
This commit is contained in:
@ -11,11 +11,18 @@ def natural_duration(value):
|
|||||||
total_minutes = int(value / 60)
|
total_minutes = int(value / 60)
|
||||||
hours = int(total_minutes / 60)
|
hours = int(total_minutes / 60)
|
||||||
minutes = total_minutes - (hours * 60)
|
minutes = total_minutes - (hours * 60)
|
||||||
|
seconds = value % 60
|
||||||
value_str = ""
|
value_str = ""
|
||||||
|
if seconds:
|
||||||
|
value_str = f"{seconds} seconds"
|
||||||
if minutes:
|
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 hours:
|
||||||
if not value_str:
|
if value_str:
|
||||||
return f"{hours} hours"
|
value_str = f"{hours} hours, " + value_str
|
||||||
value_str = f"{hours} hours, " + value_str
|
else:
|
||||||
|
value_str = f"{hours} hours"
|
||||||
return value_str
|
return value_str
|
||||||
|
|||||||
@ -12,6 +12,9 @@
|
|||||||
{% if object_list.0.domain %}
|
{% if object_list.0.domain %}
|
||||||
<th scope="col">Domain</th>
|
<th scope="col">Domain</th>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
{% if object_list.0.lat %}
|
||||||
|
<th scope="col">Movement</th>
|
||||||
|
{% endif %}
|
||||||
<th scope="col">Scrobbles</th>
|
<th scope="col">Scrobbles</th>
|
||||||
<th scope="col">Start</th>
|
<th scope="col">Start</th>
|
||||||
</tr>
|
</tr>
|
||||||
|
|||||||
@ -58,18 +58,7 @@
|
|||||||
|
|
||||||
<div class="col-md">
|
<div class="col-md">
|
||||||
<div class="table-responsive">
|
<div class="table-responsive">
|
||||||
<table class="table table-striped table-sm">
|
{% include "_scrobblable_list.html" %}
|
||||||
<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>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|||||||
@ -3,10 +3,12 @@
|
|||||||
<tr {% if scrobble.in_progress %}class="in-progress"{% endif %}>
|
<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.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>
|
<td>
|
||||||
{% if scrobble.media_type == "Task" %}
|
{% 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>
|
<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 %}
|
{% 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 %}
|
{% endif %}
|
||||||
</td>
|
</td>
|
||||||
<td>{{scrobble.elapsed_time|natural_duration}}</td>
|
<td>{{scrobble.elapsed_time|natural_duration}}</td>
|
||||||
|
|||||||
Reference in New Issue
Block a user