Пример #1
0
def org_spending_section(entity_id, name, cycle, totals):
    section = {
        'name': 'Federal Spending',
        'template': 'org_grants_and_contracts.html',
    }
    
    spending = api.org.fed_spending(entity_id, cycle)

    filter_bad_spending_descriptions(spending)

    section['grants_and_contracts'] = spending
    section['gc_links'] = external_sites.get_gc_links(name.__str__(), cycle)

    gc_found_things = []
    for gc_type in ['grant', 'contract', 'loan']:
        if totals.get('%s_count' % gc_type, 0):
            gc_found_things.append('%s %s%s' % (
                intcomma(totals['%s_count' % gc_type]),
                gc_type,
                pluralize(totals['%s_count' % gc_type])
            ))

    section['gc_found_things'] = gc_found_things
    
    return section
Пример #2
0
    def build_section_data(self):
        cycle, name, totals = self.entity.cycle, self.entity.standardized_name, self.entity.metadata['entity_info']['totals']

        filter_bad_spending_descriptions(self.data['spending'])

        self.grants_and_contracts = self.data['spending']
        self.gc_links = external_sites.get_gc_links(name.__str__(), cycle)

        gc_found_things = []
        for gc_type in ['grant', 'contract', 'loan']:
            if totals.get('%s_count' % gc_type, 0):
                gc_found_things.append('%s %s%s' % (
                    intcomma(totals['%s_count' % gc_type]),
                    gc_type,
                    pluralize(totals['%s_count' % gc_type])
                ))

        self.gc_found_things = gc_found_things
Пример #3
0
    def build_section_data(self):
        cycle, name, totals = self.entity.cycle, self.entity.standardized_name, self.entity.metadata[
            'entity_info']['totals']

        filter_bad_spending_descriptions(self.data['spending'])

        self.grants_and_contracts = self.data['spending']
        self.gc_links = external_sites.get_gc_links(name.__str__(), cycle)

        gc_found_things = []
        for gc_type in ['grant', 'contract', 'loan']:
            if totals.get('%s_count' % gc_type, 0):
                gc_found_things.append(
                    '%s %s%s' %
                    (intcomma(totals['%s_count' % gc_type]), gc_type,
                     pluralize(totals['%s_count' % gc_type])))

        self.gc_found_things = gc_found_things