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
392937d9
Commit
392937d9
authored
May 18, 2015
by
Muhammad Shoaib
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
MAYN-68 fixed the bug, total credit card purchases amount does not include the bulk purchases.
parent
41363ead
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
34 additions
and
4 deletions
+34
-4
lms/djangoapps/instructor/tests/views/test_instructor_dashboard.py
+30
-2
lms/djangoapps/instructor/views/instructor_dashboard.py
+4
-2
No files found.
lms/djangoapps/instructor/tests/views/test_instructor_dashboard.py
View file @
392937d9
...
...
@@ -8,10 +8,10 @@ from django.core.urlresolvers import reverse
from
django.test.utils
import
override_settings
from
courseware.tests.helpers
import
LoginEnrollmentTestCase
from
student.tests.factories
import
AdminFactory
from
student.tests.factories
import
AdminFactory
,
UserFactory
from
xmodule.modulestore.tests.django_utils
import
ModuleStoreTestCase
from
xmodule.modulestore.tests.factories
import
CourseFactory
from
shoppingcart.models
import
PaidCourseRegistration
from
shoppingcart.models
import
PaidCourseRegistration
,
Order
,
CourseRegCodeItem
from
course_modes.models
import
CourseMode
from
student.roles
import
CourseFinanceAdminRole
...
...
@@ -151,3 +151,31 @@ class TestInstructorDashboard(ModuleStoreTestCase, LoginEnrollmentTestCase):
# link to dashboard shown
expected_message
=
self
.
get_dashboard_demographic_message
()
self
.
assertTrue
(
expected_message
in
response
.
content
)
def
add_course_to_user_cart
(
self
,
cart
,
course_key
):
"""
adding course to user cart
"""
reg_item
=
PaidCourseRegistration
.
add_to_order
(
cart
,
course_key
)
return
reg_item
@patch.dict
(
'django.conf.settings.FEATURES'
,
{
'ENABLE_PAID_COURSE_REGISTRATION'
:
True
})
def
test_total_credit_cart_sales_amount
(
self
):
"""
Test to check the total amount for all the credit card purchases.
"""
student
=
UserFactory
.
create
()
self
.
client
.
login
(
username
=
student
.
username
,
password
=
"test"
)
student_cart
=
Order
.
get_cart_for_user
(
student
)
item
=
self
.
add_course_to_user_cart
(
student_cart
,
self
.
course
.
id
)
resp
=
self
.
client
.
post
(
reverse
(
'shoppingcart.views.update_user_cart'
),
{
'ItemId'
:
item
.
id
,
'qty'
:
4
})
self
.
assertEqual
(
resp
.
status_code
,
200
)
student_cart
.
purchase
()
self
.
client
.
login
(
username
=
self
.
instructor
.
username
,
password
=
"test"
)
CourseFinanceAdminRole
(
self
.
course
.
id
)
.
add_users
(
self
.
instructor
)
single_purchase_total
=
PaidCourseRegistration
.
get_total_amount_of_purchased_item
(
self
.
course
.
id
)
bulk_purchase_total
=
CourseRegCodeItem
.
get_total_amount_of_purchased_item
(
self
.
course
.
id
)
total_amount
=
single_purchase_total
+
bulk_purchase_total
response
=
self
.
client
.
get
(
self
.
url
)
self
.
assertIn
(
'{currency}{amount}'
.
format
(
currency
=
'$'
,
amount
=
total_amount
),
response
.
content
)
lms/djangoapps/instructor/views/instructor_dashboard.py
View file @
392937d9
...
...
@@ -33,7 +33,7 @@ from courseware.courses import get_course_by_id, get_studio_url
from
django_comment_client.utils
import
has_forum_access
from
django_comment_common.models
import
FORUM_ROLE_ADMINISTRATOR
from
student.models
import
CourseEnrollment
from
shoppingcart.models
import
Coupon
,
PaidCourseRegistration
from
shoppingcart.models
import
Coupon
,
PaidCourseRegistration
,
CourseRegCodeItem
from
course_modes.models
import
CourseMode
,
CourseModesArchive
from
student.roles
import
CourseFinanceAdminRole
,
CourseSalesAdminRole
from
certificates.models
import
CertificateGenerationConfiguration
...
...
@@ -158,7 +158,9 @@ def _section_e_commerce(course, access, paid_mode, coupons_enabled):
total_amount
=
None
if
access
[
'finance_admin'
]:
total_amount
=
PaidCourseRegistration
.
get_total_amount_of_purchased_item
(
course_key
)
single_purchase_total
=
PaidCourseRegistration
.
get_total_amount_of_purchased_item
(
course_key
)
bulk_purchase_total
=
CourseRegCodeItem
.
get_total_amount_of_purchased_item
(
course_key
)
total_amount
=
single_purchase_total
+
bulk_purchase_total
section_data
=
{
'section_key'
:
'e-commerce'
,
...
...
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