]> projects.mako.cc - selectricity/blob - app/models/selectricity_service.rb
d383dcd09e01a40d0cdeea9ef9c0e9c1b65f94f0
[selectricity] / app / models / selectricity_service.rb
1 require 'action_controller/integration'
2
3 class SelectricityService < ActionWebService::Base
4   web_service_api SelectricityAPI
5   def cast_quickvote(election_id, vote_id, vote_list)
6     #Obviously not implemented
7   end
8   def get_quickvote_results(shortname)
9     #TODO: Validate shortname
10     session=ActionController::Integration::Session.new
11     debugger
12     controller=session.get "quickvote/#{shortname}/results"
13     result=VoteResultStruct.new
14     result.plurality_winners=session.controller.plurality_result.winners.inspect
15     result.approval_winners=session.controller.approval_result.winners.inspect
16     result.condorcet_winners=session.controller.condorcet_result.winners.inspect
17     result.ssd_winners=session.controller.ssd_result.winners.inspect
18     result.borda_winners=session.controller.borda_result.winners.inspect
19     result
20   end
21 end

Benjamin Mako Hill || Want to submit a patch?