From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from pigeon.gentoo.org ([208.92.234.80] helo=lists.gentoo.org) by finch.gentoo.org with esmtp (Exim 4.60) (envelope-from ) id 1Qe7Fe-0008B2-CH for garchives@archives.gentoo.org; Tue, 05 Jul 2011 15:09:26 +0000 Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 29F5B21C123; Tue, 5 Jul 2011 15:09:19 +0000 (UTC) Received: from smtp.gentoo.org (smtp.gentoo.org [140.211.166.183]) by pigeon.gentoo.org (Postfix) with ESMTP id F0F9B21C123 for ; Tue, 5 Jul 2011 15:09:18 +0000 (UTC) Received: from pelican.gentoo.org (unknown [66.219.59.40]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTPS id 69C5B1B4011 for ; Tue, 5 Jul 2011 15:09:18 +0000 (UTC) Received: from localhost.localdomain (localhost [127.0.0.1]) by pelican.gentoo.org (Postfix) with ESMTP id 8DBC08004A for ; Tue, 5 Jul 2011 15:09:17 +0000 (UTC) From: "Petteri Räty" To: gentoo-commits@lists.gentoo.org Content-type: text/plain; charset=UTF-8 Reply-To: gentoo-dev@lists.gentoo.org, "Petteri Räty" Message-ID: <38bfc2754eeb6db9697a1f258fc652875566e8ba.betelgeuse@gentoo> Subject: [gentoo-commits] proj/council-webapp:master commit in: site/app/models/, site/spec/models/ X-VCS-Repository: proj/council-webapp X-VCS-Files: site/app/models/user.rb site/spec/models/user_spec.rb X-VCS-Directories: site/app/models/ site/spec/models/ X-VCS-Committer: betelgeuse X-VCS-Committer-Name: Petteri Räty X-VCS-Revision: 38bfc2754eeb6db9697a1f258fc652875566e8ba Date: Tue, 5 Jul 2011 15:09:17 +0000 (UTC) Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-commits@lists.gentoo.org Content-Transfer-Encoding: quoted-printable X-Archives-Salt: X-Archives-Hash: 8a98e16f82895967f90ce08b520db688 commit: 38bfc2754eeb6db9697a1f258fc652875566e8ba Author: Joachim Filip Ignacy Bartosik gmail com= > AuthorDate: Tue Jun 28 15:53:04 2011 +0000 Commit: Petteri R=C3=A4ty gentoo org> CommitDate: Tue Jul 5 09:58:11 2011 +0000 URL: http://git.overlays.gentoo.org/gitweb/?p=3Dproj/council-webap= p.git;a=3Dcommit;h=3D38bfc275 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 =3D 0 agendas =3D Agenda.all :conditions =3D> ['agendas.meeting_time BETWE= EN ? AND ?', start_date, end_date], :order =3D> :meeting_time + + return 'There were no meetings in this term yet' if agendas.count.ze= ro? + for agenda in agendas if Participation.participant_is(self).agenda_is(agenda).count =3D=3D= 0 num_status +=3D 1 if num_status < 3 diff --git a/site/spec/models/user_spec.rb b/site/spec/models/user_spec.r= b 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 =3D=3D 'No more a council' end + + it 'should return "There were no meetings in this term yet" if there= were no meeting yet' do + a =3D Factory(:agenda, :meeting_time =3D> 1.year.from_now) + u =3D users_factory(:council) + u.slacking_status_in_period(1.year.ago, 1.month.from_now).should =3D= =3D "There were no meetings in this term yet" + end end =20 it 'should allow no one to create' do