Add XMLRPC API for getting an individual quickvote object; refactor getting all quick...
[selectricity-live] / app / models / selectricity_service.rb
index e13037535bf04b37e290244feff0c21b597ee458..b288cc319d558a5d4e2a4f99bdf27f6a6d33d829 100644 (file)
@@ -79,8 +79,12 @@ class SelectricityService < ActionWebService::Base
   def list_quickvotes()
     all=Array.new
     QuickVote.find_all.each do |election|
-      all << ElectionStruct.new (:id => election.id, :name => election.name, :description => election.description, :candidates => election.candidates.collect {|c| c.id } )
+      all << get_quickvote(election.name)
     end
     return all
   end
+  def get_quickvote(shortname)
+    return ElectionStruct.new unless election=QuickVote.ident_to_quickvote(shortname)
+    return ElectionStruct.new (:id => election.id, :name => election.name, :description => election.description, :candidates => election.candidates.collect {|c| c.id } )
+  end
 end

Benjamin Mako Hill || Want to submit a patch?