aboutsummaryrefslogtreecommitdiff
path: root/web/app/store/SpeedUnits.js
diff options
context:
space:
mode:
authorAnton Tananaev <anton.tananaev@gmail.com>2015-07-25 19:43:16 +1200
committerAnton Tananaev <anton.tananaev@gmail.com>2015-07-25 19:43:16 +1200
commite637bd7c022560dcc9c48516dc22a884a5de8122 (patch)
treec34369d5081238915e3f3660d27d4acedde25467 /web/app/store/SpeedUnits.js
parent87156d38c250abd9a1cba9b9af289d5ff0acb075 (diff)
downloadtrackermap-server-e637bd7c022560dcc9c48516dc22a884a5de8122.tar.gz
trackermap-server-e637bd7c022560dcc9c48516dc22a884a5de8122.tar.bz2
trackermap-server-e637bd7c022560dcc9c48516dc22a884a5de8122.zip
Convert speed value to units
Diffstat (limited to 'web/app/store/SpeedUnits.js')
-rw-r--r--web/app/store/SpeedUnits.js16
1 files changed, 15 insertions, 1 deletions
diff --git a/web/app/store/SpeedUnits.js b/web/app/store/SpeedUnits.js
index b658fc936..ee345621b 100644
--- a/web/app/store/SpeedUnits.js
+++ b/web/app/store/SpeedUnits.js
@@ -20,5 +20,19 @@ Ext.define('Traccar.store.SpeedUnits', {
data : [
{'key': 'kph', 'name': strings.shared_kph},
{'key': 'mph', 'name': strings.shared_mph}
- ]
+ ],
+
+ convert: function(value, unit) {
+ switch (unit) {
+ case 'kph':
+ return value * 1.852;
+ case 'mph':
+ return value * 1.15078;
+ }
+ return value;
+ },
+
+ getUnitName: function(unit) {
+ return this.findRecord('key', unit).get('name');
+ }
});