manual_measures - fix mapping in ruby code

This commit is contained in:
Teryk Bellahsene 2015-02-11 18:14:10 +01:00
父節點 bdac02bee4
當前提交 24de4549b0

查看文件

@ -26,6 +26,19 @@ class ManualMeasure < ActiveRecord::Base
validates_length_of :description, :maximum => 4000, :allow_nil => true, :allow_blank => true
validate :validate_metric, :validate_value
def created_at
long_to_date(:created_at)
end
def updated_at
long_to_date(:updated_at)
end
def long_to_date(attribute)
date_in_long = read_attribute(attribute)
Time.at(date_in_long/1000) if date_in_long
end
def metric
@metric ||=
begin
@ -61,7 +74,7 @@ class ManualMeasure < ActiveRecord::Base
if snapshot.nil?
snapshot=resource.last_snapshot
end
snapshot && updated_at && snapshot.created_at<Time.at(updated_at/1000)
snapshot && updated_at && snapshot.created_at<updated_at
end
def formatted_value