aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoachim Filip Ignacy Bartosik <jbartosik@gmail.com>2011-05-23 13:17:40 +0200
committerJoachim Filip Ignacy Bartosik <jbartosik@gmail.com>2011-06-10 17:29:31 +0200
commitf9e5580110558ccc7a2e0f28791f5e19681bd562 (patch)
tree15dcd7f9e87c76c4b72aded3e40ae87ac90a93e6
parentBugfix - agenda items management (diff)
downloadcouncil-webapp-f9e5580110558ccc7a2e0f28791f5e19681bd562.tar.gz
council-webapp-f9e5580110558ccc7a2e0f28791f5e19681bd562.tar.bz2
council-webapp-f9e5580110558ccc7a2e0f28791f5e19681bd562.zip
Bot obtains voters, agenda items and voting options lists from webapp
-rw-r--r--bot/ircmeeting/agenda.py4
-rw-r--r--bot/ircmeeting/meeting.py8
2 files changed, 8 insertions, 4 deletions
diff --git a/bot/ircmeeting/agenda.py b/bot/ircmeeting/agenda.py
index 4f0bd00..2269f6f 100644
--- a/bot/ircmeeting/agenda.py
+++ b/bot/ircmeeting/agenda.py
@@ -54,7 +54,7 @@ class Agenda(object):
self._vote_open = True
options = "\n"
for i in range(len(self._agenda[self._current_item][1])):
- options += str.format("{}. {}\n", i, self._agenda[self._current_item][i])
+ options += str.format("{}. {}\n", i, self._agenda[self._current_item][1][i])
return str.format(self.voting_open_msg, options)
def end_vote(self):
@@ -82,7 +82,7 @@ class Agenda(object):
return self.out_of_range_msg
self._votes[self._agenda[self._current_item][0]][nick] = self._agenda[self._current_item][1][opt]
- return str.format(self.vote_confirm_msg, opt, self._agenda[self._current_item][opt])
+ return str.format(self.vote_confirm_msg, opt, self._agenda[self._current_item][1][opt])
def _get_json(self, url):
str = urllib.urlopen(url).read()
diff --git a/bot/ircmeeting/meeting.py b/bot/ircmeeting/meeting.py
index a49aaaf..108ae1d 100644
--- a/bot/ircmeeting/meeting.py
+++ b/bot/ircmeeting/meeting.py
@@ -331,8 +331,13 @@ class MeetingCommands(object):
for messageline in self.config.agenda.start_vote().split('\n'):
self.reply(messageline)
+ def do_endvote(self, nick, time_, line, **kwargs):
+ for messageline in self.config.agenda.end_vote().split('\n'):
+ self.reply(messageline)
+
def do_vote(self, nick, time_, line, **kwargs):
- self.reply(self.config.agenda.vote(nick, line))
+ for messageline in self.config.agenda.vote(nick, line).split('\n'):
+ self.reply(messageline)
def do_endmeeting(self, nick, time_, **kwargs):
"""End the meeting."""
@@ -696,4 +701,3 @@ if __name__ == '__main__':
#M.save() # should be done by #endmeeting in the logs!
else:
print 'Command "%s" not found.'%sys.argv[1]
-