Steve Linabery
2009-Jan-20 20:15 UTC
[Ovirt-devel] [PATCH server] Add type check before nan? method in Stats.rb to avoid nosuchmethod in Fixnum class error
--- src/app/util/stats/Stats.rb | 8 ++++---- 1 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/app/util/stats/Stats.rb b/src/app/util/stats/Stats.rb index 5adc5b4..f6b0c7a 100644 --- a/src/app/util/stats/Stats.rb +++ b/src/app/util/stats/Stats.rb @@ -56,7 +56,7 @@ def fetchRollingAve?(rrdPath, start, endTime, interval, myFunction, lIndex, retu final = 0 value = 0 value = vdata[lIndex] - value = 0 if value.nan? + value = 0 if value.is_?(Float) && value.nan? roll.push(value) @@ -120,7 +120,7 @@ def fetchRollingCalcUsedData?(rrdPath, start, endTime, interval, myFunction, lIn final = 0 value = 0 value = vdata[lIndex] - value = 100 if value.nan? + value = 100 if value.is_a?(Float) && value.nan? if ( value > 100 ) value = 100 end @@ -183,7 +183,7 @@ def fetchCalcUsedData?(rrdPath, start, endTime, interval, myFunction, lIndex, re data.each do |vdata| i += 1 value = vdata[lIndex] - value = 100 if value.nan? + value = 100 if value.is_a?(Float) && value.nan? if ( value > 100 ) value = 100 end @@ -396,7 +396,7 @@ def getAggregateStatsData?(statRequestList) # them with extreme prejudice... value = d.get_value? - value = 0 if value.nan? + value = 0 if value.is_a?(Float) && value.nan? if (myMasterList.length > idx ) if ( d.get_timestamp? > myMasterList[idx].get_timestamp? ) -- 1.6.0.6
Mark Wagner
2009-Jan-20 20:51 UTC
[Ovirt-devel] [PATCH server] Add type check before nan? method in Stats.rb to avoid nosuchmethod in Fixnum class error
ACK Steve Linabery wrote:> --- > src/app/util/stats/Stats.rb | 8 ++++---- > 1 files changed, 4 insertions(+), 4 deletions(-) > > diff --git a/src/app/util/stats/Stats.rb b/src/app/util/stats/Stats.rb > index 5adc5b4..f6b0c7a 100644 > --- a/src/app/util/stats/Stats.rb > +++ b/src/app/util/stats/Stats.rb > @@ -56,7 +56,7 @@ def fetchRollingAve?(rrdPath, start, endTime, interval, myFunction, lIndex, retu > final = 0 > value = 0 > value = vdata[lIndex] > - value = 0 if value.nan? > + value = 0 if value.is_?(Float) && value.nan? > > > roll.push(value) > @@ -120,7 +120,7 @@ def fetchRollingCalcUsedData?(rrdPath, start, endTime, interval, myFunction, lIn > final = 0 > value = 0 > value = vdata[lIndex] > - value = 100 if value.nan? > + value = 100 if value.is_a?(Float) && value.nan? > if ( value > 100 ) > value = 100 > end > @@ -183,7 +183,7 @@ def fetchCalcUsedData?(rrdPath, start, endTime, interval, myFunction, lIndex, re > data.each do |vdata| > i += 1 > value = vdata[lIndex] > - value = 100 if value.nan? > + value = 100 if value.is_a?(Float) && value.nan? > if ( value > 100 ) > value = 100 > end > @@ -396,7 +396,7 @@ def getAggregateStatsData?(statRequestList) > # them with extreme prejudice... > > value = d.get_value? > - value = 0 if value.nan? > + value = 0 if value.is_a?(Float) && value.nan? > > if (myMasterList.length > idx ) > if ( d.get_timestamp? > myMasterList[idx].get_timestamp? ) >