Module: Report
- Defined in:
- lib/pagerduty_tools/report.rb
Defined Under Namespace
Class Method Summary collapse
Class Method Details
.pct_change(old_value, new_value) ⇒ Object
112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 |
# File 'lib/pagerduty_tools/report.rb', line 112 def self.pct_change(old_value, new_value) if old_value == 0 return "no occurrences last week" else change = (((new_value.to_f - old_value.to_f) / old_value.to_f) * 100).to_i if change == 0 return "no change vs. last week" elsif change < 0 return "#{change}% vs. last week" else return "+#{change}% vs. last week" end end end |