Restructure project #3
|
@ -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]]
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -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 (
|
||||
|
|
|
@ -5,10 +5,8 @@ from datetime import datetime
|
|||
import math
|
||||
|
||||
from sqlalchemy import (
|
||||
Boolean,
|
||||
DateTime,
|
||||
Integer,
|
||||
String,
|
||||
)
|
||||
from sqlalchemy.orm import (
|
||||
Mapped,
|
||||
|
|
|
@ -1,3 +1,13 @@
|
|||
__all__ = [
|
||||
'Base',
|
||||
'Product',
|
||||
'Purchase',
|
||||
'PurchaseEntry',
|
||||
'Transaction',
|
||||
'User',
|
||||
'UserProducts',
|
||||
]
|
||||
|
||||
from .Base import Base
|
||||
from .Product import Product
|
||||
from .Purchase import Purchase
|
||||
|
|
Loading…
Reference in New Issue