return value;
}
if (metric.getType() == Metric.ValueType.BOOL) {
- return Boolean.valueOf(value);
+ return Integer.parseInt(value);
}
if (metric.getType() == Metric.ValueType.RATING) {
return Double.parseDouble(value);
return measure.getData();
}
if (metric.getType() == Metric.ValueType.BOOL) {
- return measure.getValue() == 0d ? Boolean.FALSE : Boolean.TRUE;
+ return measure.getValue().intValue();
}
if (metric.getType() == Metric.ValueType.RATING) {
return measure.getValue();
alert.setOperator(Alert.OPERATOR_EQUALS);
alert.setMetric(metric);
- alert.setValueError("true");
+ alert.setValueError("1");
Assert.assertEquals(Metric.Level.OK, AlertUtils.getLevel(alert, measure));
- alert.setValueError("false");
+ alert.setValueError("0");
Assert.assertEquals(Metric.Level.ERROR, AlertUtils.getLevel(alert, measure));
alert.setOperator(Alert.OPERATOR_NOT_EQUALS);
- alert.setValueError("true");
+ alert.setValueError("1");
Assert.assertEquals(Metric.Level.ERROR, AlertUtils.getLevel(alert, measure));
- alert.setValueError("false");
+ alert.setValueError("0");
Assert.assertEquals(Metric.Level.OK, AlertUtils.getLevel(alert, measure));
}
text_field_tag fieldname, value, :size => 5
elsif alert.metric.val_type==Metric::VALUE_TYPE_BOOLEAN
- select_tag fieldname, {'' => '', 'Yes' => '1', 'No' => '0'}
+ select_tag fieldname, options_for_select([['', ''], ['Yes', '1'], ['No', '0']], value)
elsif alert.metric.val_type==Metric::VALUE_TYPE_STRING
text_field_tag fieldname, value, :size => 5
elsif alert.metric.val_type==Metric::VALUE_TYPE_LEVEL
- select_tag fieldname, {'' => '', 'OK' => Metric::TYPE_LEVEL_OK, 'Error' => Metric::TYPE_LEVEL_ERROR, 'Warning' => Metric::TYPE_LEVEL_WARN}
+ select_tag fieldname, options_for_select([['', ''], ['OK', Metric::TYPE_LEVEL_OK], ['Error', Metric::TYPE_LEVEL_ERROR], ['Warning', Metric::TYPE_LEVEL_WARN]], value)
else
hidden_field_tag fieldname, value
end