Skip to content

Commit

Permalink
Merge pull request #9 from marutosi/fix-ruby-187
Browse files Browse the repository at this point in the history
fix Ruby 1.8.7 compatibility
  • Loading branch information
gamafranco committed Jan 2, 2013
2 parents a2ca33f + 88d0323 commit 6b49e7a
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
4 changes: 2 additions & 2 deletions app/views/ratios/_bottom_js.html.erb
Expand Up @@ -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,
Expand All @@ -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,
Expand Down
9 changes: 5 additions & 4 deletions lib/indicators_logic.rb
Expand Up @@ -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]
Expand All @@ -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]
Expand Down

0 comments on commit 6b49e7a

Please sign in to comment.