diff --git a/.gitignore b/.gitignore deleted file mode 100644 index b694934..0000000 --- a/.gitignore +++ /dev/null @@ -1 +0,0 @@ -.venv \ No newline at end of file diff --git a/README.md b/README.md index 59bcd54..19ae1d2 100644 --- a/README.md +++ b/README.md @@ -27,10 +27,6 @@ Execute in Terminal "python3 -m venv .venv", for the virtual enviroment activate Note: This are early stages of this project listed are missing and planed. - -### DB Delete - -To delete db simple add first_startup = True in Options.ini and remove db.sqlite # To Does --- Must have features / fixes diff --git a/Server/DB/querys.py b/Server/DB/querys.py index f721dbf..a42532f 100644 --- a/Server/DB/querys.py +++ b/Server/DB/querys.py @@ -126,10 +126,11 @@ class get: def all_orders(): # All unfinished orders (finished is False or string "False") result = [] + desk = 1 orders = session.query(Order).filter(Order.finished == 0).all() session.commit() for order in orders: - products = session.query(Product).filter(Product.order_id == order.id).all() + products = session.query(Product).filter(Product.order_id == order.id , Order.desk_number == desk).all() session.commit() list_products = [] for p in products: diff --git a/Server/Host/flaskApp.py b/Server/Host/flaskApp.py index acbc90a..0b22e59 100644 --- a/Server/Host/flaskApp.py +++ b/Server/Host/flaskApp.py @@ -95,21 +95,16 @@ def logout(): def orders(): #TODO on new orderGet refresh orders list if request.method == 'POST': order_id = request.form.get('order_id') - action = request.form.get('action') # 'refresh', 'finish' or 'undo' + action = request.form.get('action') # 'finish' or 'undo' - if action == 'finish': - order = session.get(Order, int(order_id)) - order.finished = True + order = session.get(Order, int(order_id)) + if order: #SQL error handeling just in case + if action == 'finish': + order.finished = True + elif action == 'undo': + order.finished = False session.commit() return jsonify(success=True) - elif action == 'undo': - order = session.get(Order, int(order_id)) - order.finished = False - session.commit() - return jsonify(success=True) - elif action == 'refresh': - html = render_template('partials/_order_rows.html', orders=get.all_orders()) - return jsonify(success=True, html=html) return jsonify(success=False) return render_template('orders.html', orders=get.all_orders()) @@ -142,9 +137,11 @@ def order_get(): return render_template('index.html', desk=desk, MAX_DESKS=int(config['DEFAULT']['max_desks']), orderableItems = get.valid_products(get_json_=True)) elif config['SETTINGS']['lockqrcode_whit_secret'] == 'False': return render_template('index.html', desk=desk, MAX_DESKS=int(config['DEFAULT']['max_desks']),orderableItems = get.valid_products(get_json_=True)) - elif config['SETTINGS']['lockqrcode_whit_secret'] == 'True': - return '

your LOCKQRCODE is invalid.

' - return '

Something went wrong went wrong, Try again.

' #TODO Make the HTML prettier for all + else: + return '

Somethign went wrong try again.

' #TODO Make the HTML prettier for all + return '

404 wrong Secret?

' #TODO Make the HTML prettier for all + elif config['SETTINGS']['lockqrcode_whit_secret'] == 'True': + return '

your LOCKQRCODE is invalid.

' else: return render_template('index.html',desk=desk, MAX_DESKS=int(config['DEFAULT']['max_desks']),orderableItems = get.valid_products(get_json_=True)) diff --git a/Server/Host/templates/index.html b/Server/Host/templates/index.html index 80934de..2fbb5e8 100644 --- a/Server/Host/templates/index.html +++ b/Server/Host/templates/index.html @@ -7,7 +7,7 @@ Document -
+
  • Tisch Nummer
    diff --git a/Server/Host/templates/login.html b/Server/Host/templates/login.html index c94edd5..462a86a 100644 --- a/Server/Host/templates/login.html +++ b/Server/Host/templates/login.html @@ -20,4 +20,4 @@ - + \ No newline at end of file diff --git a/Server/Host/templates/orders.html b/Server/Host/templates/orders.html index dabf3a8..8fbc6aa 100644 --- a/Server/Host/templates/orders.html +++ b/Server/Host/templates/orders.html @@ -35,31 +35,26 @@ Action Order-Nr -
    - Last refreshed: 0s ago -
    - {% for order in orders%} - - {{ order[0] }} - -
      - {% for product in order[1] %} -
    • {{ product }}
    • - {% endfor %} -
    - - - - - order {{ order[2] }} - + + {{ order[0] }} + +
      + {% for product in order[1] %} +
    • {{ product }}
    • + {% endfor %} +
    + + + + + order {{ order[2] }} + {% else %} No open orders. {% endfor %} - \ No newline at end of file diff --git a/Server/Host/templates/partials/_order_rows.html b/Server/Host/templates/partials/_order_rows.html deleted file mode 100644 index f77f5d0..0000000 --- a/Server/Host/templates/partials/_order_rows.html +++ /dev/null @@ -1,22 +0,0 @@ - -{% for order in orders%} - - {{ order[0] }} - -
      - {% for product in order[1] %} -
    • {{ product }}
    • - {% endfor %} -
    - - - - - order {{ order[2] }} - -{% else %} -No open orders. -{% endfor %} - \ No newline at end of file diff --git a/Tools/__pycache__/qrGenerator.cpython-312.pyc b/Tools/__pycache__/qrGenerator.cpython-312.pyc deleted file mode 100644 index 3749a6d..0000000 Binary files a/Tools/__pycache__/qrGenerator.cpython-312.pyc and /dev/null differ diff --git a/app.py b/app.py index 0901344..0e0feda 100644 --- a/app.py +++ b/app.py @@ -20,7 +20,7 @@ you want async logging. def run(): #TODO: sys.stderr back to a file log?? logger.add(sys.stderr, format="{time} {level} {message}", filter="startup", level="INFO") logger.add(sys.stderr, backtrace=True, diagnose=config['OTHER']['log_diagnose']) - app.run(debug=False, host="0.0.0.0") + app.run(debug=False) if __name__ == "__main__": #First startup is handled in DB/handler