mirror of
https://github.com/Steffo99/greed.git
synced 2024-11-21 21:44:19 +00:00
Tentative fix for #95
This commit is contained in:
parent
90e5141727
commit
3cfe0251d1
1 changed files with 4 additions and 2 deletions
|
@ -1040,6 +1040,8 @@ class Worker(threading.Thread):
|
||||||
price = None
|
price = None
|
||||||
else:
|
else:
|
||||||
price = self.Price(price)
|
price = self.Price(price)
|
||||||
|
if not isinstance(price, CancelSignal) and price is not None:
|
||||||
|
price = int(price)
|
||||||
# Ask for the product image
|
# Ask for the product image
|
||||||
self.bot.send_message(self.chat.id, self.loc.get("ask_product_image"), reply_markup=cancel)
|
self.bot.send_message(self.chat.id, self.loc.get("ask_product_image"), reply_markup=cancel)
|
||||||
# Wait for an answer
|
# Wait for an answer
|
||||||
|
@ -1050,7 +1052,7 @@ class Worker(threading.Thread):
|
||||||
# noinspection PyTypeChecker
|
# noinspection PyTypeChecker
|
||||||
product = db.Product(name=name,
|
product = db.Product(name=name,
|
||||||
description=description,
|
description=description,
|
||||||
price=int(price) if price is not None else None,
|
price=price,
|
||||||
deleted=False)
|
deleted=False)
|
||||||
# Add the record to the database
|
# Add the record to the database
|
||||||
self.session.add(product)
|
self.session.add(product)
|
||||||
|
@ -1059,7 +1061,7 @@ class Worker(threading.Thread):
|
||||||
# Edit the record with the new values
|
# Edit the record with the new values
|
||||||
product.name = name if not isinstance(name, CancelSignal) else product.name
|
product.name = name if not isinstance(name, CancelSignal) else product.name
|
||||||
product.description = description if not isinstance(description, CancelSignal) else product.description
|
product.description = description if not isinstance(description, CancelSignal) else product.description
|
||||||
product.price = int(price) if not isinstance(price, CancelSignal) else product.price
|
product.price = price if not isinstance(price, CancelSignal) else product.price
|
||||||
# If a photo has been sent...
|
# If a photo has been sent...
|
||||||
if isinstance(photo_list, list):
|
if isinstance(photo_list, list):
|
||||||
# Find the largest photo id
|
# Find the largest photo id
|
||||||
|
|
Loading…
Reference in a new issue