From 87903a6d4a0967df9d98ebbf094418dd60d167dc Mon Sep 17 00:00:00 2001 From: redfast00 Date: Fri, 28 Jun 2019 18:57:41 +0200 Subject: [PATCH] Add Fitchen script --- app/database/add_fitchen.py | 37 +++++++++++++++++++++++++++++++++ app/database/create_database.py | 11 ++++++++-- 2 files changed, 46 insertions(+), 2 deletions(-) create mode 100644 app/database/add_fitchen.py diff --git a/app/database/add_fitchen.py b/app/database/add_fitchen.py new file mode 100644 index 0000000..6692251 --- /dev/null +++ b/app/database/add_fitchen.py @@ -0,0 +1,37 @@ +from models import Location, Product +from app import db + + +menuitems = [ + 'Spicy Chicken', + 'Advocado Chick', + 'Indian Summer', + 'Olive Garden', + 'Advocado Spring', + 'Spicy Mexican', + 'Beefcake', + 'Iron Man', + 'Fitalian', + 'Captain', + 'Sea Breeze', + 'Vegan Market', + 'Sunset Beach', + 'Hot Tofu', + 'Vegan Advocado Spring' +] + +pricedict = {'Small': 799, 'Medium': 999, 'Large': 1199} + + +def add(): + simpizza = Location() + simpizza.configure("Fitchen", "?", "?", "https://www.fitchen.be/") + db.session.add(simpizza) + + for menuitem in menuitems: + for size, price in pricedict.items(): + for container in ['bowl', 'wrap']: + name = '%s %s in %s' % (size, menuitem, container) + entry = Product() + entry.configure(simpizza, name, price) + db.session.add(entry) diff --git a/app/database/create_database.py b/app/database/create_database.py index 63bb04b..f8c21e4 100644 --- a/app/database/create_database.py +++ b/app/database/create_database.py @@ -1,8 +1,15 @@ from app import db -import add_oceans_garden, add_admins, add_simpizza, add_primadonna +import add_oceans_garden, add_admins, add_simpizza, add_primadonna, add_fitchen -entry_sets = {"Admins": add_admins.add, "Ocean's Garden": add_oceans_garden.add, "SimPizza": add_simpizza.add, "Primadonna": add_primadonna.add} +entry_sets = { + "Admins": add_admins.add, + "Ocean's Garden": add_oceans_garden.add, + "SimPizza": add_simpizza.add, + "Primadonna": add_primadonna.add, + "Fitchen": add_fitchen.add +} + yes = ["yes", "y", "Y"] no = ["no", "n", "N"]