Skip to content

Commit

Permalink
Fixed several bugs in enqueue() function
Browse files Browse the repository at this point in the history
  • Loading branch information
ToastCoder committed Dec 5, 2020
1 parent c678636 commit 44edaaa
Showing 1 changed file with 14 additions and 10 deletions.
24 changes: 14 additions & 10 deletions main.py
Original file line number Diff line number Diff line change
Expand Up @@ -114,33 +114,37 @@ def enqueue(self,ele,qn):
if self.isFull():
print("\nMaximum limit reached !")
else:

inv_data = pd.read_csv('data/inventory.csv')
flag1 = 0
flag2 = 0
flag = 0
for i in range(len(inv_data)):
flag1 = flag2 = 0
flag = 0
if inv_data["Product_Name"][i]==ele.upper():
if qn.isnumeric() == True:

if int(qn) <= inv_data["Available_Stock"][i]:

self.prod_name.append(ele.upper())
self.quantity.append(int(qn))
self.price.append(inv_data["Selling_Price"][i])

if self.front==None and self.rear==None:
self.front=self.rear=0
else:
self.rear += 1
print("\n>>>>>>>> Product is Added to the Order. <<<<<<<<\n")
break

else:
flag1 += 1
print("\n!! Sorry for the inconvenience... Your required product is Out of Stock !!")
break
else:
flag2 = 1
print("\n!! Invalid Amount of Quantity !!")
break
else:
flag1 += 1
if flag1 != 0:
print("\n!! Sorry for the inconvenience... Your required product is either Out of Stock or Not in our Stock !!")
if flag2 != 0:
print("\n!! Invalid Amount of Quantity !!")
flag = 1
if flag == 1:
print("The requested item is not in the inventory or invalid.")

# FUNCTION TO REMOVE A PRODUCT FROM THE BILL
def remove(self,ele):
Expand Down

0 comments on commit 44edaaa

Please sign in to comment.