Tracker: sort Last Activity numerically, instead of text.
This commit is contained in:
parent
f870bb3fad
commit
d1fd1cd788
|
@ -17,6 +17,27 @@ window.addEventListener('load', () => {
|
||||||
paging: false,
|
paging: false,
|
||||||
info: false,
|
info: false,
|
||||||
dom: "t",
|
dom: "t",
|
||||||
|
columnDefs: [
|
||||||
|
{
|
||||||
|
targets: 'hours',
|
||||||
|
render: function (data, type, row) {
|
||||||
|
if (type === "sort" || type === 'type') {
|
||||||
|
if (data === "None")
|
||||||
|
return -1
|
||||||
|
|
||||||
|
return parseInt(data);
|
||||||
|
}
|
||||||
|
if (data === "None")
|
||||||
|
return data
|
||||||
|
|
||||||
|
var hours = Math.floor(data / 3600);
|
||||||
|
var minutes = Math.floor((data - (hours * 3600)) / 60);
|
||||||
|
|
||||||
|
if (minutes < 10) {minutes = "0"+minutes;}
|
||||||
|
return hours+':'+minutes;
|
||||||
|
}
|
||||||
|
},
|
||||||
|
],
|
||||||
|
|
||||||
// DO NOT use the scrollX or scrollY options. They cause DataTables to split the thead from
|
// DO NOT use the scrollX or scrollY options. They cause DataTables to split the thead from
|
||||||
// the tbody and render two separate tables.
|
// the tbody and render two separate tables.
|
||||||
|
|
|
@ -98,7 +98,7 @@
|
||||||
<th colspan="{{ colspan }}" class="center-column">{{ area }}</th>
|
<th colspan="{{ colspan }}" class="center-column">{{ area }}</th>
|
||||||
{%- endif -%}
|
{%- endif -%}
|
||||||
{%- endfor -%}
|
{%- endfor -%}
|
||||||
<th rowspan="2" class="center-column">Last<br>Activity</th>
|
<th rowspan="2" class="center-column hours">Last<br>Activity</th>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
{% for area in ordered_areas %}
|
{% for area in ordered_areas %}
|
||||||
|
@ -141,7 +141,7 @@
|
||||||
{%- endif -%}
|
{%- endif -%}
|
||||||
{%- endfor -%}
|
{%- endfor -%}
|
||||||
{%- if activity_timers[(team, player)] -%}
|
{%- if activity_timers[(team, player)] -%}
|
||||||
<td class="center-column">{{ activity_timers[(team, player)] | render_timedelta }}</td>
|
<td class="center-column">{{ activity_timers[(team, player)].total_seconds() }}</td>
|
||||||
{%- else -%}
|
{%- else -%}
|
||||||
<td class="center-column">None</td>
|
<td class="center-column">None</td>
|
||||||
{%- endif -%}
|
{%- endif -%}
|
||||||
|
|
Loading…
Reference in New Issue