Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow for running the model without reforms #905

Merged
merged 2 commits into from Jun 15, 2018
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
10 changes: 2 additions & 8 deletions webapp/apps/taxbrain/views.py
Expand Up @@ -258,7 +258,6 @@ def submit_reform(request, user=None, json_reform_id=None):
)
json_reform.save()

no_inputs = (reform_dict == {})
# TODO: account for errors
# 5 cases:
# 0. no warning/error messages --> run model
Expand All @@ -275,7 +274,7 @@ def submit_reform(request, user=None, json_reform_id=None):
for project in ['policy', 'behavior'])
error_msgs = any(len(errors_warnings[project]['errors']) > 0
for project in ['policy', 'behavior'])
stop_errors = no_inputs or not is_valid or error_msgs
stop_errors = not is_valid or error_msgs
stop_submission = stop_errors or (not has_errors and warn_msgs)
if stop_submission:
taxcalc_errors = bool(error_msgs)
Expand All @@ -301,11 +300,6 @@ def submit_reform(request, user=None, json_reform_id=None):
has_parse_errors = any('Unrecognize value' in e[0]
for e
in list(personal_inputs.errors.values()))
if no_inputs:
personal_inputs.add_error(
None,
"Please specify a tax-law change before submitting."
)
if taxcalc_warnings or taxcalc_errors:
personal_inputs.add_error(None, OUT_OF_RANGE_ERROR_MSG)
if has_parse_errors:
Expand Down Expand Up @@ -336,7 +330,7 @@ def submit_reform(request, user=None, json_reform_id=None):
json_reform=json_reform,
model=model,
stop_submission=stop_submission,
has_errors=any([taxcalc_errors, taxcalc_warnings, no_inputs,
has_errors=any([taxcalc_errors, taxcalc_warnings,
not is_valid]),
errors_warnings=errors_warnings,
start_year=start_year,
Expand Down