diff --git a/flaskr/controllers/main_controller.py b/flaskr/controllers/main_controller.py index bb77038..1380118 100644 --- a/flaskr/controllers/main_controller.py +++ b/flaskr/controllers/main_controller.py @@ -603,8 +603,9 @@ def consult_estimation(public_id, extension): else: estimation_output = estimation.get_output_dict() estimation_sum = 0 - for city in estimation_output['cities']: - estimation_sum += city['footprint'] + if estimation_output: + for city in estimation_output['cities']: + estimation_sum += city['footprint'] return render_template( "estimation.html", diff --git a/flaskr/models.py b/flaskr/models.py index 7900b54..3ba24ab 100755 --- a/flaskr/models.py +++ b/flaskr/models.py @@ -71,9 +71,11 @@ class Estimation(db.Model): def get_output_dict(self): if self._output_dict is None: - self._output_dict = yaml_load(self.output_yaml) + if self._output_yaml is None: + self._output_dict = None + else: + self._output_dict = yaml_load(self.output_yaml) return self._output_dict - pass def is_one_to_one(self): return self.scenario == ScenarioEnum.one_to_one -- libgit2 0.21.2