From: "Petteri Räty" <betelgeuse@gentoo.org>
To: gentoo-commits@lists.gentoo.org
Subject: [gentoo-commits] proj/council-webapp:master commit in: /
Date: Sat, 25 Jun 2011 11:55:16 +0000 (UTC) [thread overview]
Message-ID: <eab5375bf3829daa62fa79f16791bec78ec22257.betelgeuse@gentoo> (raw)
commit: eab5375bf3829daa62fa79f16791bec78ec22257
Author: Petteri Räty <petsku <AT> petteriraty <DOT> eu>
AuthorDate: Sat Jun 25 11:52:19 2011 +0000
Commit: Petteri Räty <betelgeuse <AT> gentoo <DOT> org>
CommitDate: Sat Jun 25 11:52:19 2011 +0000
URL: http://git.overlays.gentoo.org/gitweb/?p=proj/council-webapp.git;a=commit;h=eab5375b
Merge remote-tracking branch 'github/time_limit'
Conflicts:
bot/tests/run_test.py
bot/ircmeeting/agenda.py | 56 +++++++++++++++++++++++--
bot/ircmeeting/meeting.py | 21 ++++++++-
bot/tests/run_test.py | 75 +++++++++++++++++++++++++++++++++-
site/app/models/agenda.rb | 2 +-
site/app/models/agenda_item.rb | 13 ++++++
site/db/schema.rb | 3 +-
site/spec/models/agenda_item_spec.rb | 19 +++++++++
site/spec/models/agenda_spec.rb | 17 ++++----
8 files changed, 188 insertions(+), 18 deletions(-)
diff --cc bot/ircmeeting/agenda.py
index af03c3a,101c73c..8b9650c
--- a/bot/ircmeeting/agenda.py
+++ b/bot/ircmeeting/agenda.py
@@@ -15,9 -23,13 +23,13 @@@ class Agenda(object)
voting_already_closed_msg = "Voting is already closed. You can start it with #startvote."
voting_open_so_item_not_changed_msg = "Voting is currently open so I didn't change item. Please #endvote first"
can_not_vote_msg = "You can not vote or change agenda. Only {} can."
- not_a_number_msg = "Your vote was not recognized as a number. Please retry."
- out_of_range_msg = "Your vote was out of range!"
+ not_a_number_msg = "Your choice was not recognized as a number. Please retry."
+ out_of_range_msg = "Your choice was out of range!"
vote_confirm_msg = "You voted for #{} - {}"
+ timelimit_added_msg = 'Added "{}" reminder in {}:{}'
+ timelimit_list_msg = 'Set reminders: "{}"'
+ timelimit_removed_msg = 'Reminder "{}" removed'
+ timelimit_missing_msg = 'No such reminder "{}"'
# Internal
_voters = []
diff --cc bot/ircmeeting/meeting.py
index c01176a,e3cf38d..a86c782
--- a/bot/ircmeeting/meeting.py
+++ b/bot/ircmeeting/meeting.py
@@@ -323,14 -323,26 +323,29 @@@ class MeetingCommands(object)
self.reply(self.config.agenda.get_agenda_item())
def do_nextitem(self, nick, time_, line, **kwargs):
- self.reply(self.config.agenda.next_agenda_item())
+ self.reply(self.config.agenda.next_agenda_item(self))
def do_previtem(self, nick, time_, line, **kwargs):
- self.reply(self.config.agenda.prev_agenda_item())
+ self.reply(self.config.agenda.prev_agenda_item(self))
+
+ def do_timelimit(self, nick, time_, line, **kwargs):
+ reply = 'Usage "#timelimit add <minutes>:<seconds> <message>" or ' +\
+ '"#timelimit list" or "#timelimit remove <message>"'
+ match = re.match( ' *?add ([0-9]+):([0-9]+) (.*)', line)
+ if match:
+ reply = self.config.agenda.add_timelimit(int(match.group(1)),
+ int(match.group(2)), match.group(3), self)
+ elif re.match( ' *?list', line):
+ reply = self.config.agenda.list_timielimits()
+ else:
+ match = re.match( ' *?remove (.*)', line)
+ if(match):
+ reply = self.config.agenda.remove_timelimit(match.group(1))
+ self.reply(reply)
+ def do_changeitem(self, nick, time_, line, **kwargs):
+ self.reply(self.config.agenda.change_agenda_item(line))
+
def do_startvote(self, nick, time_, line, **kwargs):
for messageline in self.config.agenda.start_vote().split('\n'):
self.reply(messageline)
diff --cc bot/tests/run_test.py
index 1358d47,e22516b..bd116ff
--- a/bot/tests/run_test.py
+++ b/bot/tests/run_test.py
@@@ -342,7 -344,7 +344,7 @@@ class MeetBotTest(unittest.TestCase)
def get_simple_agenda_test(self):
test = test_meeting.TestMeeting()
test.set_voters(['x', 'z'])
- test.set_agenda([['first item', ['opt1', 'opt2']], ['second item', []], ['third item', []]])
- test.set_agenda([['first item', ['opt1', 'opt2'], ''], ['second item', [], '']])
++ test.set_agenda([['first item', ['opt1', 'opt2'], ''], ['second item', [], ''], ['third item', [], '']])
test.M.config.manage_agenda = False
test.answer_should_match("20:13:50 <x> #startmeeting",
@@@ -434,18 -427,79 +436,89 @@@
test.answer_should_match('20:13:50 <x> #endmeeting', 'Meeting ended ' +\
'.*\nMinutes:.*\nMinutes \(text\):.*\nLog:.*')
- assert(test.votes() == {'first item': {u'x': 'opt2', u'z': 'opt1'}, 'second item': {}})
+ assert(test.votes() == {'first item': {u'x': 'opt2', u'z': 'opt1'}, 'second item': {}, 'third item': {}})
+
+ def test_agenda_close_voting_after_last_vote(self):
+ test = self.get_simple_agenda_test()
+ test.answer_should_match('20:13:50 <x> #startvote', 'Voting started\. ' +\
+ 'Available voting options are:\n0. opt1\n1. opt2\nVote ' +\
+ '#vote <option number>.\nEnd voting with #endvote.')
+ test.answer_should_match('20:13:50 <x> #startvote', 'Voting is already open. ' +\
+ 'You can end it with #endvote.')
+ test.answer_should_match('20:13:50 <x> #vote 0', 'You voted for #0 - opt1')
+ test.answer_should_match('20:13:50 <z> #vote 0', 'You voted for #0 - opt1. Voting closed.')
+ def test_agenda_time_limit_adding(self):
+ test = self.get_simple_agenda_test()
+ test.answer_should_match('20:13:50 <x> #timelimit', 'Usage "#timelimit ' +\
+ 'add <minutes>:<seconds> <message>" or "' +\
+ '#timelimit list" or "#timelimit remove ' +\
+ '<message>"')
+ test.answer_should_match('20:13:50 <x> #timelimit add 0:1 some other message',
+ 'Added "some other message" reminder in 0:1')
+ test.answer_should_match('20:13:50 <x> #timelimit add 1:0 some message',
+ 'Added "some message" reminder in 1:0')
+ time.sleep(2)
+ last_message = test.log[-1]
+ assert(last_message == 'some other message')
+ reminders = test.M.config.agenda.reminders
+ assert(len(reminders) == 2)
+ for reminder in reminders.values():
+ assert(reminder.__class__ == threading._Timer)
+
+ test.process('20:13:50 <x> #nextitem')
+
+ def test_agenda_time_limit_removing_when_changing_item(self):
+ test = self.get_simple_agenda_test()
+
+ test.process('20:13:50 <x> #timelimit add 0:1 message')
+ assert(len(test.M.config.agenda.reminders) == 1)
+ test.process('20:13:50 <x> #nextitem')
+ assert(len(test.M.config.agenda.reminders) == 0)
+ test.process('20:13:50 <x> #timelimit add 0:1 message')
+ assert(len(test.M.config.agenda.reminders) == 1)
+ test.process('20:13:50 <x> #previtem')
+ assert(len(test.M.config.agenda.reminders) == 0)
+
+ def test_agenda_time_limit_manual_removing(self):
+ test = self.get_simple_agenda_test()
+
+ test.process('20:13:50 <x> #timelimit add 0:1 message')
+ test.process('20:13:50 <x> #timelimit add 0:1 other message')
+ keys = test.M.config.agenda.reminders.keys()
+ keys.sort()
+ assert(keys == ['message', 'other message'])
+
+ test.answer_should_match('20:13:50 <x> #timelimit remove other message', 'Reminder "other message" removed')
+ keys = test.M.config.agenda.reminders.keys()
+ assert(keys == ['message'])
+
+ def test_agenda_time_limit_listing(self):
+ test = self.get_simple_agenda_test()
+ test.process('20:13:50 <x> #timelimit add 0:1 message')
+ test.process('20:13:50 <x> #timelimit add 0:1 other message')
+ test.process('20:13:50 <x> #timelimit add 0:1 yet another message')
+ keys = test.M.config.agenda.reminders.keys()
+ test.answer_should_match('20:13:50 <x> #timelimit list',
+ 'Set reminders: "' + '", "'.join(keys) + '"')
+
+ def test_preset_agenda_time_limits(self):
+ test = self.get_simple_agenda_test()
+ test.M.config.agenda._agenda[0][2] = '1:0 message'
+ test.M.config.agenda._agenda[1][2] = '1:0 another message\n0:10 some other message'
+
+ test.process('20:13:50 <x> #nextitem')
+ keys = test.M.config.agenda.reminders.keys()
+ keys.sort()
+ assert(keys == ['another message', 'some other message'])
+
+ test.process('20:13:50 <x> #previtem')
+ keys = test.M.config.agenda.reminders.keys()
+ keys.sort()
+ assert(keys == ['message'])
+
+ test.process('20:13:50 <x> #nextitem')
+
if __name__ == '__main__':
os.chdir(os.path.join(os.path.dirname(__file__), '.'))
next reply other threads:[~2011-06-25 11:56 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-06-25 11:55 Petteri Räty [this message]
-- strict thread matches above, loose matches on Subject: below --
2011-08-01 14:38 [gentoo-commits] proj/council-webapp:master commit in: / Petteri Räty
2011-07-21 16:06 Petteri Räty
2011-07-05 15:09 Petteri Räty
2011-06-22 7:59 Petteri Räty
2011-06-18 15:46 Petteri Räty
2011-06-05 20:37 Petteri Räty
2011-05-24 9:41 Petteri Räty
2011-05-24 9:41 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=eab5375bf3829daa62fa79f16791bec78ec22257.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