Skip to content

Commit

Permalink
Merge #905 and master
Browse files Browse the repository at this point in the history
  • Loading branch information
lucassz committed Jun 15, 2018
2 parents a3ff731 + b44d292 commit 4914960
Showing 1 changed file with 2 additions and 8 deletions.
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

0 comments on commit 4914960

Please sign in to comment.