Handle the case when the gap between summit and release is small
Typically we have long enough post release to conduct an entire TC election. However with Train (and possibly others) the gap between release and summit is too short to allow for that. The current code will set the eligibility criteria to allow for the release date meaning that it's possibly for for electorate to change post-election which is a bad thing. Let's detect that and set the timeframe to a more logical value. Before: Setting TC Election Summit is at: 2019-04-22 Latest possible completion is at: 2019-03-11 Moving back to Tuesday: 2019-03-05 TC Election from 2019-02-26T23:45 to 2019-03-05T23:45 TC Campaigning from 2019-02-19T23:45 to 2019-02-26T23:45 TC Nominations from 2019-02-12T23:45 to 2019-02-19T23:45 Set email_deadline to 2019-02-19T00:00 * Setting TC timeframe end to stein Release date 2019-04-10T00:00 Begining of Rocky Cycle @ 2018-02-09 00:00:00+00:00 * End of Stein cycle @ 2019-04-10 00:00:00+00:00 * Election timeframe: 425 days, 0:00:00s * Looks like election timespan is outside of 'normal' * Minimum: 334 days, 14:00:00 * Current: 425 days, 0:00:00 * Maximum: 395 days, 10:00:00 After: Setting TC Election Summit is at: 2019-04-22 Latest possible completion is at: 2019-03-11 Moving back to Tuesday: 2019-03-05 TC Election from 2019-02-26T23:45 to 2019-03-05T23:45 TC Campaigning from 2019-02-19T23:45 to 2019-02-26T23:45 TC Nominations from 2019-02-12T23:45 to 2019-02-19T23:45 Set email_deadline to 2019-02-19T00:00 * Setting TC timeframe end to email_deadline Begining of Rocky Cycle @ 2018-02-09 00:00:00+00:00 * End of Stein cycle @ 2019-02-19 00:00:00+00:00 * Election timeframe: 375 days, 0:00:00s Change-Id: I2ca38ea68cd179659a53a4bebe68215d91865e67
This commit is contained in:
parent
24c37f1010
commit
ae9fefbcc4
@ -139,19 +139,28 @@ def main():
|
||||
print('Set email_deadline to %s' % (iso_fmt(email_deadline)))
|
||||
|
||||
if args.type == 'PTL':
|
||||
# For a PTL election we haven't closed the current cycle so we set thew
|
||||
# timeframe right up to the begining of the nomination period.
|
||||
print('Setting PTL timeframe end to email_dedline')
|
||||
# For a PTL election we haven't closed the current cycle so we set the
|
||||
# timeframe right up to the beginning of the nomination period.
|
||||
print('Setting PTL timeframe end to email_deadline')
|
||||
timeframe_end = email_deadline
|
||||
else:
|
||||
# For a TC election we have completed the previous cycle so grab the
|
||||
# release dat for it.
|
||||
# For a TC election we should have completed the previous cycle so grab
|
||||
# the release date for it. It is however possible that the gap between
|
||||
# that release and the summit doesn't allow for an election. In that
|
||||
# case we need to use the email_deadline for timeframe_end
|
||||
|
||||
# Grab the rlease data and fromvert it to a datetime
|
||||
timeframe_end = series_data[idx+1]['initial-release']
|
||||
timeframe_end = datetime.datetime.combine(timeframe_end,
|
||||
datetime.time(0, 0))
|
||||
timeframe_end = timeframe_end.replace(tzinfo=pytz.UTC)
|
||||
print('Setting TC timeframe end to %s Release date %s' %
|
||||
(series_data[idx+1]['name'], iso_fmt(timeframe_end)))
|
||||
|
||||
if timeframe_end < email_deadline:
|
||||
print('Setting TC timeframe end to %s Release date %s' %
|
||||
(series_data[idx+1]['name'], iso_fmt(timeframe_end)))
|
||||
else:
|
||||
timeframe_end = email_deadline
|
||||
print('Setting TC timeframe end to email_deadline')
|
||||
|
||||
print('Begining of %s Cycle @ %s' % (names[idx+2].capitalize(),
|
||||
timeframe_start))
|
||||
|
Loading…
Reference in New Issue
Block a user