Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
E
edx-platform-release
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
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
392937d9
Commit
392937d9
authored
9 years ago
by
Muhammad Shoaib
Browse files
Options
Downloads
Patches
Plain Diff
MAYN-68 fixed the bug, total credit card purchases amount does not include the bulk purchases.
parent
41363ead
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
lms/djangoapps/instructor/tests/views/test_instructor_dashboard.py
+30
-2
30 additions, 2 deletions
...oapps/instructor/tests/views/test_instructor_dashboard.py
lms/djangoapps/instructor/views/instructor_dashboard.py
+4
-2
4 additions, 2 deletions
lms/djangoapps/instructor/views/instructor_dashboard.py
with
34 additions
and
4 deletions
lms/djangoapps/instructor/tests/views/test_instructor_dashboard.py
+
30
−
2
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
)
This diff is collapsed.
Click to expand it.
lms/djangoapps/instructor/views/instructor_dashboard.py
+
4
−
2
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
'
,
...
...
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