From b44d2929daf0b02dbaa2f69f77586be437965dd5 Mon Sep 17 00:00:00 2001 From: Lucas Szwarcberg Date: Thu, 14 Jun 2018 12:10:43 -0400 Subject: [PATCH] Allow for running the model without reforms --- webapp/apps/taxbrain/views.py | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-) diff --git a/webapp/apps/taxbrain/views.py b/webapp/apps/taxbrain/views.py index 21c73946..a90da1c2 100644 --- a/webapp/apps/taxbrain/views.py +++ b/webapp/apps/taxbrain/views.py @@ -163,7 +163,6 @@ def submit_reform(request, user=None, json_reform_id=None): use_puf_not_cps = False # declare a bunch of variables--TODO: clean this up - no_inputs = False taxcalc_errors = False taxcalc_warnings = False is_valid = True @@ -251,8 +250,6 @@ def submit_reform(request, user=None, json_reform_id=None): ) json_reform.save() - if reform_dict == {}: - no_inputs = True # TODO: account for errors # 5 cases: # 0. no warning/error messages --> run model @@ -268,7 +265,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 = True if error_msgs else False @@ -293,11 +290,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: @@ -329,7 +321,7 @@ def submit_reform(request, user=None, json_reform_id=None): model=model, stop_submission=stop_submission, has_errors=any([taxcalc_errors, taxcalc_warnings, - no_inputs, not is_valid]), + not is_valid]), errors_warnings=errors_warnings, start_year=start_year, data_source=data_source,