diff options
author | Joachim Filip Ignacy Bartosik <jbartosik@gmail.com> | 2011-06-30 16:43:15 +0200 |
---|---|---|
committer | Joachim Filip Ignacy Bartosik <jbartosik@gmail.com> | 2011-07-06 16:49:52 +0200 |
commit | ef70c52fea7c44b08ee7bec9a1657403cf47d283 (patch) | |
tree | 1488cab5a968c9408e32a4e2346f2dbc5032ec65 /site/app/models/agenda.rb | |
parent | Distinguish votes made during council voting and community voice (diff) | |
download | council-webapp-ef70c52fea7c44b08ee7bec9a1657403cf47d283.tar.gz council-webapp-ef70c52fea7c44b08ee7bec9a1657403cf47d283.tar.bz2 council-webapp-ef70c52fea7c44b08ee7bec9a1657403cf47d283.zip |
Show community votes properly
Diffstat (limited to 'site/app/models/agenda.rb')
-rw-r--r-- | site/app/models/agenda.rb | 12 |
1 files changed, 1 insertions, 11 deletions
diff --git a/site/app/models/agenda.rb b/site/app/models/agenda.rb index ca40b57..1afed67 100644 --- a/site/app/models/agenda.rb +++ b/site/app/models/agenda.rb @@ -90,17 +90,7 @@ class Agenda < ActiveRecord::Base for voter in votes.keys option = VotingOption.first :conditions => { :agenda_item_id => item.id, :description => votes[voter] } user = ::User.find_by_irc_nick voter - old_vote = Vote.user_for_item(user.id, item.id).first - if old_vote.nil? - Vote.create! :voting_option => option, :user => user, :council_vote => true - else - # Result of Vote.user_for_item is read only so reload it - # Reload method won't work so use find. - old_vote = Vote.find(old_vote) - old_vote.voting_option = option - old_vote.council_vote = true - old_vote.save! - end + Vote.vote_for_option(user, option, true) end end end |