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 1QZILO-0000tN-U7 for garchives@archives.gentoo.org; Wed, 22 Jun 2011 07:59:27 +0000 Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 336E91C0D1; Wed, 22 Jun 2011 07:59:20 +0000 (UTC) Received: from smtp.gentoo.org (smtp.gentoo.org [140.211.166.183]) by pigeon.gentoo.org (Postfix) with ESMTP id E76B21C0D1 for ; Wed, 22 Jun 2011 07:59:19 +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 AD10B2AC00D for ; Wed, 22 Jun 2011 07:59:18 +0000 (UTC) Received: from localhost.localdomain (localhost [127.0.0.1]) by pelican.gentoo.org (Postfix) with ESMTP id B68B98003E for ; Wed, 22 Jun 2011 07:59: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: <1a137e470619a11e14ed9c0be48f24a062890d1b.betelgeuse@gentoo> Subject: [gentoo-commits] proj/council-webapp:master commit in: bot/tests/, bot/ircmeeting/ X-VCS-Repository: proj/council-webapp X-VCS-Files: bot/ircmeeting/agenda.py bot/tests/run_test.py X-VCS-Directories: bot/tests/ bot/ircmeeting/ X-VCS-Committer: betelgeuse X-VCS-Committer-Name: Petteri Räty X-VCS-Revision: 1a137e470619a11e14ed9c0be48f24a062890d1b Date: Wed, 22 Jun 2011 07:59: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: b4449fd815b8eabc25b898db609c6211 commit: 1a137e470619a11e14ed9c0be48f24a062890d1b Author: Joachim Filip Ignacy Bartosik gmail com= > AuthorDate: Tue Jun 21 15:29:09 2011 +0000 Commit: Petteri R=C3=A4ty gentoo org> CommitDate: Wed Jun 22 07:22:05 2011 +0000 URL: http://git.overlays.gentoo.org/gitweb/?p=3Dproj/council-webap= p.git;a=3Dcommit;h=3D1a137e47 Close voting when last user allowed to vote voted. --- bot/ircmeeting/agenda.py | 10 +++++++++- bot/tests/run_test.py | 11 +++++++++++ 2 files changed, 20 insertions(+), 1 deletions(-) diff --git a/bot/ircmeeting/agenda.py b/bot/ircmeeting/agenda.py index 928ff5f..775dfd9 100644 --- a/bot/ircmeeting/agenda.py +++ b/bot/ircmeeting/agenda.py @@ -79,6 +79,7 @@ class Agenda(object): self._voters =3D self._get_json(self.conf.voters_url) self._agenda =3D self._get_json(self.conf.agenda_url) self._votes =3D { } + self._voters.sort() for i in self._agenda: self._votes[i[0]] =3D { } =20 @@ -93,7 +94,14 @@ class Agenda(object): return(opt) =20 self._votes[self._agenda[self._current_item][0]][nick] =3D self.= _agenda[self._current_item][1][opt] - return str.format(self.vote_confirm_msg, opt, self._agenda[self.= _current_item][1][opt]) + + users_who_voted =3D self._votes[self._agenda[self._current_item]= [0]].keys() + users_who_voted.sort() + + reply =3D str.format(self.vote_confirm_msg, opt, self._agenda[se= lf._current_item][1][opt]) + if users_who_voted =3D=3D self._voters: + reply +=3D '. ' + self.end_vote() + return(reply) =20 def _get_json(self, url): str =3D urllib.urlopen(url).read() diff --git a/bot/tests/run_test.py b/bot/tests/run_test.py index 9808ee6..3c43fef 100644 --- a/bot/tests/run_test.py +++ b/bot/tests/run_test.py @@ -406,6 +406,7 @@ class MeetBotTest(unittest.TestCase): =20 def test_agenda_voting(self): test =3D self.get_simple_agenda_test() + test.M.config.agenda._voters.append('t') test.answer_should_match('20:13:50 #startvote', 'Voting star= ted\. ' +\ 'Available voting options are:\n0. opt= 1\n1. opt2\nVote ' +\ '#vote