Skip to content

Commit

Permalink
everything was checked
Browse files Browse the repository at this point in the history
  • Loading branch information
SAYaghoubnejad committed Jan 24, 2020
1 parent d5274ee commit 737ec44
Showing 1 changed file with 5 additions and 13 deletions.
18 changes: 5 additions & 13 deletions snapFood.py
Original file line number Diff line number Diff line change
Expand Up @@ -389,7 +389,7 @@ def addDiscountCodeForUser(self, user_id, code, percent=50):
self._mydb.commit()
return discount_id

def charging(self, user_id, amount): #NOT CHECKED
def charging(self, user_id, amount):
self._mycursor.execute("SELECT balance, walletid FROM WALLET JOIN USER ON WALLETwalletid = walletid WHERE userid = %s;",(str(user_id),))
data = self._mycursor.fetchall()[0]
balance = int(data[0])
Expand All @@ -409,11 +409,11 @@ def adminLogin(self, username):
self._mycursor.execute("SELECT * FROM ADMIN WHERE username = %s", (str(username),))
return self._mycursor.fetchall()

def deleteFood(self, food_id): #NOT CHECKED
def deleteFood(self, food_id):
self._mycursor.execute("DELETE FROM FOOD WHERE foodid = %s;", (str(food_id),))
self._mydb.commit()

def updateFood(self, food_id, price = "", about = "", name = "", discount = "", category_id = "", image = ""): #NOT CHECKED
def updateFood(self, food_id, price = "", about = "", name = "", discount = "", category_id = "", image = ""):
self._mycursor.execute("SELECT * FROM FOOD WHERE foodid = %s;", (str(food_id),))
data = self._mycursor.fetchall()[0]
if price == "":
Expand All @@ -429,7 +429,7 @@ def updateFood(self, food_id, price = "", about = "", name = "", discount = "",
if image == "":
image = data[5]
self._mycursor.execute("UPDATE FOOD SET price = %s, about = %s, name = %s, discount = %s, image = %s, CATEGORYcategoryid = %s WHERE foodid = %s;"
.format(str(price), str(about), str(name), str(discount), str(image), str(category_id), str(food_id),))
, (str(price), str(about), str(name), str(discount), str(image), str(category_id), str(food_id),))
self._mydb.commit()

def showActiveOrder(self, shop_id):
Expand Down Expand Up @@ -462,13 +462,5 @@ def showAllComments(self, shop_id):
JOIN COMMENT ON COMMENTcommentid = commentid WHERE shopid = %s;""", (str(shop_id),))
return self._mycursor.fetchall()

def temp(self):
#self._mycursor.execute("UPDATE STATUS SET name = \'Prepration\' WHERE statusid = 7;")
self._mydb.commit()

def close(self):
self._mydb.close()

db = SnapFoodDB()
print(db.showAllComments(3))
db.close()
self._mydb.close()

0 comments on commit 737ec44

Please sign in to comment.