Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
I
IDATG2204-Group10-Project
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Frederik Simonsen
IDATG2204-Group10-Project
Commits
b0ba8513
Commit
b0ba8513
authored
3 years ago
by
Sindre Hiis-Hauge
Browse files
Options
Downloads
Patches
Plain Diff
added some commments
parent
282bfdca
No related branches found
No related tags found
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
endpoint/customerrep.py
+6
-2
6 additions, 2 deletions
endpoint/customerrep.py
with
6 additions
and
2 deletions
endpoint/customerrep.py
+
6
−
2
View file @
b0ba8513
...
...
@@ -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
()
#Seperate
s
sql and arguements. Inserts values in to the table
#Seperate
d
sql and arguements
for convinence
. Inserts values in to the table
s.
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
]
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment