diff options
author | Teryk Bellahsene <teryk.bellahsene@sonarsource.com> | 2015-02-11 18:14:10 +0100 |
---|---|---|
committer | Teryk Bellahsene <teryk.bellahsene@sonarsource.com> | 2015-02-11 18:30:55 +0100 |
commit | 24de4549b07a6b7610db658551afb613deb28c82 (patch) | |
tree | 117272bd9981b7bd283a273d6ba4ae9ae374a9e9 | |
parent | bdac02bee44acab843eac1f57e100468566250f4 (diff) | |
download | sonarqube-24de4549b07a6b7610db658551afb613deb28c82.tar.gz sonarqube-24de4549b07a6b7610db658551afb613deb28c82.zip |
manual_measures - fix mapping in ruby code
-rw-r--r-- | server/sonar-web/src/main/webapp/WEB-INF/app/models/manual_measure.rb | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/server/sonar-web/src/main/webapp/WEB-INF/app/models/manual_measure.rb b/server/sonar-web/src/main/webapp/WEB-INF/app/models/manual_measure.rb index a292be623ab..d115fb1ebfa 100644 --- a/server/sonar-web/src/main/webapp/WEB-INF/app/models/manual_measure.rb +++ b/server/sonar-web/src/main/webapp/WEB-INF/app/models/manual_measure.rb @@ -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 |