Skip to content

Commit

Permalink
Kasse i KASS: Show absolute time instead of total time since start
Browse files Browse the repository at this point in the history
  • Loading branch information
Mortal committed Jun 7, 2019
1 parent 8f7af00 commit 856b30c
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
10 changes: 9 additions & 1 deletion stopwatch/static/stopwatch/stopwatch.es6
Original file line number Diff line number Diff line change
Expand Up @@ -58,10 +58,18 @@ function update_time() {
function lap_element(index, duration, total, difference) {
const o = document.createElement('div');
o.className = 'lap';
let lapTotal = format_timestamp(total, 2);
if (is_kasse_i_kass) {
const time = new Date;
time.setTime(total + start_time);
const timeStr = time + "";
const match = /(\d+:\d+:\d+)/.exec(timeStr);
lapTotal = match && match[1];
}
let h = (
'<div class="lapIndex">Øl ' + index + '</div>' +
'<div class="lapDuration">' + format_timestamp(duration, 2) + '</div>' +
'<div class="lapTotal">' + format_timestamp(total, 2) + '</div>'
'<div class="lapTotal">' + lapTotal + '</div>'
);
if (difference !== null) {
const c = (difference <= 0) ? "negdiff" : "posdiff";
Expand Down
1 change: 1 addition & 0 deletions stopwatch/templates/stopwatch/timetrialstopwatch.html
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
}
return null;
}
var is_kasse_i_kass = {{ object.is_kasse_i_kass|yesno:"true,false" }};
{% if do_post %}
var post_pk = {{ object.pk }};
{% else %}
Expand Down

0 comments on commit 856b30c

Please sign in to comment.