diff options
author | Joachim Filip Ignacy Bartosik <jbartosik@gmail.com> | 2011-06-13 15:04:32 +0200 |
---|---|---|
committer | Joachim Filip Ignacy Bartosik <jbartosik@gmail.com> | 2011-06-17 20:39:26 +0200 |
commit | e3d89bd4b32a0348eca0a736261d32d625345717 (patch) | |
tree | f47bf10c1ba93a7af83143a084c3e336800c1f40 /site/app/models/agenda.rb | |
parent | Improve Agenda model spec coverage (diff) | |
download | council-webapp-e3d89bd4b32a0348eca0a736261d32d625345717.tar.gz council-webapp-e3d89bd4b32a0348eca0a736261d32d625345717.tar.bz2 council-webapp-e3d89bd4b32a0348eca0a736261d32d625345717.zip |
Change names to communicative
To improve UncommunicativeName reports
Diffstat (limited to 'site/app/models/agenda.rb')
-rw-r--r-- | site/app/models/agenda.rb | 28 |
1 files changed, 14 insertions, 14 deletions
diff --git a/site/app/models/agenda.rb b/site/app/models/agenda.rb index 8f05e09..16dc2e7 100644 --- a/site/app/models/agenda.rb +++ b/site/app/models/agenda.rb @@ -43,8 +43,8 @@ class Agenda < ActiveRecord::Base true end - before_create do |a| - a.meeting_time ||= Time.now + before_create do |agenda| + agenda.meeting_time ||= Time.now end def self.current @@ -58,14 +58,14 @@ class Agenda < ActiveRecord::Base end def self.process_results(results) - a = Agenda.current + agenda = Agenda.current for item_title in results.keys - i = AgendaItem.first :conditions => { :agenda_id => a, :title => item_title } + item = AgendaItem.first :conditions => { :agenda_id => agenda, :title => item_title } votes = results[item_title] for voter in votes.keys - o = VotingOption.first :conditions => { :agenda_item_id => i.id, :description => votes[voter] } - u = ::User.find_by_irc_nick voter - Vote.create! :voting_option => o, :user => u + option = VotingOption.first :conditions => { :agenda_item_id => item.id, :description => votes[voter] } + user = ::User.find_by_irc_nick voter + Vote.create! :voting_option => option, :user => user end end end @@ -137,16 +137,16 @@ class Agenda < ActiveRecord::Base 'users' => Agenda.voters} end - before_save do |a| - return true if a.new_record? - return true unless a.meeting_time_changed? - a.email_reminder_sent = false + before_save do |agenda| + return true if agenda.new_record? + return true unless agenda.meeting_time_changed? + agenda.email_reminder_sent = false true end - after_save do |a| - if a.new_record? or a.meeting_time_changed? - Agenda.delay(:run_at => a.time_for_reminders(:email)).send_current_agenda_reminders + after_save do |agenda| + if agenda.new_record? or agenda.meeting_time_changed? + Agenda.delay(:run_at => agenda.time_for_reminders(:email)).send_current_agenda_reminders end end |