Skip to content
This repository has been archived by the owner on Dec 23, 2017. It is now read-only.

Commit

Permalink
Merge pull request #45 from 18F/zeros
Browse files Browse the repository at this point in the history
Fixing 0 -> unavailable
  • Loading branch information
arowla committed Feb 26, 2015
2 parents ccb24c2 + 33d5d18 commit eddbb23
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 1 deletion.
2 changes: 1 addition & 1 deletion openfecwebapp/data_prep/financial_summaries.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ def _map_committee_financials(vals):

# format totals data in US dollars
for v in value_map:
if value_map[v]:
if value_map[v] is not None:
totals_mapped[v] = locale.currency(
value_map[v], grouping=True)

Expand Down
11 changes: 11 additions & 0 deletions openfecwebapp/tests/data_prep/financial_summaries_tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,17 @@ def test_map_committee_financials(self):
self.assertEqual('2009 - 2010', c['years_totals'])
self.assertEqual('End Report ', c['report_desc'])

results = {
'reports': totals['results'][1]['reports'][0],
'totals': totals['results'][1]['totals'][0]
}
c = _map_committee_financials(results)

self.assertEqual('$0.00', c['total_receipts'])
self.assertEqual('$0.00', c['total_disbursements'])
self.assertEqual('$0.00', c['total_cash'])
self.assertEqual('$0.00', c['total_debt'])

def test_get_reports_totals_results(self):
c = _get_reports_totals_results(totals['results'][0])

Expand Down
14 changes: 14 additions & 0 deletions openfecwebapp/tests/mock_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,20 @@
'disbursements': 3453.54
}],
'committee_id': 'D1234'
},
{
'reports': [{
'cash_on_hand_end_period': 0,
'debts_owed_by_committee': 0,
'report_year': 2010,
'election_cycle': 2010,
'report_type_full': 'End Report {stuff}'
}],
'totals': [{
'receipts': 0,
'disbursements': 0
}],
'committee_id': 'D1234'
}]
}

Expand Down

0 comments on commit eddbb23

Please sign in to comment.