lib/kaya/database/mongo_connector.rb in kaya-0.0.9 vs lib/kaya/database/mongo_connector.rb in kaya-0.0.10

- old
+ new

@@ -241,10 +241,19 @@ rescue false end end + def self.results_for_suite_id_and_ip suite_id, ip + results = self.find_results_for_ip(ip) + if results + results.select{|result| result["suite"]["id"]==suite_id} + else + [] + end + end + def self.result_data_for_id(result_id) @@results.find({"_id" => ensure_int(result_id)}).to_a.first end @@ -276,9 +285,13 @@ if !all_actual_results.empty? all_actual_results.select do |result| result["suite"]["name"].include?(key) or result["execution_name"].include?(key) or result["summary"].include?(key) or result["command"].include?(key) end end + end + + def self.find_results_for_ip ip + @@results.find({"ip" => ip}, :sort =>["started_at", -1]).to_a end def self.find_results_for_status status all_actual_results = self.all_results if !all_actual_results.empty?