Add the ambassadors sponsors badge to the oldschool cronjob.
This commit is contained in:
parent
54d9911f91
commit
9dc037d36e
1 changed files with 10 additions and 1 deletions
|
@ -85,7 +85,7 @@ def get_fas_groupings(fas_credentials, lookup, **config):
|
||||||
mega_list = request['people']
|
mega_list = request['people']
|
||||||
|
|
||||||
results = {}
|
results = {}
|
||||||
packager_id = None
|
packager_id, ambassadors_id = None, None
|
||||||
for user in mega_list:
|
for user in mega_list:
|
||||||
# This is the main check.
|
# This is the main check.
|
||||||
for group_name, badge_id in lookup.iteritems():
|
for group_name, badge_id in lookup.iteritems():
|
||||||
|
@ -99,11 +99,20 @@ def get_fas_groupings(fas_credentials, lookup, **config):
|
||||||
if group.name == 'packager':
|
if group.name == 'packager':
|
||||||
packager_id = group.id
|
packager_id = group.id
|
||||||
|
|
||||||
|
if not ambassadors_id:
|
||||||
|
for group in user.memberships:
|
||||||
|
if group.name == 'ambassadors':
|
||||||
|
ambassadors_id = group.id
|
||||||
|
|
||||||
for role in user.roles:
|
for role in user.roles:
|
||||||
if role.group_id == packager_id:
|
if role.group_id == packager_id:
|
||||||
if role.role_type == 'sponsor' and role.role_status == 'approved':
|
if role.role_type == 'sponsor' and role.role_status == 'approved':
|
||||||
results['sponsors'] = results.get('sponsors', []) + [user]
|
results['sponsors'] = results.get('sponsors', []) + [user]
|
||||||
|
|
||||||
|
if role.group_id == ambassadors_id:
|
||||||
|
if role.role_type == 'sponsor' and role.role_status == 'approved':
|
||||||
|
results['ambassadors_sponsors'] = results.get('ambassadors_sponsors', []) + [user]
|
||||||
|
|
||||||
return results
|
return results
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue