lpschedule-generator

libreplanet schedule generator - ricketyspace.net/lpschedule-generator
git clone git://git.ricketyspace.net/lpschedule-generator.git
Log | Files | Refs

commit bcdd34fe2e81dd7d6757ea99c915ddb7f782b0bb
parent 59b9d5c3c3ab0ef280e151dc21d201e911261ecc
Author: rsiddharth <rsd@gnu.org>
Date:   Mon, 29 May 2017 22:34:46 +0000

lps_gen.py: Update LPiCal.

* lps_gen.py (LPiCal.add_event): Update method. New argument `t_name`.
(gen_ical): Update method.
* tests/test_lps_gen.py (TestLPiCal.test_add_event): Update method.

Diffstat:
lps_gen.py | 11++++++++---
tests/test_lps_gen.py | 12+++++++++---
2 files changed, 17 insertions(+), 6 deletions(-)

diff --git a/lps_gen.py b/lps_gen.py @@ -215,7 +215,8 @@ class LPiCal(object): return attendee - def add_event(self, month, day, t_start, t_end, session, session_info): + def add_event(self, month, day, t_start, t_end, t_name, session, + session_info): """Adds event to calendar. """ event = Event() @@ -225,7 +226,11 @@ class LPiCal(object): event['status'] = vText('CONFIRMED') event['method'] = vText('PUBLISH') - event['summary'] = session + if session == 'st-from-ts': + event['summary'] = t_name + else: + event['summary'] = session + event['location'] = vText(session_info['room']) # Get rid of HTML in 'desc' @@ -268,7 +273,7 @@ class LPiCal(object): # this timeslot continue for session, session_info in sessions.iteritems(): - self.add_event(month, day, t_start, t_end, + self.add_event(month, day, t_start, t_end, t_name, session, session_info) return self.cal.to_ical() diff --git a/tests/test_lps_gen.py b/tests/test_lps_gen.py @@ -279,8 +279,9 @@ class TestLPiCal(object): for timeslot_str, sessions in timeslots.iteritems(): t_start, t_end, t_name = self.lp_ical.get_timeslot(timeslot_str) for session, session_info in sessions.iteritems(): - event = self.lp_ical.add_event(month, day, t_start, t_end, - session, session_info) + event = self.lp_ical.add_event(month, day, + t_start, t_end, t_name, + session, session_info) assert event['uid'] not in uids uids.append(event['uid']) @@ -288,7 +289,12 @@ class TestLPiCal(object): assert event['class'] == 'PUBLIC' assert event['status'] == 'CONFIRMED' assert event['method'] == 'PUBLISH' - assert event['summary'] == session + + if session == 'st-from-ts': + assert event['summary'] == t_name + else: + assert event['summary'] == session + assert event['location'] == session_info['room'] assert event['description'] == BeautifulSoup(' '.join( session_info['desc']).replace(