aboutsummaryrefslogtreecommitdiff
path: root/web/app/AttributeFormatter.js
diff options
context:
space:
mode:
authorAbyss777 <abyss@fox5.ru>2016-08-19 10:45:33 +0500
committerAbyss777 <abyss@fox5.ru>2016-08-19 10:45:33 +0500
commit1c7437d6de01fffbe3f69853717808b1790413fd (patch)
treeae6fa7144b30321e754773af4a2d464c9e52c624 /web/app/AttributeFormatter.js
parent3826a93f1009942e22ec80c1e13be71e8e917b01 (diff)
downloadtraccar-server-1c7437d6de01fffbe3f69853717808b1790413fd.tar.gz
traccar-server-1c7437d6de01fffbe3f69853717808b1790413fd.tar.bz2
traccar-server-1c7437d6de01fffbe3f69853717808b1790413fd.zip
- Added trips report
- Refactored reports models - Added tests for ReportUtils - Added speed to test-generator.py - Other changes
Diffstat (limited to 'web/app/AttributeFormatter.js')
-rw-r--r--web/app/AttributeFormatter.js9
1 files changed, 9 insertions, 0 deletions
diff --git a/web/app/AttributeFormatter.js b/web/app/AttributeFormatter.js
index dcf50c580..1fff07bcf 100644
--- a/web/app/AttributeFormatter.js
+++ b/web/app/AttributeFormatter.js
@@ -39,6 +39,13 @@ Ext.define('Traccar.AttributeFormatter', {
return (hours + ' ' + Strings.sharedHourAbbreviation);
},
+ durationFormatter: function (value) {
+ var hours, minutes;
+ hours = Math.floor(value / 3600000);
+ minutes = Math.round((value % 3600000) / 60000);
+ return (hours + ' ' + Strings.sharedHourAbbreviation + ' ' + minutes + ' ' + Strings.sharedMinuteAbbreviation);
+ },
+
defaultFormatter: function (value) {
if (typeof value === 'number') {
return Number(value.toFixed(Traccar.Style.numberPrecision));
@@ -65,6 +72,8 @@ Ext.define('Traccar.AttributeFormatter', {
return this.distanceFormatter;
} else if (key === 'hours') {
return this.hoursFormatter;
+ } else if (key === 'duration') {
+ return this.durationFormatter;
} else {
return this.defaultFormatter;
}