From e3d89bd4b32a0348eca0a736261d32d625345717 Mon Sep 17 00:00:00 2001 From: Joachim Filip Ignacy Bartosik Date: Mon, 13 Jun 2011 15:04:32 +0200 Subject: Change names to communicative To improve UncommunicativeName reports --- site/app/models/agenda.rb | 28 ++++++++++++++-------------- site/app/models/proxy.rb | 6 +++--- site/app/models/user.rb | 4 ++-- 3 files changed, 19 insertions(+), 19 deletions(-) (limited to 'site') 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 diff --git a/site/app/models/proxy.rb b/site/app/models/proxy.rb index 7be0a0b..1fdb93f 100644 --- a/site/app/models/proxy.rb +++ b/site/app/models/proxy.rb @@ -40,9 +40,9 @@ class Proxy < ActiveRecord::Base true end - before_create do |p| - p.council_member_nick = p.council_member.irc_nick - p.proxy_nick = p.proxy.irc_nick + before_create do |proxy| + proxy.council_member_nick = proxy.council_member.irc_nick + proxy.proxy_nick = proxy.proxy.irc_nick end protected diff --git a/site/app/models/user.rb b/site/app/models/user.rb index 087f0fe..0ca3e33 100644 --- a/site/app/models/user.rb +++ b/site/app/models/user.rb @@ -66,9 +66,9 @@ class User < ActiveRecord::Base end end - a = ['Was on last meeting', 'Skipped last meeting', + text_statuses = ['Was on last meeting', 'Skipped last meeting', 'Slacker', 'No more a council'] - a[num_status] + text_statuses[num_status] end def can_appoint_a_proxy?(user) -- cgit v1.2.3-65-gdbad