(domain, active_sql_location=None)
Return a list of supply point ids for the selected location
    and all of its descendants OR all supply point ids in the domain.
Return a list of supply point ids for the selected location
    and all of its descendants OR all supply point ids in the domain.
Return a list of supply point ids for the selected location and all of its descendants OR all supply point ids in the domain .
def get_relevant_supply_point_ids(domain, active_sql_location=None):
    """
    Return a list of supply point ids for the selected location
    and all of its descendants OR all supply point ids in the domain.
    """
    def filter_relevant(queryset):
        return queryset.filter(
            supply_point_id__isnull=False
        ).values_list(
            'supply_point_id',
            flat=True
        )

    if active_sql_location:
        supply_point_ids = []
        if active_sql_location.supply_point_id:
            supply_point_ids.append(active_sql_location.supply_point_id)
        supply_point_ids += list(
            filter_relevant(active_sql_location.get_descendants())
        )

        return supply_point_ids
    else:
        return list(filter_relevant(SQLLocation.objects.filter(domain=domain)))
def get_relevant_supply_point_ids ( domain , active_sql_location = None ) : def filter_relevant ( queryset ) : return queryset . filter ( supply_point_id__isnull = False ) . values_list ( 'supply_point_id' , flat = True ) if active_sql_location : supply_point_ids = [ ] if active_sql_location . supply_point_id : supply_point_ids . append ( active_sql_location . supply_point_id ) supply_point_ids += list ( filter_relevant ( active_sql_location . get_descendants ( ) ) ) return supply_point_ids else : return list ( filter_relevant ( SQLLocation . objects . filter ( domain = domain ) ) )