aboutsummaryrefslogtreecommitdiff
path: root/web/app/AttributeFormatter.js
diff options
context:
space:
mode:
authorAnton Tananaev <anton.tananaev@gmail.com>2017-08-18 11:22:48 +1200
committerAnton Tananaev <anton.tananaev@gmail.com>2017-08-18 11:22:48 +1200
commit3c2a5c249d2a0cec1d5c371efcd1dfcf7e8c7f2e (patch)
tree74f6b995121b615fe39f3d7a23864c37a8db89a8 /web/app/AttributeFormatter.js
parent1e10dfb3c9f93998c6060297b8458f2a3c3df485 (diff)
downloadetbsa-traccar-web-3c2a5c249d2a0cec1d5c371efcd1dfcf7e8c7f2e.tar.gz
etbsa-traccar-web-3c2a5c249d2a0cec1d5c371efcd1dfcf7e8c7f2e.tar.bz2
etbsa-traccar-web-3c2a5c249d2a0cec1d5c371efcd1dfcf7e8c7f2e.zip
Fix various style issues
Diffstat (limited to 'web/app/AttributeFormatter.js')
-rw-r--r--web/app/AttributeFormatter.js62
1 files changed, 31 insertions, 31 deletions
diff --git a/web/app/AttributeFormatter.js b/web/app/AttributeFormatter.js
index 2d394f5..87689a2 100644
--- a/web/app/AttributeFormatter.js
+++ b/web/app/AttributeFormatter.js
@@ -23,6 +23,7 @@ Ext.define('Traccar.AttributeFormatter', {
if (value !== undefined) {
return Number(value.toFixed(precision)) + ' ' + suffix;
}
+ return null;
};
},
@@ -54,8 +55,8 @@ Ext.define('Traccar.AttributeFormatter', {
durationFormatter: function (value) {
var hours, minutes;
hours = Math.floor(value / 3600000);
- minutes = Math.round((value % 3600000) / 60000);
- return (hours + ' ' + Strings.sharedHourAbbreviation + ' ' + minutes + ' ' + Strings.sharedMinuteAbbreviation);
+ minutes = Math.round(value % 3600000 / 60000);
+ return hours + ' ' + Strings.sharedHourAbbreviation + ' ' + minutes + ' ' + Strings.sharedMinuteAbbreviation;
},
deviceIdFormatter: function (value) {
@@ -72,6 +73,7 @@ Ext.define('Traccar.AttributeFormatter', {
group = store.getById(value);
return group ? group.get('name') : value;
}
+ return null;
},
geofenceIdFormatter: function (value) {
@@ -84,6 +86,7 @@ Ext.define('Traccar.AttributeFormatter', {
geofence = store.getById(value);
return geofence ? geofence.get('name') : '';
}
+ return null;
},
driverUniqueIdFormatter: function (value) {
@@ -96,11 +99,11 @@ Ext.define('Traccar.AttributeFormatter', {
driver = store.findRecord('uniqueId', value, 0, false, true, true);
return driver ? value + ' (' + driver.get('name') + ')' : value;
}
+ return null;
},
lastUpdateFormatter: function (value) {
var seconds, interval;
-
if (value) {
seconds = Math.floor((new Date() - value) / 1000);
if (seconds < 0) {
@@ -116,6 +119,7 @@ Ext.define('Traccar.AttributeFormatter', {
}
return Math.floor(seconds / 60) + ' ' + Strings.sharedMinutes;
}
+ return null;
},
defaultFormatter: function (value) {
@@ -180,26 +184,24 @@ Ext.define('Traccar.AttributeFormatter', {
var dataType = Ext.getStore('PositionAttributes').getAttributeDataType(key);
if (!dataType) {
return this.defaultFormatter;
+ } else if (dataType === 'distance') {
+ return this.distanceFormatter;
+ } else if (dataType === 'speed') {
+ return this.speedFormatter;
+ } else if (dataType === 'driverUniqueId') {
+ return this.driverUniqueIdFormatter;
+ } else if (dataType === 'voltage') {
+ return this.numberFormatterFactory(Traccar.Style.numberPrecision, Strings.sharedVoltAbbreviation);
+ } else if (dataType === 'percentage') {
+ return this.numberFormatterFactory(Traccar.Style.numberPrecision, '&#37;');
+ } else if (dataType === 'temperature') {
+ return this.numberFormatterFactory(Traccar.Style.numberPrecision, '&deg;C');
+ } else if (dataType === 'volume') {
+ return this.numberFormatterFactory(Traccar.Style.numberPrecision, Strings.sharedLiterAbbreviation);
+ } else if (dataType === 'consumption') {
+ return this.numberFormatterFactory(Traccar.Style.numberPrecision, Strings.sharedLiterPerHourAbbreviation);
} else {
- if (dataType === 'distance') {
- return this.distanceFormatter;
- } else if (dataType === 'speed') {
- return this.speedFormatter;
- } else if (dataType === 'driverUniqueId') {
- return this.driverUniqueIdFormatter;
- } else if (dataType === 'voltage') {
- return this.numberFormatterFactory(Traccar.Style.numberPrecision, Strings.sharedVoltAbbreviation);
- } else if (dataType === 'percentage') {
- return this.numberFormatterFactory(Traccar.Style.numberPrecision, '&#37;');
- } else if (dataType === 'temperature') {
- return this.numberFormatterFactory(Traccar.Style.numberPrecision, '&deg;C');
- } else if (dataType === 'volume') {
- return this.numberFormatterFactory(Traccar.Style.numberPrecision, Strings.sharedLiterAbbreviation);
- } else if (dataType === 'consumption') {
- return this.numberFormatterFactory(Traccar.Style.numberPrecision, Strings.sharedLiterPerHourAbbreviation);
- } else {
- return this.defaultFormatter;
- }
+ return this.defaultFormatter;
}
},
@@ -209,16 +211,14 @@ Ext.define('Traccar.AttributeFormatter', {
return function (value) {
return value;
};
+ } else if (dataType === 'distance') {
+ return this.distanceConverter;
+ } else if (dataType === 'speed') {
+ return this.speedConverter;
} else {
- if (dataType === 'distance') {
- return this.distanceConverter;
- } else if (dataType === 'speed') {
- return this.speedConverter;
- } else {
- return function (value) {
- return value;
- };
- }
+ return function (value) {
+ return value;
+ };
}
}
});