Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
E
edx-platform-release
Manage
Activity
Members
Labels
Plan
Issues
0
Issue boards
Milestones
Wiki
Code
Merge requests
1
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Package Registry
Model registry
Operate
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Hsin-Yu Chien
edx-platform-release
Commits
60de9ba2
Commit
60de9ba2
authored
10 years ago
by
Chris Dodge
Browse files
Options
Downloads
Patches
Plain Diff
be sure to constrain the select to the course_id that is being delete
wip
parent
c9357985
Loading
Loading
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
lms/djangoapps/shoppingcart/views.py
+10
-6
10 additions, 6 deletions
lms/djangoapps/shoppingcart/views.py
with
10 additions
and
6 deletions
lms/djangoapps/shoppingcart/views.py
+
10
−
6
View file @
60de9ba2
...
...
@@ -24,6 +24,7 @@ from .exceptions import ItemAlreadyInCartException, AlreadyEnrolledInCourseExcep
from
.models
import
Order
,
PaidCourseRegistration
,
OrderItem
,
Coupon
,
CouponRedemption
,
CourseRegistrationCode
,
RegistrationCodeRedemption
from
.processors
import
process_postpay_callback
,
render_purchase_form_html
import
json
from
xmodule_django.models
import
CourseKeyField
log
=
logging
.
getLogger
(
"
shoppingcart
"
)
AUDIT_LOG
=
logging
.
getLogger
(
"
audit
"
)
...
...
@@ -132,7 +133,14 @@ def remove_code_redemption(order_item_course_id, item_id, item, user):
"""
try
:
# Try to remove redemption information of coupon code, If exist.
coupon_redemption
=
CouponRedemption
.
objects
.
get
(
user
=
user
,
order
=
item
.
order_id
)
coupon_redemption
=
CouponRedemption
.
objects
.
get
(
user
=
user
,
coupon__course_id
=
order_item_course_id
if
order_item_course_id
else
CourseKeyField
.
Empty
,
order
=
item
.
order_id
)
coupon_redemption
.
delete
()
log
.
info
(
'
Coupon
"
{0}
"
redemption entry removed for user
"
{1}
"
for order item
"
{2}
"'
.
format
(
coupon_redemption
.
coupon
.
code
,
user
,
item_id
))
except
CouponRedemption
.
DoesNotExist
:
try
:
# Try to remove redemption information of registration code, If exist.
...
...
@@ -144,11 +152,7 @@ def remove_code_redemption(order_item_course_id, item_id, item, user):
reg_code_redemption
.
delete
()
log
.
info
(
'
Registration code
"
{0}
"
redemption entry removed for user
"
{1}
"
for order item
"
{2}
"'
.
format
(
reg_code_redemption
.
registration_code
.
code
,
user
,
item_id
))
else
:
if
order_item_course_id
==
coupon_redemption
.
coupon
.
course_id
:
coupon_redemption
.
delete
()
log
.
info
(
'
Coupon
"
{0}
"
redemption entry removed for user
"
{1}
"
for order item
"
{2}
"'
.
format
(
coupon_redemption
.
coupon
.
code
,
user
,
item_id
))
@login_required
def
use_code
(
request
):
...
...
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