From c54996f70a89dc17e75d8dc8c7172ec0bd4eb33e Mon Sep 17 00:00:00 2001 From: John Dong Date: Fri, 17 Aug 2007 14:03:19 -0400 Subject: [PATCH] Add a way to get the votes list from a quickvote votes XMLRPC call --- app/apis/selectricity_api.rb | 1 + app/models/selectricity_service.rb | 8 ++++++-- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/app/apis/selectricity_api.rb b/app/apis/selectricity_api.rb index 75a840a..b1210c6 100644 --- a/app/apis/selectricity_api.rb +++ b/app/apis/selectricity_api.rb @@ -9,6 +9,7 @@ class VoteInfo < ActionWebService::Struct member :voter_id, :int member :voter_ipaddress, :string member :vote_time, :int + member :vote, [:int] end class VoteResultStruct < ActionWebService::Struct diff --git a/app/models/selectricity_service.rb b/app/models/selectricity_service.rb index 7da46e1..9d7d91e 100644 --- a/app/models/selectricity_service.rb +++ b/app/models/selectricity_service.rb @@ -80,7 +80,7 @@ class SelectricityService < ActionWebService::Base return result end qv.votes.each do |vote| - votes << VoteInfo.new(:voter_id => vote.voter.id, :voter_ipaddress => vote.voter.ipaddress, :vote_time => vote.time.to_i) + votes << VoteInfo.new(:voter_id => vote.voter.id, :voter_ipaddress => vote.voter.ipaddress, :vote_time => vote.time.to_i, :vote => vote.votes) end return votes end @@ -98,7 +98,11 @@ class SelectricityService < ActionWebService::Base def create_quickvote(election) qv=QuickVote.new(:name => election.name, :description => election.description) qv.candidatelist=election.candidate_names - return qv.save.to_s + if qv.save.to_s + return "" + else + return "Saving quickvote FAILED:"+qv.errors.inspect + end end end -- 2.30.2