twschum / mix-mind

Dynamic menu generator and order manager for home bars
https://schubar.org
Apache License 2.0
1 stars 3 forks source link

Traceback | Duplicate ingredients should be validation error #51

Open twschum opened 3 years ago

twschum commented 3 years ago

Should check this in validation, not be a traceback for the server.

2021-05-13 15:52:31,049: Traceback (most recent call last):
2021-05-13 15:52:31,050:   File "/home/twschum/mix-mind/venv/lib/python3.6/site-packages/flask/app.py", line 2446, in wsgi_app
2021-05-13 15:52:31,050:     response = self.full_dispatch_request()
2021-05-13 15:52:31,050:   File "/home/twschum/mix-mind/venv/lib/python3.6/site-packages/flask/app.py", line 1951, in full_dispatch_request
2021-05-13 15:52:31,050:     rv = self.handle_user_exception(e)
2021-05-13 15:52:31,050:   File "/home/twschum/mix-mind/venv/lib/python3.6/site-packages/flask/app.py", line 1820, in handle_user_exception
2021-05-13 15:52:31,050:     reraise(exc_type, exc_value, tb)
2021-05-13 15:52:31,051:   File "/home/twschum/mix-mind/venv/lib/python3.6/site-packages/flask/_compat.py", line 39, in reraise
2021-05-13 15:52:31,051:     raise value
2021-05-13 15:52:31,051:   File "/home/twschum/mix-mind/venv/lib/python3.6/site-packages/flask/app.py", line 1949, in full_dispatch_request
2021-05-13 15:52:31,051:     rv = self.dispatch_request()
2021-05-13 15:52:31,051:   File "/home/twschum/mix-mind/venv/lib/python3.6/site-packages/flask/app.py", line 1935, in dispatch_request
2021-05-13 15:52:31,052:     return self.view_functions[rule.endpoint](**req.view_args)
2021-05-13 15:52:31,052:   File "/home/twschum/mix-mind/mixmind/views.py", line 131, in browse
2021-05-13 15:52:31,052:     to_html=True, order_link=True, convert_to=current_bar.convert, condense_ingredients=current_bar.summarize)
2021-05-13 15:52:31,052:   File "/home/twschum/mix-mind/mixmind/views.py", line 69, in recipes_from_options
2021-05-13 15:52:31,052:     recipes, excluded = filter_recipes(mms.processed_recipes(current_bar), filter_options, union_results=bool(filter_options.search))
2021-05-13 15:52:31,052:   File "/home/twschum/mix-mind/mixmind/configuration_management.py", line 74, in processed_recipes
2021-05-13 15:52:31,053:     self.generate_recipes(bar)
2021-05-13 15:52:31,053:   File "/home/twschum/mix-mind/mixmind/configuration_management.py", line 88, in generate_recipes
2021-05-13 15:52:31,053:     for name, recipe in list(self.base_recipes.items())]
2021-05-13 15:52:31,053:   File "/home/twschum/mix-mind/mixmind/configuration_management.py", line 88, in <listcomp>
2021-05-13 15:52:31,053:     for name, recipe in list(self.base_recipes.items())]
2021-05-13 15:52:31,054:   File "/home/twschum/mix-mind/mixmind/recipe.py", line 114, in generate_examples
2021-05-13 15:52:31,054:     example.cost       += ingredient.get_cost(kind, barstock)
2021-05-13 15:52:31,054:   File "/home/twschum/mix-mind/mixmind/recipe.py", line 348, in get_cost
2021-05-13 15:52:31,054:     return barstock.cost_by_kind_and_volume(util.IngredientSpecifier(self.specifier.ingredient, kind), amount, self.recipe_unit)
2021-05-13 15:52:31,054:   File "/home/twschum/mix-mind/mixmind/barstock.py", line 130, in cost_by_kind_and_volume
2021-05-13 15:52:31,054:     per_unit = self.get_kind_field(ingredient, 'Cost_per_{}'.format(unit))
2021-05-13 15:52:31,055:   File "/home/twschum/mix-mind/mixmind/barstock.py", line 136, in get_kind_field
2021-05-13 15:52:31,055:     return self.get_ingredient_row(ingredient)[field]
2021-05-13 15:52:31,055:   File "/home/twschum/mix-mind/mixmind/barstock.py", line 143, in get_ingredient_row
2021-05-13 15:52:31,055:     raise ValueError('{} has multiple entries in the input data!'.format(ingredient.__repr__()))
2021-05-13 15:52:31,055: ValueError: any spirit:St. Remy V.S.O.P. has multiple entries in the input data!