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

Commit

Permalink
Fix null cycle error.
Browse files Browse the repository at this point in the history
[Resolves #979]
  • Loading branch information
jmcarp committed Jun 16, 2015
1 parent 4f22c02 commit 9c49807
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
8 changes: 4 additions & 4 deletions __init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -139,8 +139,8 @@ def candidate_page(c_id, cycle=None):
:param int cycle: Optional cycle for associated committees and financials.
"""
candidate, committees = load_with_nested('candidate', c_id, 'committees', cycle=cycle)
return render_candidate(candidate, committees=committees, cycle=cycle)
candidate, committees, cycle = load_with_nested('candidate', c_id, 'committees', cycle)
return render_candidate(candidate, committees, cycle)


@app.route('/committee/<c_id>')
Expand All @@ -152,8 +152,8 @@ def committee_page(c_id, cycle=None):
:param int cycle: Optional cycle for financials.
"""
committee, candidates = load_with_nested('committee', c_id, 'candidates', cycle=cycle)
return render_committee(committee, candidates=candidates, cycle=cycle)
committee, candidates, cycle = load_with_nested('committee', c_id, 'candidates', cycle)
return render_committee(committee, candidates, cycle)


@app.route('/candidates')
Expand Down
2 changes: 1 addition & 1 deletion openfecwebapp/api_caller.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ def load_with_nested(primary_type, primary_id, secondary_type, cycle=None):
cycle = cycle or min(utils.current_cycle(), max(data['results'][0]['cycles']))
path = ('history', str(cycle))
nested_data = load_nested_type(primary_type, primary_id, secondary_type, *path)
return data, nested_data['results']
return data, nested_data['results'], cycle


def load_cmte_financials(committee_id, **filters):
Expand Down

0 comments on commit 9c49807

Please sign in to comment.