1 |
commit: 38bfc2754eeb6db9697a1f258fc652875566e8ba |
2 |
Author: Joachim Filip Ignacy Bartosik <jbartosik <AT> gmail <DOT> com> |
3 |
AuthorDate: Tue Jun 28 15:53:04 2011 +0000 |
4 |
Commit: Petteri Räty <betelgeuse <AT> gentoo <DOT> org> |
5 |
CommitDate: Tue Jul 5 09:58:11 2011 +0000 |
6 |
URL: http://git.overlays.gentoo.org/gitweb/?p=proj/council-webapp.git;a=commit;h=38bfc275 |
7 |
|
8 |
Show slacking status properly when there were no meetings yet. |
9 |
|
10 |
--- |
11 |
site/app/models/user.rb | 3 +++ |
12 |
site/spec/models/user_spec.rb | 6 ++++++ |
13 |
2 files changed, 9 insertions(+), 0 deletions(-) |
14 |
|
15 |
diff --git a/site/app/models/user.rb b/site/app/models/user.rb |
16 |
index 7809e87..cde0df5 100644 |
17 |
--- a/site/app/models/user.rb |
18 |
+++ b/site/app/models/user.rb |
19 |
@@ -58,6 +58,9 @@ class User < ActiveRecord::Base |
20 |
num_status = 0 |
21 |
agendas = Agenda.all :conditions => ['agendas.meeting_time BETWEEN ? AND ?', start_date, end_date], |
22 |
:order => :meeting_time |
23 |
+ |
24 |
+ return 'There were no meetings in this term yet' if agendas.count.zero? |
25 |
+ |
26 |
for agenda in agendas |
27 |
if Participation.participant_is(self).agenda_is(agenda).count == 0 |
28 |
num_status += 1 if num_status < 3 |
29 |
|
30 |
diff --git a/site/spec/models/user_spec.rb b/site/spec/models/user_spec.rb |
31 |
index 5246015..ad36761 100644 |
32 |
--- a/site/spec/models/user_spec.rb |
33 |
+++ b/site/spec/models/user_spec.rb |
34 |
@@ -81,6 +81,12 @@ describe User do |
35 |
u.slacking_status_in_period(agendas.first.meeting_time - 1.minute, |
36 |
agendas.last.meeting_time + 1.minute).should == 'No more a council' |
37 |
end |
38 |
+ |
39 |
+ it 'should return "There were no meetings in this term yet" if there were no meeting yet' do |
40 |
+ a = Factory(:agenda, :meeting_time => 1.year.from_now) |
41 |
+ u = users_factory(:council) |
42 |
+ u.slacking_status_in_period(1.year.ago, 1.month.from_now).should == "There were no meetings in this term yet" |
43 |
+ end |
44 |
end |
45 |
|
46 |
it 'should allow no one to create' do |