Skip to content

Commit

Permalink
Merge pull request #849 from hdoupe/add_ccc_startyear
Browse files Browse the repository at this point in the history
Merged #849
  • Loading branch information
hdoupe committed Mar 16, 2018
2 parents 93d1bf0 + b14c697 commit 7a1b3e5
Show file tree
Hide file tree
Showing 276 changed files with 68 additions and 142,447 deletions.
3 changes: 1 addition & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -27,5 +27,4 @@ _build

.DS_Store
*.egg-info
staticfiles

staticfiles/
1 change: 1 addition & 0 deletions RELEASES.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ Release 1.5.0 on 2018-03-14
- [#835](https://github.com/OpenSourcePolicyCenter/PolicyBrain/pull/835/) - Add button to allow CPS as input data source - Sean Wang, Anderson Frailey, and Hank Doupe
- [#842](https://github.com/OpenSourcePolicyCenter/PolicyBrain/pull/842/) - Gray out fields based on data-source selection - Hank Doupe and Sean Wang
- [#847](https://github.com/OpenSourcePolicyCenter/PolicyBrain/pull/847) - Adds data source to file input page, refactors reform submission, and improves tests - Hank Doupe
- [#849](https://github.com/OpenSourcePolicyCenter/PolicyBrain/pull/849) - Add CCC start year drop-down - Hank Doupe

**Bug Fixes**
- [#844](https://github.com/OpenSourcePolicyCenter/PolicyBrain/pull/842/) - Pass start year to dynamic behavioral - Hank Doupe
Expand Down
4 changes: 3 additions & 1 deletion deploy/taxbrain_server/celery_tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -154,8 +154,10 @@ def ogusa_async(user_mods, ogusa_params, guid):


@celery_app.task
def btax_async(user_mods):
def btax_async(user_mods, start_year):
print("user mods: ", user_mods)
user_mods['start_year'] = start_year
print("submitting btax data: ", user_mods)
results = {}
tables = json.loads(runner_json_tables(**user_mods))
if tables.get("json_table"):
Expand Down
5 changes: 2 additions & 3 deletions deploy/taxbrain_server/flask_server.py
Original file line number Diff line number Diff line change
Expand Up @@ -101,13 +101,12 @@ def dropq_endpoint_small():

@app.route("/btax_start_job", methods=['POST'])
def btax_endpoint():
year = request.form['year']
# TODO: this assumes a single year is the key at highest
# level.
user_mods = tuple(json.loads(request.form['user_mods']).values())[0]
print('user_mods', user_mods)
year = int(year)
raw_results = btax_async.delay(user_mods)
start_year = int(request.form['first_budget_year'])
raw_results = btax_async.delay(user_mods, start_year)
RUNNING_JOBS[raw_results.id] = raw_results
length = client.llen(queue_name) + 1
results = {'job_id': str(raw_results), 'qlength':length}
Expand Down
10 changes: 8 additions & 2 deletions static/js/btax.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,13 @@ $.each(asset_yr_str, function(index, value){
});
});

$('#start-year-select').change(function() {
var currentYear = $('#start-year-select').val();
$('#start-year-select').change(function(e) {
$('#current-year-link').attr('href', '/ccc/?start_year=' + $(this).val());
$('#current-year-alert').removeClass('hidden');
$('#current-year-modal').modal('show');
});

$('#current-year-modal').on('hide.bs.modal', function (e) {
$('#start-year-select option').removeAttr("selected");
$('#start-year-select option[value="' + currentYear + '"]').attr("selected", "selected");
});

0 comments on commit 7a1b3e5

Please sign in to comment.