aboutsummaryrefslogtreecommitdiff
path: root/site
diff options
context:
space:
mode:
Diffstat (limited to 'site')
-rw-r--r--site/app/models/participation.rb3
-rw-r--r--site/spec/models/participation_spec.rb12
2 files changed, 12 insertions, 3 deletions
diff --git a/site/app/models/participation.rb b/site/app/models/participation.rb
index b7ca39a..e76ebf5 100644
--- a/site/app/models/participation.rb
+++ b/site/app/models/participation.rb
@@ -37,6 +37,9 @@ class Participation < ActiveRecord::Base
agenda = Agenda.current
for nick in participant_nicks
user = ::User.find_by_irc_nick(nick)
+ unless user.council_member?
+ user = Proxy.proxy_is(user).agenda_is(agenda)._?.first.council_member
+ end
next if user.nil?
Participation.create! :irc_nick => user.irc_nick,
:participant => user,
diff --git a/site/spec/models/participation_spec.rb b/site/spec/models/participation_spec.rb
index 242abde..395dc03 100644
--- a/site/spec/models/participation_spec.rb
+++ b/site/spec/models/participation_spec.rb
@@ -25,15 +25,21 @@ describe Participation do
a = Factory(:agenda)
Factory(:agenda, :state => 'old')
+ Factory(:proxy, :proxy => u.first,
+ :council_member => non_participants.last,
+ :agenda => a)
+
results_hash = {
'Whatever' => { u[0].irc_nick => 'Yes', u[1].irc_nick => 'Yes', u[2].irc_nick => 'Yes'},
'Something else' => { u[0].irc_nick => 'Yes', u[1].irc_nick => 'No'}
}
+ present = u - [u.first] + [non_participants.last]
Participation.mark_participations(results_hash)
- (Participation.all.*.irc_nick - u.*.irc_nick).should be_empty
- (u.*.irc_nick - Participation.all.*.irc_nick).should be_empty
- (u - Participation.all.*.participant).should be_empty
+ (Participation.all.*.irc_nick - present.*.irc_nick).should be_empty
+ (present.*.irc_nick - Participation.all.*.irc_nick).should be_empty
+ (present - Participation.all.*.participant).should be_empty
+ (Participation.all.*.participant - present).should be_empty
end
end
end