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: Tue, 5 Jul 2011 15:09:17 +0000 (UTC) [thread overview]
Message-ID: <38bfc2754eeb6db9697a1f258fc652875566e8ba.betelgeuse@gentoo> (raw)
commit: 38bfc2754eeb6db9697a1f258fc652875566e8ba
Author: Joachim Filip Ignacy Bartosik <jbartosik <AT> gmail <DOT> com>
AuthorDate: Tue Jun 28 15:53:04 2011 +0000
Commit: Petteri Räty <betelgeuse <AT> gentoo <DOT> org>
CommitDate: Tue Jul 5 09:58:11 2011 +0000
URL: http://git.overlays.gentoo.org/gitweb/?p=proj/council-webapp.git;a=commit;h=38bfc275
Show slacking status properly when there were no meetings yet.
---
site/app/models/user.rb | 3 +++
site/spec/models/user_spec.rb | 6 ++++++
2 files changed, 9 insertions(+), 0 deletions(-)
diff --git a/site/app/models/user.rb b/site/app/models/user.rb
index 7809e87..cde0df5 100644
--- a/site/app/models/user.rb
+++ b/site/app/models/user.rb
@@ -58,6 +58,9 @@ class User < ActiveRecord::Base
num_status = 0
agendas = Agenda.all :conditions => ['agendas.meeting_time BETWEEN ? AND ?', start_date, end_date],
:order => :meeting_time
+
+ return 'There were no meetings in this term yet' if agendas.count.zero?
+
for agenda in agendas
if Participation.participant_is(self).agenda_is(agenda).count == 0
num_status += 1 if num_status < 3
diff --git a/site/spec/models/user_spec.rb b/site/spec/models/user_spec.rb
index 5246015..ad36761 100644
--- a/site/spec/models/user_spec.rb
+++ b/site/spec/models/user_spec.rb
@@ -81,6 +81,12 @@ describe User do
u.slacking_status_in_period(agendas.first.meeting_time - 1.minute,
agendas.last.meeting_time + 1.minute).should == 'No more a council'
end
+
+ it 'should return "There were no meetings in this term yet" if there were no meeting yet' do
+ a = Factory(:agenda, :meeting_time => 1.year.from_now)
+ u = users_factory(:council)
+ u.slacking_status_in_period(1.year.ago, 1.month.from_now).should == "There were no meetings in this term yet"
+ end
end
it 'should allow no one to create' do
next reply other threads:[~2011-07-05 15:09 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-07-05 15:09 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-06-10 16:46 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=38bfc2754eeb6db9697a1f258fc652875566e8ba.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