Merge "Use PTL election results for governance updates"
This commit is contained in:
commit
ff1d637407
|
@ -54,6 +54,7 @@ def load_projects(projects_fname):
|
|||
|
||||
|
||||
def update_projects(projects_fname, candidates_list, projects):
|
||||
results = utils.get_ptl_results()
|
||||
project_count = 0
|
||||
with open(projects_fname, 'w') as fh:
|
||||
skip = 0
|
||||
|
@ -78,6 +79,17 @@ def update_projects(projects_fname, candidates_list, projects):
|
|||
}]
|
||||
print('TC to appoint PTL for %s' % (p))
|
||||
nr_candidates = len(candidates)
|
||||
# Remove non-elected candidates if the election is closed
|
||||
# TODO(fungi): rework this entire function to just use the
|
||||
# election results file if we have one and not iterate over
|
||||
# the candidates tree
|
||||
if nr_candidates > 1:
|
||||
for c1 in results['candidates'].get(p, []):
|
||||
if not c1['elected']:
|
||||
for c2 in list(candidates):
|
||||
if c1['email'] == c2['email']:
|
||||
candidates.remove(c2)
|
||||
nr_candidates = len(candidates)
|
||||
# Only update the PTL if there is a single candidate
|
||||
if nr_candidates == 1:
|
||||
# Replace empty IRC nick strings with something useful
|
||||
|
|
|
@ -368,3 +368,11 @@ def build_candidates_list(election=conf['release']):
|
|||
'projects': list(projects),
|
||||
'leaderless': list(leaderless),
|
||||
'candidates': candidates_lists}
|
||||
|
||||
|
||||
def get_ptl_results(election=conf['release']):
|
||||
try:
|
||||
resultfd = open('doc/source/results/%s/ptl.yaml' % election)
|
||||
except FileNotFoundError:
|
||||
return {'candidates': {}}
|
||||
return yaml.safe_load(resultfd)
|
||||
|
|
Loading…
Reference in New Issue