Adds second- and fourth- week recurring meetings

Change-Id: I072e0018f24ced12b0b4557c8cc2db6b6a8d0ff5
This commit is contained in:
rbowen 2021-03-12 09:11:55 -05:00
parent da7f28db56
commit 90ddef2d8c
5 changed files with 143 additions and 12 deletions

View File

@ -163,21 +163,13 @@ yaml2ical supports a number of possible frequency options:
* ``quadweekly-week-2``, ``quadweekly-alternate``: Occurs when ``ISOweek % 4 == 2``
* ``quadweekly-week-3``: Occurs when ``ISOweek % 4 == 3``
* Event occurs in the first week of a month:
* Event occurs in a particular week of a month:
* ``first-monday``: On the first Monday of the month.
* ``first-tuesday``: On the first Tuesday of the month.
* ``first-wednesday``: On the first Wednesday of the month.
* ``first-thursday``: On the first Thursday of the month.
* ``first-friday``: On the first Friday of the month.
* Event occurs in the third week of a month:
* ``third-monday``: On the third Monday of the month.
* ``third-tuesday``: On the third Tuesday of the month.
* ``second-tuesday``: On the second Tuesday of the month.
* ``third-wednesday``: On the third Wednesday of the month.
* ``third-thursday``: On the third Thursday of the month.
* ``third-friday``: On the third Friday of the month.
* ``fourth-thursday``: On the fourth Thursday of the month.
* etc
* Event doesn't happen on a defined schedule but is used as a placeholder for
html generation:

View File

@ -153,11 +153,21 @@ class Schedule(object):
'first-wednesday': set([0, 1, 2, 3]),
'first-thursday': set([0, 1, 2, 3]),
'first-friday': set([0, 1, 2, 3]),
'second-monday': set([0, 1, 2, 3]),
'second-tuesday': set([0, 1, 2, 3]),
'second-wednesday': set([0, 1, 2, 3]),
'second-thursday': set([0, 1, 2, 3]),
'second-friday': set([0, 1, 2, 3]),
'third-monday': set([0, 1, 2, 3]),
'third-tuesday': set([0, 1, 2, 3]),
'third-wednesday': set([0, 1, 2, 3]),
'third-thursday': set([0, 1, 2, 3]),
'third-friday': set([0, 1, 2, 3]),
'fourth-monday': set([0, 1, 2, 3]),
'fourth-tuesday': set([0, 1, 2, 3]),
'fourth-wednesday': set([0, 1, 2, 3]),
'fourth-thursday': set([0, 1, 2, 3]),
'fourth-friday': set([0, 1, 2, 3]),
}
return len(week[self.freq].intersection(week[other.freq])) > 0

View File

@ -254,9 +254,19 @@ supported_recurrences = {
'first-wednesday': MonthlyRecurrence(week=1, day='Wednesday'),
'first-thursday': MonthlyRecurrence(week=1, day='Thursday'),
'first-friday': MonthlyRecurrence(week=1, day='Friday'),
'second-monday': MonthlyRecurrence(week=2, day='Monday'),
'second-tuesday': MonthlyRecurrence(week=2, day='Tuesday'),
'second-wednesday': MonthlyRecurrence(week=2, day='Wednesday'),
'second-thursday': MonthlyRecurrence(week=2, day='Thursday'),
'second-friday': MonthlyRecurrence(week=2, day='Friday'),
'third-monday': MonthlyRecurrence(week=3, day='Monday'),
'third-tuesday': MonthlyRecurrence(week=3, day='Tuesday'),
'third-wednesday': MonthlyRecurrence(week=3, day='Wednesday'),
'third-thursday': MonthlyRecurrence(week=3, day='Thursday'),
'third-friday': MonthlyRecurrence(week=3, day='Friday'),
'fourth-monday': MonthlyRecurrence(week=4, day='Monday'),
'fourth-tuesday': MonthlyRecurrence(week=4, day='Tuesday'),
'fourth-wednesday': MonthlyRecurrence(week=4, day='Wednesday'),
'fourth-thursday': MonthlyRecurrence(week=4, day='Thursday'),
'fourth-friday': MonthlyRecurrence(week=4, day='Friday'),
}

View File

@ -447,6 +447,48 @@ description: >
Example Monthly meeting
"""
SECOND_WEDNESDAY_MEETING = """
project: CentOS Cloud SIG
agenda_url: http://agenda.com/
project_url: http://project.com
schedule:
- time: '2200'
day: Wednesday
irc: centos-meeting
frequency: second-wednesday
chair: Jane Deer
description: >
Example Monthly meeting
"""
SECOND_THURSDAY_MEETING = """
project: CentOS Storage SIG
agenda_url: http://agenda.com/
project_url: http://project.com
schedule:
- time: '2200'
day: Thursday
irc: centos-meeting
frequency: second-thursday
chair: Jane Deer
description: >
Example Monthly meeting
"""
SECOND_FRIDAY_MEETING = """
project: CentOS Hyperscale SIG
agenda_url: http://agenda.com/
project_url: http://project.com
schedule:
- time: '2200'
day: Friday
irc: centos-meeting
frequency: second-friday
chair: Jane Deer
description: >
Example Monthly meeting
"""
THIRD_MONDAY_MEETING = """
project: OpenStack Random Meeting
agenda_url: http://agenda.com/
@ -516,3 +558,73 @@ chair: John Doe
description: >
Example Monthly meeting
"""
FOURTH_MONDAY_MEETING = """
project: CentOS SIG Meeting
agenda_url: http://agenda.com/
project_url: http://project.com
schedule:
- time: '2200'
day: Monday
irc: centos-meeting
frequency: fourth-monday
chair: Jane Deer
description: >
Example Monthly meeting
"""
FOURTH_TUESDAY_MEETING = """
project: CentOS SIG Meeting
agenda_url: http://agenda.com/
project_url: http://project.com
schedule:
- time: '2200'
day: Tuesday
irc: centos-meeting
frequency: fourth-tuesday
chair: Jane Deer
description: >
Example Monthly meeting
"""
FOURTH_WEDNESDAY_MEETING = """
project: CentOS SIG Meeting
agenda_url: http://agenda.com/
project_url: http://project.com
schedule:
- time: '2200'
day: Wednesday
irc: centos-meeting
frequency: fourth-wednesday
chair: Jane Deer
description: >
Example Monthly meeting
"""
FOURTH_THURSDAY_MEETING = """
project: CentOS SIG Meeting
agenda_url: http://agenda.com/
project_url: http://project.com
schedule:
- time: '2200'
day: Thursday
irc: centos-meeting
frequency: fourth-thursday
chair: Jane Deer
description: >
Example Monthly meeting
"""
FOURTH_FRIDAY_MEETING = """
project: CentOS SIG Meeting
agenda_url: http://agenda.com/
project_url: http://project.com
schedule:
- time: '2200'
day: Friday
irc: centos-meeting
frequency: fourth-friday
chair: Jane Deer
description: >
Example Monthly meeting
"""

View File

@ -105,6 +105,13 @@ class RecurrenceTestCase(unittest.TestCase):
self.next_meeting(rec),
)
def test_monthly_fourth_week(self):
rec = recurrence.MonthlyRecurrence(week=4, day='Tuesday')
self.assertEqual(
datetime.datetime(2014, 11, 26, 2, 47, 28, 832666),
self.next_meeting(rec),
)
def test_monthly_invalid_week(self):
rec = recurrence.MonthlyRecurrence(week=6, day='Wednesday')
self.assertRaises(