Fixed wrong formatting of runtime sensor value (#10606)

* fix wrong formatting of runtime sensor value
* avoid else statements
This commit is contained in:
Vitali Kari
2019-09-16 20:43:24 +02:00
committed by PipoCanaja
parent d674c8cefd
commit ccfd32457a
2 changed files with 4 additions and 1 deletions

View File

@@ -1678,6 +1678,10 @@ function get_sensor_label_color($sensor, $type = 'sensors')
$label_style = "label-danger";
}
$unit = __("$type.{$sensor['sensor_class']}.unit");
if ($sensor['sensor_class'] == 'runtime') {
$sensor['sensor_current'] = formatUptime($sensor['sensor_current'] * 60, 'short');
return "<span class='label $label_style'>".trim($sensor['sensor_current'])."</span>";
}
return "<span class='label $label_style'>".trim(format_si($sensor['sensor_current']).$unit)."</span>";
}