Ignore:
Timestamp:
Nov 5, 2012, 4:23:58 AM (13 years ago)
Author:
Alex Dehnert <adehnert@…>
Branches:
master, space-access, stable, stage
Children:
1f48e70
Parents:
bbc8f73
git-author:
Alex Dehnert <adehnert@…> (11/05/12 04:23:58)
git-committer:
Alex Dehnert <adehnert@…> (11/05/12 04:23:58)
Message:

Remove inactive groups from asa-official (ASA-#161)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • asadb/groups/diffs.py

    r9882429 rca9e802  
    243243
    244244
     245def default_active_pred():
     246    status_objs = groups.models.GroupStatus.objects.filter(slug__in=['active', 'suspended', 'nge'])
     247    status_pks = [status.pk for status in status_objs]
     248    def pred(version, fields):
     249        return fields['group_status'] in status_pks
     250    return pred
     251
    245252def funded_pred(funding_slug):
    246253    classes = groups.models.GroupClass.objects
     
    248255    fundings = groups.models.GroupFunding.objects
    249256    fund_pk = fundings.get(slug=funding_slug).pk
     257    active_pred = default_active_pred()
    250258    def pred(version, fields):
    251         return fields['group_class'] == class_pk and fields['group_funding'] == fund_pk
     259        return active_pred(version, fields) and fields['group_class'] == class_pk and fields['group_funding'] == fund_pk
    252260    return pred
    253261
     
    291299    sao_callback.care_about_groups = False
    292300    callbacks.append(sao_callback)
    293     callbacks.append(UpdateOfficerListCallback(asa_all_groups_list))
     301    callbacks.append(UpdateOfficerListCallback(
     302        listobj=asa_all_groups_list,
     303        include_pred=default_active_pred(),
     304    ))
    294305    callbacks.append(UpdateOfficerListCallback(
    295306        listobj=finboard_groups_list,
Note: See TracChangeset for help on using the changeset viewer.