Skip to content

Commit 5fecdfd

Browse files
authored
Merge pull request #13 from raboof/fix-adding-products
Fix price validation logic
2 parents 84c9dd5 + c20f204 commit 5fecdfd

File tree

2 files changed

+7
-7
lines changed

2 files changed

+7
-7
lines changed

plugins/market.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,7 @@ def saveprice(self, text):
141141
price = float(text)
142142
if not 0 < price < 1000:
143143
return self.messageandbuttons(
144-
"saveprice", "numbers", "Price should be between 0.01 and 999.99"
144+
"saveprice", "numbers", "Price should be between 0 and 1000"
145145
)
146146
self.newprodprice = price
147147
self.products[self.priceprod]["price"] = price
@@ -202,11 +202,11 @@ def addproductprice(self, text):
202202
return self.master.callhook("abort", None)
203203
try:
204204
price = float(text)
205-
if 0.01 < price < 999.99:
205+
if not 0 < price < 1000:
206206
return self.messageandbuttons(
207207
"addproductprice",
208208
"numbers",
209-
"Price should be between 0.01 and 999.99",
209+
"Price should be between 0 and 1000",
210210
)
211211
self.newprodprice = price
212212
self.master.donext(self, "addproductgroup")

plugins/products.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -143,9 +143,9 @@ def saveprice(self, text):
143143
try:
144144
price = float(text)
145145
print(price)
146-
if 0.01 > price < 999.99:
146+
if not 0 < price < 1000:
147147
return self.messageandbuttons(
148-
"saveprice", "numbers", "Price should be between 0.01 and 999.99"
148+
"saveprice", "numbers", "Price should be between 0 and 1000"
149149
)
150150
self.newprodprice = price
151151
self.products[self.priceprod]["price"] = self.newprodprice
@@ -206,11 +206,11 @@ def addproductprice(self, text):
206206
return self.master.callhook("abort", None)
207207
try:
208208
price = float(text)
209-
if 0 < price < 999.99:
209+
if not 0 < price < 1000:
210210
return self.messageandbuttons(
211211
"addproductprice",
212212
"numbers",
213-
"Price should be between 0.01 and 999.99",
213+
"Price should be between 0 and 1000",
214214
)
215215
self.newprodprice = price
216216
self.master.donext(self, "addproductgroup")

0 commit comments

Comments
 (0)