From 2f2fdacca225ce4692dc656aae3c241d65f06633 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tim=20Gr=C3=B6ger?= Date: Fri, 21 Aug 2020 21:59:39 +0200 Subject: [PATCH] Get FreeDrinkTypes und Bugfix MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Alle Freigetränktypen können nun geladen werden. Es wurde ein Bug gefixed, sodass die Preisliste wieder geladen werden kann. --- .../databaseController/dbPricelistController.py | 2 +- .../mainFreeDrinkListConfigController.py | 5 ++++- geruecht/routes.py | 11 +++++++++++ 3 files changed, 16 insertions(+), 2 deletions(-) diff --git a/geruecht/controller/databaseController/dbPricelistController.py b/geruecht/controller/databaseController/dbPricelistController.py index 7d00117..11f23d1 100644 --- a/geruecht/controller/databaseController/dbPricelistController.py +++ b/geruecht/controller/databaseController/dbPricelistController.py @@ -11,7 +11,7 @@ class Base: retVal = cursor.fetchall() for data in retVal: data['drink_type'] = self.getDrinkType(data['type']) - return cursor.fetchall() + return retVal except Exception as err: traceback.print_exc() self.db.connection.rollback() diff --git a/geruecht/controller/mainController/mainFreeDrinkListConfigController.py b/geruecht/controller/mainController/mainFreeDrinkListConfigController.py index 3c999ad..ac271e5 100644 --- a/geruecht/controller/mainController/mainFreeDrinkListConfigController.py +++ b/geruecht/controller/mainController/mainFreeDrinkListConfigController.py @@ -25,4 +25,7 @@ class Base: return db.get_free_drink_list_history_by_user(user) def get_free_drink_list_reasons(self): - return db.get_free_drink_list_reasons() \ No newline at end of file + return db.get_free_drink_list_reasons() + + def get_free_drink_types(self): + return db.get_free_drink_list_types() \ No newline at end of file diff --git a/geruecht/routes.py b/geruecht/routes.py index 3135f70..2208f94 100644 --- a/geruecht/routes.py +++ b/geruecht/routes.py @@ -81,6 +81,17 @@ def _free_drink_list_reasons(**kwargs): debug.warning("exception in delete free_dirnk_list_reasons.", exc_info=True) return jsonify({"error": str(err)}), 500 +@app.route("/freeDrinkTypes", methods=['GET', 'POST']) +@login_required() +def _free_drink_types(**kwargs): + try: + debug.info("get free_drnik_types") + retVal = mainController.get_free_drink_types() + return jsonify(retVal) + except Exception as err: + debug.warning("exception in free_dirnk_types.", exc_info=True) + return jsonify({"error": str(err)}), 500 + @app.route("/pricelist", methods=['GET']) def _getPricelist(): try: