Skip to content
Snippets Groups Projects
Commit bb7a9c5e authored by Andreas Hubel's avatar Andreas Hubel
Browse files

feat(scheduleimport): add legacy_id_offset option

parent 665dff56
No related branches found
No related tags found
No related merge requests found
......@@ -22,6 +22,7 @@ class ScheduleJSONSupport(BaseScheduleSupport):
'kind': ('string', 'assembly', False, 'kind of events, either `assembly` or `official` or `sos` or `lightning`'),
'headers': ('dict', {}, False, 'HTTP headers to send with the request e.g. Authorization'),
'auth': ('string', None, False, 'HTTP Authentification header e.g. `Token 123456`'),
'legacy_id_offset': ('int', None, False, 'Offset to add to the legacy integer `id` to avoid collisions with other sources'),
}
# fmt: on
......@@ -91,10 +92,16 @@ class ScheduleJSONSupport(BaseScheduleSupport):
}
def computed_data(self, event: dict):
# TODO only add feedback_url if feedback is enabled via configuraiton_fields in ScheduleSource config
data = {}
data['origin_url'] = event['url']
# add feedback_url if feedback is enabled via configuraiton_fields in ScheduleSource config
if self.conf_value('feedback'):
return {'feedback_url': f"{event['url']}feedback/"}
return {}
data['feedback_url'] = f"{event['url']}feedback/"
if self.conf_value('legacy_id_offset'):
data['id'] = event['id'] + self.conf_value('legacy_id_offset')
return data
class ScheduleJSON:
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment