public inbox for gentoo-commits@lists.gentoo.org
 help / color / mirror / Atom feed
From: "Petteri Räty" <betelgeuse@gentoo.org>
To: gentoo-commits@lists.gentoo.org
Subject: [gentoo-commits] proj/council-webapp:master commit in: site/app/models/, site/spec/models/
Date: Fri, 10 Jun 2011 16:46:37 +0000 (UTC)	[thread overview]
Message-ID: <cdabbcd4c068bf4591998b33a769187683eef17f.betelgeuse@gentoo> (raw)

commit:     cdabbcd4c068bf4591998b33a769187683eef17f
Author:     Joachim Filip Ignacy Bartosik <jbartosik <AT> gmail <DOT> com>
AuthorDate: Wed Jun  8 16:20:05 2011 +0000
Commit:     Petteri Räty <betelgeuse <AT> gentoo <DOT> org>
CommitDate: Fri Jun 10 16:21:04 2011 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/council-webapp.git;a=commit;h=cdabbcd4

Handle proxies attendance

Mark council member who appointed proxy as present, not proxy.

---
 site/app/models/participation.rb       |    3 +++
 site/spec/models/participation_spec.rb |   12 +++++++++---
 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



             reply	other threads:[~2011-06-10 16:47 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-06-10 16:46 Petteri Räty [this message]
  -- strict thread matches above, loose matches on Subject: below --
2011-06-18 15:42 [gentoo-commits] proj/council-webapp:master commit in: site/app/models/, site/spec/models/ Petteri Räty
2011-06-18 15:42 Petteri Räty
2011-07-05 15:09 Petteri Räty

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=cdabbcd4c068bf4591998b33a769187683eef17f.betelgeuse@gentoo \
    --to=betelgeuse@gentoo.org \
    --cc=gentoo-commits@lists.gentoo.org \
    --cc=gentoo-dev@lists.gentoo.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox