api_method :quickvote_candidate_ids_to_names, :expects => [:string,[:int]], :returns => [[:string]]
api_method :get_quickvote_votes, :expects => [:string], :returns => [ [VoteInfo] ]
api_method :list_quickvotes, :expects => [], :returns => [[ElectionStruct]]
-
+ api_method :get_quickvote, :expects => [:string], :returns => [ElectionStruct]
end
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