Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Merge pull request #9 from marutosi/fix-ruby-187

fix Ruby 1.8.7 compatibility
  • Loading branch information...
commit 6b49e7ae01bba027c455144a2832b3445c0b01e1 2 parents a2ca33f + 88d0323
@gamafranco gamafranco authored
Showing with 7 additions and 6 deletions.
  1. +2 −2 app/views/ratios/_bottom_js.html.erb
  2. +5 −4 lib/indicators_logic.rb
View
4 app/views/ratios/_bottom_js.html.erb
@@ -24,7 +24,7 @@
// Create and populate the data table.
var data_gauge = new google.visualization.arrayToDataTable([
['Label', 'Value'],
- ['CPI', <%= raw (@proj_or_vers_indicators[1] * 1000).to_f.round / 1000 %>]
+ ['CPI', <%= (@proj_or_vers_indicators[1] * 1000).round / 1000.0 %>]
]);
var options_g = {
redFrom: 0, redTo: 0.85,
@@ -42,7 +42,7 @@
// Create and populate the data table.
var data_gauges = new google.visualization.arrayToDataTable([
['Label', 'Value'],
- ['SPI', <%= raw (@proj_or_vers_indicators[2] * 1000).to_f.round / 1000 %>]
+ ['SPI', <%= (@proj_or_vers_indicators[2] * 1000).round / 1000.0 %>]
]);
var options_gs = {
redFrom: 0, redTo: 0.85,
View
9 lib/indicators_logic.rb
@@ -55,7 +55,8 @@ def self.calc_indicators(my_project_or_version, ary_reported_time_week_year, ary
sum_real = 0
sum_planned = 0
sum_earned = 0
- hash_weeks_years.each do |k,v|
+ ary_weeks_years.each do |k|
+ v = hash_weeks_years[k]
sum_real += ary_reported_time_week_year.has_key?(k)? ary_reported_time_week_year[k] : 0
v[0] = sum_real
sum_planned += v[1]
@@ -64,9 +65,9 @@ def self.calc_indicators(my_project_or_version, ary_reported_time_week_year, ary
v[2] = sum_earned
@ary_data_week_years.push(
Array[k[0].to_s + "/" + k[1].to_s,
- ((v[0] * 100).to_f).round / 100,
- ((v[1] * 100).to_f).round / 100,
- ((v[2] * 100).to_f).round / 100])
+ (v[0] * 100).round / 100.0,
+ (v[1] * 100).round / 100.0,
+ (v[2] * 100).round / 100.0])
end
@cpi = hash_weeks_years.values.last[0].zero? ? 0 : hash_weeks_years.values.last[2]/hash_weeks_years.values.last[0]
@spi = hash_weeks_years.values.last[1].zero? ? 0 : hash_weeks_years.values.last[2]/hash_weeks_years.values.last[1]
Please sign in to comment.
Something went wrong with that request. Please try again.