diff options
author | David Gageot <david@gageot.net> | 2012-07-13 12:27:10 +0200 |
---|---|---|
committer | David Gageot <david@gageot.net> | 2012-07-13 12:27:20 +0200 |
commit | 0bd84ea0219e949135ba488fc6b4a9b46030449b (patch) | |
tree | 423c224155b534a5f7a90c2d341a9fecd33c332b | |
parent | 94d68f66338e5c109a92bd5146f10a8184ea3829 (diff) | |
download | sonarqube-0bd84ea0219e949135ba488fc6b4a9b46030449b.tar.gz sonarqube-0bd84ea0219e949135ba488fc6b4a9b46030449b.zip |
SONAR-3336 Measure of 4077ms is displayed as 4.7s instead of 4s
-rw-r--r-- | sonar-server/src/main/webapp/WEB-INF/app/models/project_measure.rb | 12 |
1 files changed, 5 insertions, 7 deletions
diff --git a/sonar-server/src/main/webapp/WEB-INF/app/models/project_measure.rb b/sonar-server/src/main/webapp/WEB-INF/app/models/project_measure.rb index 10c3a136c78..2e67489889d 100644 --- a/sonar-server/src/main/webapp/WEB-INF/app/models/project_measure.rb +++ b/sonar-server/src/main/webapp/WEB-INF/app/models/project_measure.rb @@ -145,19 +145,17 @@ class ProjectMeasure < ActiveRecord::Base hours = ( value / HOUR ).to_i mins = ( value % HOUR / MIN ).to_i secs = ( value % MIN / SEC ).to_i - return hours.to_s + ":" + leading_zero( mins ) + ":" + leading_zero( secs ) + " h" + return hours.to_s + ':' + leading_zero( mins ) + ':' + leading_zero( secs ) + ' h' elsif value.abs >= MIN mins = ( value / MIN ).to_i secs = ( value % MIN / SEC ).to_i - millisecs = ( value % MIN % SEC ).to_i - return mins.to_s + ":" + leading_zero( secs ) + " min" + return mins.to_s + ':' + leading_zero( secs ) + ' min' elsif value.abs >= SEC secs = ( value / SEC ).to_i - millisecs = ( value % SEC ).to_i - return secs.to_s + "." + millisecs.to_s[0, 1] + " sec" if millisecs != 0 - return secs.to_s+ " sec" if millisecs == 0 + ms = ( value % SEC ).to_i + return secs.to_s + (ms < 100 ? '' : '.' + ms.to_s[-3,1]) + ' sec' else - ( "%d" % value ) + " ms" + ( '%d' % value ) + ' ms' end end |