Add the ambassadors sponsors badge to the oldschool cronjob.

This commit is contained in:
Ralph Bean 2014-02-13 01:50:51 +00:00
parent 54d9911f91
commit 9dc037d36e

View file

@ -85,7 +85,7 @@ def get_fas_groupings(fas_credentials, lookup, **config):
mega_list = request['people']
results = {}
packager_id = None
packager_id, ambassadors_id = None, None
for user in mega_list:
# This is the main check.
for group_name, badge_id in lookup.iteritems():
@ -99,11 +99,20 @@ def get_fas_groupings(fas_credentials, lookup, **config):
if group.name == 'packager':
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:
if role.group_id == packager_id:
if role.role_type == 'sponsor' and role.role_status == 'approved':
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