From 1c7437d6de01fffbe3f69853717808b1790413fd Mon Sep 17 00:00:00 2001 From: Abyss777 Date: Fri, 19 Aug 2016 10:45:33 +0500 Subject: - Added trips report - Refactored reports models - Added tests for ReportUtils - Added speed to test-generator.py - Other changes --- web/app/AttributeFormatter.js | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'web/app/AttributeFormatter.js') 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; } -- cgit v1.2.3