This commit is contained in:
amartynov 2015-09-15 15:41:30 +03:00
parent 3464d13ff1
commit cc0b5f04db

View File

@ -39,15 +39,13 @@ module Connectors
options.delete("date_to")
options["created_at"] = date unless date.empty?
end
sort = nil
sort = {created_at: -1}
if options["sort"]
val = options.delete("sort")
sort = {created_at: (val == "desc" ? 1 : -1)}
sort = {created_at: (val == "desc" ? -1 : 1)}
end
puts "Reports: #{options}"
cursor = collection.find(options)
cursor = cursor.sort(sort) if sort
cursor.to_a.map {|bson| model_from_bson(bson)}
collection.find(options).sort(sort).to_a.map {|bson| model_from_bson(bson)}
end
def set_report_status(jid, status)