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
6198b900
Commit
6198b900
authored
Dec 19, 2014
by
Chris Dodge
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
only display the count for coupon redemptions that actually went through to purchase completion
parent
1fa1d357
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
36 additions
and
5 deletions
+36
-5
lms/djangoapps/instructor/tests/test_api.py
+34
-0
lms/templates/instructor/instructor_dashboard_2/e-commerce.html
+2
-5
No files found.
lms/djangoapps/instructor/tests/test_api.py
View file @
6198b900
...
...
@@ -1794,6 +1794,40 @@ class TestInstructorAPILevelsDataDump(ModuleStoreTestCase, LoginEnrollmentTestCa
self
.
assertIn
(
item
.
status
,
response
.
content
.
split
(
'
\r\n
'
)[
1
],)
self
.
assertIn
(
coupon_redemption
[
0
]
.
coupon
.
code
,
response
.
content
.
split
(
'
\r\n
'
)[
1
],)
def
test_coupon_redeem_count_in_ecommerce_section
(
self
):
"""
Test that checks the redeem count in the instructor_dashboard coupon section
"""
# add the coupon code for the course
coupon
=
Coupon
(
code
=
'test_code'
,
description
=
'test_description'
,
course_id
=
self
.
course
.
id
,
percentage_discount
=
'10'
,
created_by
=
self
.
instructor
,
is_active
=
True
)
coupon
.
save
()
PaidCourseRegistration
.
add_to_order
(
self
.
cart
,
self
.
course
.
id
)
# apply the coupon code to the item in the cart
resp
=
self
.
client
.
post
(
reverse
(
'shoppingcart.views.use_code'
),
{
'code'
:
coupon
.
code
})
self
.
assertEqual
(
resp
.
status_code
,
200
)
# URL for instructor dashboard
instructor_dashboard
=
reverse
(
'instructor_dashboard'
,
kwargs
=
{
'course_id'
:
self
.
course
.
id
.
to_deprecated_string
()})
# visit the instructor dashboard page and
# check that the coupon redeem count should be 0
resp
=
self
.
client
.
get
(
instructor_dashboard
)
self
.
assertEqual
(
resp
.
status_code
,
200
)
self
.
assertIn
(
'Redeem Count'
,
resp
.
content
)
self
.
assertIn
(
'<td>0</td>'
,
resp
.
content
)
# now make the payment of your cart items
self
.
cart
.
purchase
()
# visit the instructor dashboard page and
# check that the coupon redeem count should be 1
resp
=
self
.
client
.
get
(
instructor_dashboard
)
self
.
assertEqual
(
resp
.
status_code
,
200
)
self
.
assertIn
(
'Redeem Count'
,
resp
.
content
)
self
.
assertIn
(
'<td>1</td>'
,
resp
.
content
)
def
test_get_sale_records_features_csv
(
self
):
"""
Test that the response from get_sale_records is in csv format.
...
...
lms/templates/instructor/instructor_dashboard_2/e-commerce.html
View file @
6198b900
...
...
@@ -96,7 +96,7 @@
<th
class=
"c_code"
>
${_("Code")}
</th>
<th
class=
"c_dsc"
>
${_("Description")}
</th>
<th
class=
"c_discount"
>
${_("Discount (%)")}
</th>
<th
class=
"c_count"
>
${_("Count")}
</th>
<th
class=
"c_count"
>
${_("
Redeem
Count")}
</th>
<th
class=
"c_action"
>
${_("Actions")}
</th>
</tr>
</thead>
...
...
@@ -110,10 +110,7 @@
<td>
${_('{code}').format(code=coupon.code)}
</td>
<td>
${_('{description}').format(description=coupon.description)}
</td>
<td>
${_('{discount}').format(discount=coupon.percentage_discount)}
</td>
<td>
${ coupon.couponredemption_set.all().count() }
</td>
<!--<td>${coupon.is_active}</td>-->
<td>
${ coupon.couponredemption_set.filter(order__status='purchased').count() }
</td>
<td><a
data-item-id=
"${coupon.id}"
class=
'remove_coupon'
href=
'#'
>
[x]
</a><a
href=
"#edit-modal"
data-item-id=
"${coupon.id}"
class=
"edit-right"
>
${_('Edit')}
</a></td>
</tr>
%endfor
...
...
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