Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
E
edx-platform
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
edx
edx-platform
Commits
87068c41
Commit
87068c41
authored
Aug 28, 2014
by
Jason Bau
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #5012 from edx/jbau/fix-contained-in-order
change PaidCourseRegistration.contained_in_order
parents
64c94cf3
63cfcd3d
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
15 additions
and
2 deletions
+15
-2
lms/djangoapps/shoppingcart/models.py
+5
-2
lms/djangoapps/shoppingcart/tests/test_models.py
+10
-0
No files found.
lms/djangoapps/shoppingcart/models.py
View file @
87068c41
...
@@ -478,8 +478,11 @@ class PaidCourseRegistration(OrderItem):
...
@@ -478,8 +478,11 @@ class PaidCourseRegistration(OrderItem):
"""
"""
Is the course defined by course_id contained in the order?
Is the course defined by course_id contained in the order?
"""
"""
return
course_id
in
[
item
.
paidcourseregistration
.
course_id
return
course_id
in
[
for
item
in
order
.
orderitem_set
.
all
()
.
select_subclasses
(
"paidcourseregistration"
)]
item
.
course_id
for
item
in
order
.
orderitem_set
.
all
()
.
select_subclasses
(
"paidcourseregistration"
)
if
isinstance
(
item
,
cls
)
]
@classmethod
@classmethod
def
get_total_amount_of_purchased_item
(
cls
,
course_key
):
def
get_total_amount_of_purchased_item
(
cls
,
course_key
):
...
...
lms/djangoapps/shoppingcart/tests/test_models.py
View file @
87068c41
...
@@ -337,6 +337,16 @@ class PaidCourseRegistrationTest(ModuleStoreTestCase):
...
@@ -337,6 +337,16 @@ class PaidCourseRegistrationTest(ModuleStoreTestCase):
reg1
.
purchased_callback
()
reg1
.
purchased_callback
()
self
.
assertFalse
(
CourseEnrollment
.
is_enrolled
(
self
.
user
,
self
.
course_key
))
self
.
assertFalse
(
CourseEnrollment
.
is_enrolled
(
self
.
user
,
self
.
course_key
))
def
test_user_cart_has_both_items
(
self
):
"""
This test exists b/c having both CertificateItem and PaidCourseRegistration in an order used to break
PaidCourseRegistration.contained_in_order
"""
cart
=
Order
.
get_cart_for_user
(
self
.
user
)
CertificateItem
.
add_to_order
(
cart
,
self
.
course_key
,
self
.
cost
,
'honor'
)
PaidCourseRegistration
.
add_to_order
(
self
.
cart
,
self
.
course_key
)
self
.
assertTrue
(
PaidCourseRegistration
.
contained_in_order
(
cart
,
self
.
course_key
))
@override_settings
(
MODULESTORE
=
TEST_DATA_MONGO_MODULESTORE
)
@override_settings
(
MODULESTORE
=
TEST_DATA_MONGO_MODULESTORE
)
class
CertificateItemTest
(
ModuleStoreTestCase
):
class
CertificateItemTest
(
ModuleStoreTestCase
):
...
...
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