Add seconds display in title attribute of total time (#696)

This commit is contained in:
quaelnix 2023-02-16 18:44:05 +01:00 committed by GitHub
parent b1ea2c6dc7
commit a35814b8b3
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -24,6 +24,7 @@ BR.TrackStats = L.Class.extend({
: '0', : '0',
formattedTime = formattedTime =
Math.trunc(stats.totalTime / 3600) + ':' + ('0' + Math.trunc((stats.totalTime % 3600) / 60)).slice(-2), Math.trunc(stats.totalTime / 3600) + ':' + ('0' + Math.trunc((stats.totalTime % 3600) / 60)).slice(-2),
formattedTimeHMS = formattedTime + ':' + ('0' + Math.trunc(stats.totalTime % 60)).slice(-2),
formattedEnergy = L.Util.formatNum(stats.totalEnergy / 3600000, 2).toLocaleString(), formattedEnergy = L.Util.formatNum(stats.totalEnergy / 3600000, 2).toLocaleString(),
meanEnergy = stats.trackLength meanEnergy = stats.trackLength
? L.Util.formatNum(stats.totalEnergy / 36 / stats.trackLength, 2).toLocaleString() ? L.Util.formatNum(stats.totalEnergy / 36 / stats.trackLength, 2).toLocaleString()
@ -37,6 +38,8 @@ BR.TrackStats = L.Class.extend({
$('#cost').html(formattedCost); $('#cost').html(formattedCost);
$('#meancostfactor').html(meanCostFactor); $('#meancostfactor').html(meanCostFactor);
$('#totaltime').html(formattedTime); $('#totaltime').html(formattedTime);
// alternative time format with seconds display as tooltip
$('#totaltime').attr('title', formattedTimeHMS + ' h');
$('#totalenergy').html(formattedEnergy); $('#totalenergy').html(formattedEnergy);
$('#meanenergy').html(meanEnergy); $('#meanenergy').html(meanEnergy);
}, },