Add ability to have per-meeting chairs

Wanting to schedule multiple meeting slots is often driven by a desire
to include more timezones; there's no reason to assume that a single
person will be available to chair all meetings.

Change-Id: If7f565d481dd0ae4bd4ee084cfddb203d170b2e8
This commit is contained in:
Tim Burke 2025-04-09 12:15:05 -07:00
parent 3178bac6f8
commit 630657cafd
7 changed files with 56 additions and 5 deletions

View File

@ -128,7 +128,8 @@ Each meeting consists of:
* ``skip_date``: Skip the meeting for specified date.
Format as ``start_date``
* ``reason``: A comment for why the meeting was skipped
* ``chair``: name of the meeting's chair [MANDATORY]
* ``chair``: name of the schedule's chair (defaults to meeting's chair)
* ``chair``: name of the meeting's chair [MANDATORY, unless all schedules have a chair]
* ``description``: a paragraph description about the meeting [MANDATORY]
* ``agenda_url``: a link to the agenda page for the meeting
* ``project_url``: a link to the project home page for the meeting

View File

@ -7,11 +7,13 @@
{% for schedule in meeting.schedules %}
<li>{{ schedule.recurrence }} on {{ schedule.day }} at
<a href="http://www.timeanddate.com/worldclock/fixedtime.html?hour={{ schedule.utc[:2] }}&min={{ schedule.utc[2:] }}&sec=0">{{ schedule.utc }} UTC</a>
in #{{ schedule.irc }}</li>
in #{{ schedule.irc }}{% if schedule.chair != meeting.chair %}, chair: {{ schedule.chair }}{% endif %}</li>
{% endfor %}
</ul>
{% if meeting.chair %}
Chair (to contact for more information): {{ meeting.chair }}</p>
{% endif %}
{{ meeting.description|urlize }}

View File

@ -8,12 +8,13 @@ schedule:
day: Thursday
irc: openstack-meeting
frequency: quadweekly
chair: Jane Doe
- time: '600'
duration: 45
start_date: 20150801
day: Thursday
irc: openstack-meeting
frequency: quadweekly-alternate
chair: John Doe
chair: John Doe
description: >
quadweekly

View File

@ -60,7 +60,7 @@ class Yaml2IcalCalendar(icalendar.Calendar):
# add ical description
project_descript = "Project: %s" % (meeting.project)
chair_descript = "Chair: %s" % (meeting.chair)
chair_descript = "Chair: %s" % (sch.chair)
descript_descript = "Description: %s" % (meeting.description)
ical_descript = "\n".join((project_descript,
chair_descript,

View File

@ -54,6 +54,7 @@ class Schedule(object):
self.project = meeting.project
self.filefrom = meeting.filefrom
self.chair = sched_yaml.get('chair', meeting.chair)
# mandatory: time, day, irc, freq, recurrence
try:
self.utc = sched_yaml['time']
@ -189,7 +190,6 @@ class Meeting(object):
yaml_obj = yaml.safe_load(data)
try:
self.chair = yaml_obj['chair']
self.description = yaml_obj['description']
self.project = yaml_obj['project']
except KeyError as e:
@ -197,6 +197,15 @@ class Meeting(object):
"attribute '{0}'".format(e.args[0]))
raise
try:
self.chair = yaml_obj['chair']
except KeyError as e:
if any('chair' not in s for s in yaml_obj['schedule']):
print("Invalid YAML meeting definition - missing "
"attribute '{0}'".format(e.args[0]))
raise
self.chair = None
# Find any extra values the user has provided that they might
# want to have access to in their templates.
self.extras = {}

View File

@ -86,6 +86,25 @@ agenda: |
* Top bugs this week
"""
ALTERNATING_CHAIRS_MEETING = """
project: OpenStack Subteam Meeting
schedule:
- time: '1200'
day: Wednesday
irc: openstack-meeting
frequency: biweekly-even
chair: Jane Developer
- time: '2200'
day: Wednesday
irc: openstack-meeting
frequency: biweekly-odd
chair: John Developer
description: >
Weekly meeting for Subteam project.
agenda: |
* Top bugs this week
"""
BIWEEKLY_EVEN_MEETING = """
project: OpenStack Subteam 12 Meeting
schedule:

View File

@ -31,6 +31,16 @@ class MeetingTestCase(unittest.TestCase):
self.assertEqual('Joe Developer', m.chair)
self.assertEqual('Weekly meeting for Subteam project.\n',
m.description)
self.assertEqual('Joe Developer', m.schedules[0].chair)
def test_chair_overrides(self):
m = meeting.load_meetings(sample_data.ALTERNATING_CHAIRS_MEETING)[0]
self.assertEqual('OpenStack Subteam Meeting', m.project)
self.assertIsNone(m.chair)
self.assertEqual('Weekly meeting for Subteam project.\n',
m.description)
self.assertEqual('Jane Developer', m.schedules[0].chair)
self.assertEqual('John Developer', m.schedules[1].chair)
def should_be_conflicting(self, yaml1, yaml2):
"""Exception is raised when meetings should conflict."""
@ -208,6 +218,15 @@ class MeetingTestCase(unittest.TestCase):
cal.add_meeting(m)
self.assertEqual(cal, ical.Yaml2IcalCalendar())
def test_alternating_chairs_meeting(self):
meeting_yaml = sample_data.ALTERNATING_CHAIRS_MEETING
m = meeting.load_meetings(meeting_yaml)[0]
cal = ical.Yaml2IcalCalendar()
cal.add_meeting(m)
self.assertEqual(2, len(cal.events), cal)
self.assertIn('Chair: Jane Developer', cal.events[0]['description'])
self.assertIn('Chair: John Developer', cal.events[1]['description'])
def test_skip_meeting_missing_skip_date(self):
self.assertRaises(KeyError,
meeting.load_meetings,