ref: refs/heads/master
commit 13263cab2b07bba8aae9c88065b127e58b9d7f2f
Author: Stefan Schubert
Date: Thu Jul 16 15:08:30 2009 +0200
store valid values only
---
plugins/status/app/models/status.rb | 9 ++++++---
1 files changed, 6 insertions(+), 3 deletions(-)
diff --git a/plugins/status/app/models/status.rb b/plugins/status/app/models/status.rb
index 640fb5d..95136ea 100644
--- a/plugins/status/app/models/status.rb
+++ b/plugins/status/app/models/status.rb
@@ -136,6 +136,7 @@ class Status < ActiveRecord::Base
labels=""
output = output.gsub(",", ".") # translates eg. 1,234e+07 to 1.234e+07
lines = output.split "\n"
+
# set label names
lines[0].each do |l|
if l =~ /\D*/
@@ -151,9 +152,11 @@ class Status < ActiveRecord::Base
values = pair[1].split " "
column = 0
values.each do |v| # each label
- result["#{labels[column]}"] ||= Hash.new
- result["#{labels[column]}"].merge!({"T_#{pair[0].chomp(": ")}" => v})
- column += 1
+ if v != "nan" #store valid values only
+ result["#{labels[column]}"] ||= Hash.new
+ result["#{labels[column]}"].merge!({"T_#{pair[0].chomp(": ")}" => v})
+ column += 1
+ end
end
end
end
--
To unsubscribe, e-mail: yast-commit+unsubscribe@opensuse.org
For additional commands, e-mail: yast-commit+help@opensuse.org