From: John Dong Date: Thu, 16 Aug 2007 23:33:49 +0000 (-0400) Subject: list_quickvotes XMLRPC returns candidate ID's instead of names X-Git-Url: https://projects.mako.cc/source/selectricity/commitdiff_plain/49bc919b9f7edd189a311cdb910ab0a7500030ac list_quickvotes XMLRPC returns candidate ID's instead of names --- diff --git a/app/apis/selectricity_api.rb b/app/apis/selectricity_api.rb index 70e6479..af75cf6 100644 --- a/app/apis/selectricity_api.rb +++ b/app/apis/selectricity_api.rb @@ -1,6 +1,7 @@ class ElectionStruct < ActionWebService::Struct member :name, :string member :description, :string + member :candidates, [:int] member :id, :int end class VoteInfo < ActionWebService::Struct diff --git a/app/models/selectricity_service.rb b/app/models/selectricity_service.rb index da58f71..e130375 100644 --- a/app/models/selectricity_service.rb +++ b/app/models/selectricity_service.rb @@ -79,7 +79,7 @@ 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) + all << ElectionStruct.new (:id => election.id, :name => election.name, :description => election.description, :candidates => election.candidates.collect {|c| c.id } ) end return all end