Merge "Fix setup_election_config for combined election events"

This commit is contained in:
Zuul 2023-03-25 01:49:18 +00:00 committed by Gerrit Code Review
commit 474001d298

View File

@ -194,13 +194,11 @@ def main():
end = end.replace(hour=23, minute=45) end = end.replace(hour=23, minute=45)
events = [] events = []
for event in params['events']: for event in params['events']:
e_types = [args.type]
if args.type == 'combined': if args.type == 'combined':
e_types = ['PTL', 'TC']
if event == 'Campaigning': if event == 'Campaigning':
name = 'TC %s' % event e_types = ['TC']
else:
name = 'TC & PTL %s' % event
else:
name = '%s %s' % (args.type, event)
start = end - TWO_WEEK start = end - TWO_WEEK
# For a TC or combined election we want the email deadline to match the # For a TC or combined election we want the email deadline to match the
# beginning of the Campaigning period, which gives the officials time # beginning of the Campaigning period, which gives the officials time
@ -218,6 +216,8 @@ def main():
if event == 'Election': if event == 'Election':
schedule = utils.get_schedule_data(names[idx+1]) schedule = utils.get_schedule_data(names[idx+1])
validate_tc_charter(args.type, schedule, start, end) validate_tc_charter(args.type, schedule, start, end)
for e_type in e_types:
name = '%s %s' % (e_type, event)
events.insert(0, OrderedDict(name=name, events.insert(0, OrderedDict(name=name,
start=iso_fmt(start), start=iso_fmt(start),
end=iso_fmt(end))) end=iso_fmt(end)))