Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
2
2021-090
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
2021-090
2021-090
Commits
ddd433f3
Commit
ddd433f3
authored
Aug 12, 2021
by
IT18111170-Silva S.H.I
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Update: discount calculation
parent
e84a2e96
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
26 additions
and
22 deletions
+26
-22
Agri_Backend/Agripreneur_App/Routes/PricePage.py
Agri_Backend/Agripreneur_App/Routes/PricePage.py
+25
-22
Agri_Backend/Main.py
Agri_Backend/Main.py
+1
-0
No files found.
Agri_Backend/Agripreneur_App/Routes/PricePage.py
View file @
ddd433f3
...
...
@@ -6,37 +6,40 @@ import json
from
bson.objectid
import
ObjectId
@
app
.
route
(
"/discount/<id>"
,
methods
=
[
"
POS
T"
])
@
app
.
route
(
"/discount/<id>"
,
methods
=
[
"
GE
T"
])
# @check_for_token
def
calculate_discount
(
id
):
user_earns
=
db
.
CropData
.
find_one
({
"_id"
:
ObjectId
(
id
)})
print
(
user_earns
)
user_points
=
user_earns
[
'points'
]
print
(
user_points
)
# if points >
= 1:
#
discount = 1
# elif points >
2:
#
discount = 2
# elif points >
3:
#
discount = 3
# elif points >
4:
#
discount = 4
# elif points >
5:
#
discount = 5
# elif points >
6:
#
discount = 6
# elif points >
7:
#
discount = 7
# elif points >
8:
#
discount = 8
# elif points >
9:
#
discount = 9
# elif points >
10:
#
discount = 10
if
user_points
=
=
1
:
discount
=
1
elif
user_points
==
2
:
discount
=
2
elif
user_points
==
3
:
discount
=
3
elif
user_points
==
4
:
discount
=
4
elif
user_points
==
5
:
discount
=
5
elif
user_points
==
6
:
discount
=
6
elif
user_points
==
7
:
discount
=
7
elif
user_points
==
8
:
discount
=
8
elif
user_points
==
9
:
discount
=
9
elif
user_points
==
10
:
discount
=
10
return
Response
(
response
=
json
.
dumps
({
"Discount p
ric
e"
:
discount
}),
response
=
json
.
dumps
({
"Discount p
ercentag
e"
:
discount
}),
status
=
200
,
)
\ No newline at end of file
Agri_Backend/Main.py
View file @
ddd433f3
...
...
@@ -10,6 +10,7 @@ import Agripreneur_App.Routes.User
import
Agripreneur_App.Auth.Token
import
Agripreneur_App.Routes.Leaderboard
import
Agripreneur_App.Routes.Gamification
import
Agripreneur_App.Routes.PricePage
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment