Skip to content

Commit 8a976bd

Browse files
committed
Use event ID for the cutoff point
1 parent e69702f commit 8a976bd

File tree

2 files changed

+5
-3
lines changed

2 files changed

+5
-3
lines changed

outlook/indico_outlook/calendar.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,8 @@
55
# them and/or modify them under the terms of the MIT License; see
66
# the LICENSE file for more details.
77

8-
from datetime import datetime
98
from pprint import pformat
109

11-
import pytz
1210
import requests
1311
from markupsafe import Markup
1412
from requests.exceptions import RequestException, Timeout
@@ -116,7 +114,7 @@ def _update_calendar_entry(entry, settings):
116114
return True
117115

118116
# Use common format for event calendar ID if the event was created on or after 2025-04-06
119-
if entry.event.created_dt >= datetime(2025, 4, 6, tzinfo=pytz.UTC):
117+
if settings['event_id_cutoff'] != -1 and entry.event_id > settings['event_id_cutoff']:
120118
unique_id = entry.event.ical_uid
121119
else:
122120
unique_id = '{}{}_{}'.format(settings['id_prefix'], user.id, entry.event_id)

outlook/indico_outlook/plugin.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,9 @@ class SettingsForm(IndicoForm):
5252
id_prefix = StringField(_('Prefix'),
5353
description=_('Prefix for calendar item IDs. If you change this, existing calendar entries '
5454
'cannot be deleted/updated anymore!'))
55+
event_id_cutoff = IntegerField(_('Event ID Cutoff'), [NumberRange(min=-1)],
56+
description=_('Last event ID before switching to new calendar item ID format.'
57+
' Set to -1 to keep the old format for all calendar items.'))
5558
timeout = FloatField(_('Request timeout'), [NumberRange(min=0.25)], description=_('Request timeout in seconds'))
5659
max_event_duration = TimeDeltaField(_('Maximum Duration'), [DataRequired()], units=('days',),
5760
description=_('Events lasting longer will not be sent to Exchange'))
@@ -144,6 +147,7 @@ class OutlookPlugin(IndicoPlugin):
144147
'reminder': True,
145148
'reminder_minutes': 15,
146149
'id_prefix': 'indico_',
150+
'event_id_cutoff': -1,
147151
'timeout': 3,
148152
'max_event_duration': timedelta(days=30)
149153
}

0 commit comments

Comments
 (0)