Skip to content
Snippets Groups Projects
Commit b0ba8513 authored by Sindre Hiis-Hauge's avatar Sindre Hiis-Hauge
Browse files

added some commments

parent 282bfdca
No related branches found
No related tags found
No related merge requests found
......@@ -21,6 +21,7 @@ def get_order_new():
cur=mysql.connection.cursor()
#Fetches all orders with state=new
get_orders_new= cur.execute("SELECT * FROM `order` WHERE `state` = 'new'")
if get_orders_new >0:
......@@ -40,6 +41,7 @@ def get_order_available():
cur=mysql.connection.cursor()
#Fetches all orders with state=Skis available
get_orders_available= cur.execute("SELECT * FROM `order` WHERE `state` = 'Skis available'")
if get_orders_available >0:
......@@ -64,7 +66,7 @@ def get_order_available_filter():
cur=mysql.connection.cursor()
#Matches the attribute, which is a column in the table.
match (attribute):
match (attribute):#Match is used as a switch here.
case "franchise_store_name":
get_orders_available_filter= cur.execute("SELECT * FROM `order` WHERE `state` = 'Skis available' AND `franchise_store_name` = %s",(value,))
......@@ -112,6 +114,7 @@ def put_orders_open():
cur=mysql.connection.cursor()
#Updates orders which are "new" to "open", and must match with the given order number
put_orders_open= cur.execute("UPDATE `order` SET `state` = 'open' WHERE `state`= 'new' AND `order_number` = %s",(order_number,))
order_info= cur.execute("SELECT * FROM `order`")
......@@ -137,6 +140,7 @@ def put_orders_available():
cur=mysql.connection.cursor()
#Updates orders which are "open" to "Skis-available", and must match with the given order number
put_orders_available= cur.execute("UPDATE `order` SET `state` = 'Skis available' WHERE `state`= 'open' AND `order_number` = %s",(order_number,))
order_info= cur.execute("SELECT * FROM `order`")
......@@ -169,7 +173,7 @@ def post_new_product():
cur=mysql.connection.cursor()
#Seperates sql and arguements. Inserts values in to the table
#Seperated sql and arguements for convinence. Inserts values in to the tables.
sql= "INSERT INTO `shipment`(`store_name`, `address`, `pickup_date`, `state`, `order_no`, `transport_company`, `driver_id`) VALUES (%s, %s, %s, %s, %s, %s, %s)"
args=[store_name, address, dateToday, state, order_no, transport_company, driver_id]
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment