public inbox for gentoo-commits@lists.gentoo.org
 help / color / mirror / Atom feed
* [gentoo-commits] proj/council-webapp:master commit in: bot/ircmeeting/
@ 2011-06-05 20:37 Petteri Räty
  0 siblings, 0 replies; 3+ messages in thread
From: Petteri Räty @ 2011-06-05 20:37 UTC (permalink / raw
  To: gentoo-commits

commit:     ff432f2e42e6ece77ee9539c25ca7f109f24cfcc
Author:     Joachim Filip Ignacy Bartosik <jbartosik <AT> gmail <DOT> com>
AuthorDate: Fri Jun  3 14:59:33 2011 +0000
Commit:     Petteri Räty <betelgeuse <AT> gentoo <DOT> org>
CommitDate: Fri Jun  3 17:36:26 2011 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/council-webapp.git;a=commit;h=ff432f2e

Bot posts voting results to webapp

---
 bot/ircmeeting/agenda.py  |    7 +++++++
 bot/ircmeeting/meeting.py |    5 +++++
 2 files changed, 12 insertions(+), 0 deletions(-)

diff --git a/bot/ircmeeting/agenda.py b/bot/ircmeeting/agenda.py
index 7ee9beb..4f0bd00 100644
--- a/bot/ircmeeting/agenda.py
+++ b/bot/ircmeeting/agenda.py
@@ -89,3 +89,10 @@ class Agenda(object):
         str = urllib.unquote(str)
         result = json.loads(str)
         return result
+
+    def post_result(self):
+        data = urllib.quote(json.dumps([self._votes]))
+        result_url = str.format(self.conf.result_url,
+                      self.conf.voting_results_user,
+                      self.conf.voting_results_password)
+        urllib.urlopen(result_url, data = data)

diff --git a/bot/ircmeeting/meeting.py b/bot/ircmeeting/meeting.py
index b22dac6..a49aaaf 100644
--- a/bot/ircmeeting/meeting.py
+++ b/bot/ircmeeting/meeting.py
@@ -101,6 +101,10 @@ class Config(object):
     # Meeting management urls
     voters_url = 'http://localhost:3000/users/voters'
     agenda_url = 'http://localhost:3000/agendas/current_items'
+    result_url = 'http://localhost:3000/agendas/current_items'
+    # Credentials for posting voting results
+    voting_results_user = 'user'
+    voting_results_password = 'password'
 
     def enc(self, text):
         return text.encode(self.output_codec, 'replace')
@@ -342,6 +346,7 @@ class MeetingCommands(object):
         for messageline in message.split('\n'):
             self.reply(messageline)
         self._meetingIsOver = True
+        self.config.agenda.post_result()
     def do_topic(self, nick, line, **kwargs):
         """Set a new topic in the channel."""
         if not self.isChair(nick): return



^ permalink raw reply related	[flat|nested] 3+ messages in thread

* [gentoo-commits] proj/council-webapp:master commit in: bot/ircmeeting/
@ 2011-06-10 16:46 Petteri Räty
  0 siblings, 0 replies; 3+ messages in thread
From: Petteri Räty @ 2011-06-10 16:46 UTC (permalink / raw
  To: gentoo-commits

commit:     f9e5580110558ccc7a2e0f28791f5e19681bd562
Author:     Joachim Filip Ignacy Bartosik <jbartosik <AT> gmail <DOT> com>
AuthorDate: Mon May 23 11:17:40 2011 +0000
Commit:     Petteri Räty <betelgeuse <AT> gentoo <DOT> org>
CommitDate: Fri Jun 10 15:29:31 2011 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/council-webapp.git;a=commit;h=f9e55801

Bot obtains voters, agenda items and voting options lists from webapp

---
 bot/ircmeeting/agenda.py  |    4 ++--
 bot/ircmeeting/meeting.py |    8 ++++++--
 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]
-



^ permalink raw reply related	[flat|nested] 3+ messages in thread

* [gentoo-commits] proj/council-webapp:master commit in: bot/ircmeeting/
@ 2011-07-05 15:09 Petteri Räty
  0 siblings, 0 replies; 3+ messages in thread
From: Petteri Räty @ 2011-07-05 15:09 UTC (permalink / raw
  To: gentoo-commits

commit:     ae6e10d99051e6e8930e2a816e6545b9f9edb3fa
Author:     Joachim Filip Ignacy Bartosik <jbartosik <AT> gmail <DOT> com>
AuthorDate: Mon Jun 27 14:19:44 2011 +0000
Commit:     Petteri Räty <betelgeuse <AT> gentoo <DOT> org>
CommitDate: Mon Jun 27 14:19:44 2011 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/council-webapp.git;a=commit;h=ae6e10d9

Bot posts log to the website

---
 bot/ircmeeting/agenda.py  |    5 +++--
 bot/ircmeeting/meeting.py |    2 +-
 2 files changed, 4 insertions(+), 3 deletions(-)

diff --git a/bot/ircmeeting/agenda.py b/bot/ircmeeting/agenda.py
index a77aafe..05e4a57 100644
--- a/bot/ircmeeting/agenda.py
+++ b/bot/ircmeeting/agenda.py
@@ -217,10 +217,11 @@ class Agenda(object):
          result = str.format(self.timelimit_missing_msg, message)
       return(result)
 
-    def post_result(self):
+    def post_result(self, lines):
         if not self.conf.manage_agenda:
           return('')
-        data_dict = {'votes' : self._votes, 'agenda' : self._agenda}
+        data_dict = {'votes' : self._votes, 'agenda' : self._agenda,
+                      'lines' : "\n".join(lines)}
         data = urllib.quote(json.dumps(data_dict))
         result_url = str.format(self.conf.result_url,
                       self.conf.voting_results_user,

diff --git a/bot/ircmeeting/meeting.py b/bot/ircmeeting/meeting.py
index a86c782..a15b674 100644
--- a/bot/ircmeeting/meeting.py
+++ b/bot/ircmeeting/meeting.py
@@ -380,7 +380,7 @@ class MeetingCommands(object):
         for messageline in message.split('\n'):
             self.reply(messageline)
         self._meetingIsOver = True
-        self.config.agenda.post_result()
+        self.config.agenda.post_result(self.lines)
     def do_topic(self, nick, line, **kwargs):
         """Set a new topic in the channel."""
         if not self.isChair(nick): return



^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2011-07-05 15:09 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-06-05 20:37 [gentoo-commits] proj/council-webapp:master commit in: bot/ircmeeting/ Petteri Räty
  -- strict thread matches above, loose matches on Subject: below --
2011-06-10 16:46 Petteri Räty
2011-07-05 15:09 Petteri Räty

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox