diff --git a/app.py b/app.py index dd8d573..d3e57a6 100644 --- a/app.py +++ b/app.py @@ -99,8 +99,10 @@ active_users = {} def utcnow(): return datetime.now(timezone.utc) + app_start_time = utcnow() + class User(UserMixin, db.Model): id = db.Column(db.Integer, primary_key=True) username = db.Column(db.String(150), unique=True, nullable=False) @@ -163,7 +165,6 @@ class Receipt(db.Model): file_hash = db.Column(db.String(64), nullable=True, unique=True) - with app.app_context(): db.create_all() @@ -1094,7 +1095,7 @@ def all_products(): top_products = ( top_products_query.order_by( SuggestedProduct.name.asc(), # musi być pierwsze - SuggestedProduct.usage_count.desc() + SuggestedProduct.usage_count.desc(), ) .distinct(SuggestedProduct.name) .limit(20) @@ -1129,8 +1130,8 @@ def all_products(): def upload_receipt(list_id): l = db.session.get(ShoppingList, list_id) - - #if l is None or l.owner_id != current_user.id: + + # if l is None or l.owner_id != current_user.id: # return _receipt_error("Nie masz uprawnień do tej listy.") if "receipt" not in request.files: @@ -1409,7 +1410,9 @@ def admin_panel(): ) # Uptime - uptime_minutes = int((datetime.now(timezone.utc) - app_start_time).total_seconds() // 60) + uptime_minutes = int( + (datetime.now(timezone.utc) - app_start_time).total_seconds() // 60 + ) return render_template( "admin/admin_panel.html", @@ -1426,7 +1429,6 @@ def admin_panel(): python_version=sys.version, system_info=platform.platform(), app_memory=f"{app_mem} MB", - db_info=db_info, table_count=table_count, record_total=record_total, @@ -1823,7 +1825,6 @@ def edit_list(list_id): flash("Nie znaleziono produktu", "danger") return redirect(url_for("edit_list", list_id=list_id)) - return render_template( "admin/edit_list.html", list=l, diff --git a/templates/admin/edit_list.html b/templates/admin/edit_list.html index 76743fc..9666185 100644 --- a/templates/admin/edit_list.html +++ b/templates/admin/edit_list.html @@ -173,12 +173,6 @@ - - {% if item.not_purchased_reason %} -