diff --git a/dibbler/lib/helpers.py b/dibbler/lib/helpers.py index cacf827..30926a3 100644 --- a/dibbler/lib/helpers.py +++ b/dibbler/lib/helpers.py @@ -44,7 +44,7 @@ def search_product(string, session, find_hidden_products=True): .filter( or_( Product.bar_code == string, - and_(Product.name == string, Product.hidden == False), + and_(Product.name == string, Product.hidden is False), ) ) .first() @@ -68,7 +68,7 @@ def search_product(string, session, find_hidden_products=True): .filter( or_( Product.bar_code.ilike(f"%{string}%"), - and_(Product.name.ilike(f"%{string}%"), Product.hidden == False), + and_(Product.name.ilike(f"%{string}%"), Product.hidden is False), ) ) .all() @@ -103,14 +103,13 @@ def guess_data_type(string): def argmax(d, all=False, value=None): maxarg = None - maxargs = [] - if value != None: + if value is not None: dd = d d = {} for key in list(dd.keys()): d[key] = value(dd[key]) for key in list(d.keys()): - if maxarg == None or d[key] > d[maxarg]: + if maxarg is None or d[key] > d[maxarg]: maxarg = key if all: return [k for k in list(d.keys()) if d[k] == d[maxarg]] diff --git a/dibbler/lib/statistikkHelpers.py b/dibbler/lib/statistikkHelpers.py index e345230..80ea886 100644 --- a/dibbler/lib/statistikkHelpers.py +++ b/dibbler/lib/statistikkHelpers.py @@ -283,10 +283,8 @@ def buildDatabaseFromDb(inputType, inputProduct, inputUser): for transaction in transaction_list: if transaction.purchase: products = "ยค".join([ent.product.name for ent in transaction.purchase.entries]) - description = "" else: products = "" - description = transaction.description line = line_format % ( "purchase", transaction.time, diff --git a/dibbler/menus/__init__.py b/dibbler/menus/__init__.py index 1adb076..a578490 100644 --- a/dibbler/menus/__init__.py +++ b/dibbler/menus/__init__.py @@ -1,3 +1,28 @@ +__all__ = [ + "AddProductMenu", + "AddStockMenu", + "AddUserMenu", + "AdjustCreditMenu", + "AdjustStockMenu", + "BalanceMenu", + "BuyMenu", + "CleanupStockMenu", + "EditProductMenu", + "EditUserMenu", + "FAQMenu", + "LoggedStatisticsMenu", + "MainMenu", + "Menu", + "PrintLabelMenu", + "ProductListMenu", + "ProductPopularityMenu", + "ProductRevenueMenu", + "ProductSearchMenu", + "ShowUserMenu", + "TransferMenu", + "UserListMenu", +] + from .addstock import AddStockMenu from .buymenu import BuyMenu from .editing import ( diff --git a/dibbler/models/Purchase.py b/dibbler/models/Purchase.py index aa1902e..b725f96 100644 --- a/dibbler/models/Purchase.py +++ b/dibbler/models/Purchase.py @@ -5,10 +5,8 @@ from datetime import datetime import math from sqlalchemy import ( - Boolean, DateTime, Integer, - String, ) from sqlalchemy.orm import ( Mapped, diff --git a/dibbler/models/__init__.py b/dibbler/models/__init__.py index 9fbd1da..20999e9 100644 --- a/dibbler/models/__init__.py +++ b/dibbler/models/__init__.py @@ -1,3 +1,13 @@ +__all__ = [ + 'Base', + 'Product', + 'Purchase', + 'PurchaseEntry', + 'Transaction', + 'User', + 'UserProducts', +] + from .Base import Base from .Product import Product from .Purchase import Purchase