Battery level and temp were not being sorted by their numeric values.

This commit is contained in:
Simo Kinnunen
2015-06-05 18:30:58 +09:00
parent c9c892c69d
commit f2fd3e54e1

View File

@@ -218,6 +218,11 @@ module.exports = function DeviceColumnService($filter, gettext) {
? Math.floor(device.battery.level / device.battery.scale * 100) + '%'
: ''
}
, compare: function(deviceA, deviceB) {
var va = deviceA.battery ? deviceA.battery.level : 0
, vb = deviceB.battery ? deviceB.battery.level : 0
return va - vb
}
})
, batteryTemp: TextCell({
title: gettext('Battery Temp')
@@ -225,6 +230,11 @@ module.exports = function DeviceColumnService($filter, gettext) {
, value: function(device) {
return device.battery ? device.battery.temp + '°C' : ''
}
, compare: function(deviceA, deviceB) {
var va = deviceA.battery ? deviceA.battery.temp : 0
, vb = deviceB.battery ? deviceB.battery.temp : 0
return va - vb
}
})
, provider: TextCell({
title: gettext('Location')