Include current affiliation in job output
We can't fail a nomination based on affiliaton, but it's somewhat useful to see it when evaluation a candidate. This change displays the current affiliation for the candidate under review. Change-Id: I7a28e6cec6c46af35ac9bf5ebf30fcec71fbbd43
This commit is contained in:
parent
2647c469cc
commit
db3d30a466
@ -73,6 +73,18 @@ def validate_member(filepath, verbose=0):
|
||||
return is_valid
|
||||
|
||||
|
||||
# NOTE(tonyb): Currently verbose isn't used but it's included to keep
|
||||
# the interface the same as the validate_*() functions.
|
||||
def show_affiliation(filepath, verbose=0):
|
||||
print('Show member affiliation if available')
|
||||
print('------------------------------------')
|
||||
|
||||
email = utils.get_email(filepath)
|
||||
member = utils.lookup_member(email)
|
||||
|
||||
print('Affiliation: %s' % (utils.current_member_affiliation(member)))
|
||||
|
||||
|
||||
def check_for_changes(projects, filepath, limit, verbose=0):
|
||||
print('Looking for validating changes')
|
||||
print('------------------------------')
|
||||
@ -165,6 +177,7 @@ def main():
|
||||
candidate_ok &= validate_filename(filepath)
|
||||
candidate_ok &= validate_project(filepath, projects)
|
||||
candidate_ok &= validate_member(filepath, verbose=args.verbose)
|
||||
show_affiliation(filepath, verbose=args.verbose)
|
||||
|
||||
if candidate_ok:
|
||||
if (election_type == 'ptl'
|
||||
|
@ -133,6 +133,15 @@ def lookup_osf(email, group_slug=None, verbose=0):
|
||||
return result
|
||||
|
||||
|
||||
def current_member_affiliation(member):
|
||||
organization = ""
|
||||
if member.get('data'):
|
||||
for affiliation in member["data"][0].get("all_affiliations", []):
|
||||
if affiliation.get("is_current", False):
|
||||
organization = affiliation.get("organization", {}).get("name")
|
||||
return organization
|
||||
|
||||
|
||||
def lookup_member(email, verbose=0):
|
||||
"""Lookup profiles of OSF members"""
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user