diff --git a/plugins/mezuro/lib/kalibro/metric_configuration_snapshot.rb b/plugins/mezuro/lib/kalibro/metric_configuration_snapshot.rb index 406f6c2..99c3628 100644 --- a/plugins/mezuro/lib/kalibro/metric_configuration_snapshot.rb +++ b/plugins/mezuro/lib/kalibro/metric_configuration_snapshot.rb @@ -26,7 +26,6 @@ class Kalibro::MetricConfigurationSnapshot < Kalibro::Model def to_hash hash = super - puts hash hash[:attributes!][:range] = {'xmlns:xsi'=> 'http://www.w3.org/2001/XMLSchema-instance', 'xsi:type' => 'kalibro:rangeSnapshotXml' } hash diff --git a/plugins/mezuro/lib/kalibro/metric_result.rb b/plugins/mezuro/lib/kalibro/metric_result.rb index 364e6f0..bbaa418 100644 --- a/plugins/mezuro/lib/kalibro/metric_result.rb +++ b/plugins/mezuro/lib/kalibro/metric_result.rb @@ -2,8 +2,15 @@ class Kalibro::MetricResult < Kalibro::Model attr_accessor :id, :configuration, :value, :error - def value=(value) - @value = value.to_f + def initialize(attributes={}) + value = attributes[:value] + value == "NaN" ? @value = attributes[:agreggated_value] : @value = value.to_f + attributes.each do |field, value| + if field!="value" and field!="agreggated_value" and self.class.is_valid?(field) + send("#{field}=", value) + end + end + @errors = [] end def configuration=(value) -- libgit2 0.21.2