commit 99b24c8302286e6d272ccd5250deee4fb3e949f2 Author: elpatron68 Date: Sat May 25 21:25:19 2024 +0200 First commit diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..b694934 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +.venv \ No newline at end of file diff --git a/app.py b/app.py new file mode 100644 index 0000000..30198b8 --- /dev/null +++ b/app.py @@ -0,0 +1,70 @@ +from flask import Flask, render_template, request, session +from flask_bootstrap import Bootstrap + +app = Flask(__name__) +app.config['SECRET_KEY'] = 'j69ol5mcHLsEtLg4Y/+myd9wWD4pp56E' +Bootstrap(app) + +gesamtwert = 0 +item1 = 0 +item2 = 0 +item3 = 0 +item4 = 0 +item5 = 0 +item6 = 0 + + +@app.route("/", methods=["GET", "POST"]) +def index(): + global gesamtwert, item1, item2, item3, item4, item5, item6, sum + + if request.method == "POST": + wert = float(request.form["wert"]) + + if wert == 0: + global gesamtwert + gesamtwert = 0 + sum = "0" + item1 = 0 + item2 = 0 + item3 = 0 + item4 = 0 + item5 = 0 + item6 = 0 + else: + gesamtwert += wert + gesamtwert = round(gesamtwert, 2) + if gesamtwert > 0: + sum = str(gesamtwert) + "0" + # gesamtwert = '€{:,.2f}'.format(gesamtwert) + if wert == 5.8: + item1 += 1 + if wert == 4.8: + item2 += 1 + if wert == 3.3: + item3 += 1 + if wert == 8.8: + item4 += 1 + if wert == 5.5: + item5 += 1 + if wert == .2: + item6 += 1 + + session['item1'] = item1 + session['item2'] = item2 + session['item3'] = item3 + session['item4'] = item4 + session['item5'] = item5 + session['item6'] = item6 + + return render_template("index.html", gesamtwert=sum, + item1=session.get('item1', 0), + item2=session.get('item2', 0), + item3=session.get('item3', 0), + item4=session.get('item4', 0), + item5=session.get('item5', 0), + item6=session.get('item6', 0), + ) + +if __name__ == "__main__": + app.run(debug=True, host="192.168.177.24") \ No newline at end of file diff --git a/templates/index.html b/templates/index.html new file mode 100644 index 0000000..cc72b7d --- /dev/null +++ b/templates/index.html @@ -0,0 +1,84 @@ + + + + + + πŸ“ Erdbeerhannah πŸ“ + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + +
πŸ“ Erdbeerhannah πŸ“
🫰 {{ gesamtwert }}€
+
+ + + + + +