Order history removed from dashboard
PROD-799
This commit is contained in:
@@ -44,7 +44,6 @@ from openedx.core.djangoapps.util.maintenance_banner import add_maintenance_bann
|
||||
from openedx.core.djangoapps.waffle_utils import WaffleFlag, WaffleFlagNamespace
|
||||
from openedx.core.djangolib.markup import HTML, Text
|
||||
from openedx.features.enterprise_support.api import get_dashboard_consent_notification
|
||||
from shoppingcart.api import order_history
|
||||
from shoppingcart.models import CourseRegistrationCode, DonationConfiguration
|
||||
from student.helpers import cert_info, check_verify_status_by_course, get_resume_urls_for_enrollments
|
||||
from student.models import (
|
||||
@@ -792,13 +791,6 @@ def student_dashboard(request):
|
||||
# we'll display the banner
|
||||
denied_banner = any(item.display for item in reverifications["denied"])
|
||||
|
||||
# Populate the Order History for the side-bar.
|
||||
order_history_list = order_history(
|
||||
user,
|
||||
course_org_filter=site_org_whitelist,
|
||||
org_filter_out_set=site_org_blacklist
|
||||
)
|
||||
|
||||
# get list of courses having pre-requisites yet to be completed
|
||||
courses_having_prerequisites = frozenset(
|
||||
enrollment.course_id for enrollment in course_enrollments
|
||||
@@ -821,9 +813,8 @@ def student_dashboard(request):
|
||||
redirect_message = ''
|
||||
|
||||
valid_verification_statuses = ['approved', 'must_reverify', 'pending', 'expired']
|
||||
display_sidebar_on_dashboard = (len(order_history_list) or
|
||||
(verification_status['status'] in valid_verification_statuses and
|
||||
verification_status['should_display']))
|
||||
display_sidebar_on_dashboard = verification_status['status'] in valid_verification_statuses and \
|
||||
verification_status['should_display']
|
||||
|
||||
# Filter out any course enrollment course cards that are associated with fulfilled entitlements
|
||||
for entitlement in [e for e in course_entitlements if e.enrollment_course_run is not None]:
|
||||
@@ -867,7 +858,6 @@ def student_dashboard(request):
|
||||
'platform_name': platform_name,
|
||||
'enrolled_courses_either_paid': enrolled_courses_either_paid,
|
||||
'provider_states': [],
|
||||
'order_history_list': order_history_list,
|
||||
'courses_requirements_not_met': courses_requirements_not_met,
|
||||
'nav_hidden': True,
|
||||
'inverted_programs': inverted_programs,
|
||||
|
||||
@@ -1,139 +0,0 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
"""
|
||||
Dashboard with Shopping Cart History tests with configuration overrides.
|
||||
"""
|
||||
|
||||
|
||||
from django.urls import reverse
|
||||
from mock import patch
|
||||
|
||||
from course_modes.models import CourseMode
|
||||
from openedx.core.djangoapps.site_configuration.tests.mixins import SiteMixin
|
||||
from shoppingcart.models import CertificateItem, Donation, Order, PaidCourseRegistration
|
||||
from student.tests.factories import UserFactory
|
||||
from xmodule.modulestore.tests.django_utils import ModuleStoreTestCase
|
||||
from xmodule.modulestore.tests.factories import CourseFactory
|
||||
|
||||
|
||||
@patch.dict('django.conf.settings.FEATURES', {'ENABLE_PAID_COURSE_REGISTRATION': True})
|
||||
class TestOrderHistoryOnSiteDashboard(SiteMixin, ModuleStoreTestCase):
|
||||
"""
|
||||
Test for dashboard order history site configuration overrides.
|
||||
"""
|
||||
|
||||
def setUp(self):
|
||||
super(TestOrderHistoryOnSiteDashboard, self).setUp()
|
||||
|
||||
patcher = patch('student.models.tracker')
|
||||
self.mock_tracker = patcher.start()
|
||||
self.user = UserFactory.create()
|
||||
self.user.set_password('password')
|
||||
self.user.save()
|
||||
|
||||
self.addCleanup(patcher.stop)
|
||||
|
||||
# First Order with our (fakeX) site's course.
|
||||
course1 = CourseFactory.create(org='fakeX', number='999', display_name='fakeX Course')
|
||||
course1_key = course1.id
|
||||
course1_mode = CourseMode(course_id=course1_key,
|
||||
mode_slug="honor",
|
||||
mode_display_name="honor cert",
|
||||
min_price=20)
|
||||
course1_mode.save()
|
||||
|
||||
cart = Order.get_cart_for_user(self.user)
|
||||
PaidCourseRegistration.add_to_order(cart, course1_key)
|
||||
cart.purchase(first='FirstNameTesting123', street1='StreetTesting123')
|
||||
self.fakex_site_order_id = cart.id
|
||||
|
||||
# Second Order with another(fooX) site's course
|
||||
course2 = CourseFactory.create(org='fooX', number='888', display_name='fooX Course')
|
||||
course2_key = course2.id
|
||||
course2_mode = CourseMode(course_id=course2.id,
|
||||
mode_slug="honor",
|
||||
mode_display_name="honor cert",
|
||||
min_price=20)
|
||||
course2_mode.save()
|
||||
|
||||
cart = Order.get_cart_for_user(self.user)
|
||||
PaidCourseRegistration.add_to_order(cart, course2_key)
|
||||
cart.purchase(first='FirstNameTesting123', street1='StreetTesting123')
|
||||
self.foox_site_order_id = cart.id
|
||||
|
||||
# Third Order with course not attributed to any site.
|
||||
course3 = CourseFactory.create(org='fakeOtherX', number='777', display_name='fakeOtherX Course')
|
||||
course3_key = course3.id
|
||||
course3_mode = CourseMode(course_id=course3.id,
|
||||
mode_slug="honor",
|
||||
mode_display_name="honor cert",
|
||||
min_price=20)
|
||||
course3_mode.save()
|
||||
|
||||
cart = Order.get_cart_for_user(self.user)
|
||||
PaidCourseRegistration.add_to_order(cart, course3_key)
|
||||
cart.purchase(first='FirstNameTesting123', street1='StreetTesting123')
|
||||
self.order_id = cart.id
|
||||
|
||||
# Fourth Order with course not attributed to any site but with a CertificateItem
|
||||
course4 = CourseFactory.create(org='fakeOtherX', number='888')
|
||||
course4_key = course4.id
|
||||
course4_mode = CourseMode(course_id=course4.id,
|
||||
mode_slug="verified",
|
||||
mode_display_name="verified cert",
|
||||
min_price=20)
|
||||
course4_mode.save()
|
||||
|
||||
cart = Order.get_cart_for_user(self.user)
|
||||
CertificateItem.add_to_order(cart, course4_key, 20.0, 'verified')
|
||||
cart.purchase(first='FirstNameTesting123', street1='StreetTesting123')
|
||||
self.certificate_order_id = cart.id
|
||||
|
||||
# Fifth Order with course not attributed to any site but with a Donation
|
||||
course5 = CourseFactory.create(org='fakeOtherX', number='999')
|
||||
course5_key = course5.id
|
||||
|
||||
cart = Order.get_cart_for_user(self.user)
|
||||
Donation.add_to_order(cart, 20.0, course5_key)
|
||||
cart.purchase(first='FirstNameTesting123', street1='StreetTesting123')
|
||||
self.donation_order_id = cart.id
|
||||
|
||||
# also add a donation not associated with a course to make sure the None case works OK
|
||||
Donation.add_to_order(cart, 10.0, None)
|
||||
cart.purchase(first='FirstNameTesting123', street1='StreetTesting123')
|
||||
self.courseless_donation_order_id = cart.id
|
||||
|
||||
def test_shows_orders_with_current_site_courses_only(self):
|
||||
self.client.login(username=self.user.username, password="password")
|
||||
response = self.client.get(reverse("dashboard"))
|
||||
receipt_url_course = reverse('shoppingcart.views.show_receipt', kwargs={'ordernum': self.fakex_site_order_id})
|
||||
receipt_url_course2 = reverse('shoppingcart.views.show_receipt', kwargs={'ordernum': self.foox_site_order_id})
|
||||
receipt_url = reverse('shoppingcart.views.show_receipt', kwargs={'ordernum': self.order_id})
|
||||
receipt_url_cert = reverse('shoppingcart.views.show_receipt', kwargs={'ordernum': self.certificate_order_id})
|
||||
receipt_url_donation = reverse('shoppingcart.views.show_receipt', kwargs={'ordernum': self.donation_order_id})
|
||||
|
||||
self.assertContains(response, receipt_url_course)
|
||||
self.assertNotContains(response, receipt_url_course2)
|
||||
self.assertNotContains(response, receipt_url)
|
||||
self.assertNotContains(response, receipt_url_cert)
|
||||
self.assertNotContains(response, receipt_url_donation)
|
||||
|
||||
def test_shows_orders_with_non_site_courses_only_when_no_configuration_override_exists(self):
|
||||
self.use_site(self.site_other)
|
||||
self.client.login(username=self.user.username, password="password")
|
||||
response = self.client.get(reverse("dashboard"))
|
||||
receipt_url_course = reverse('shoppingcart.views.show_receipt', kwargs={'ordernum': self.fakex_site_order_id})
|
||||
receipt_url_course2 = reverse('shoppingcart.views.show_receipt', kwargs={'ordernum': self.foox_site_order_id})
|
||||
receipt_url = reverse('shoppingcart.views.show_receipt', kwargs={'ordernum': self.order_id})
|
||||
receipt_url_cert = reverse('shoppingcart.views.show_receipt', kwargs={'ordernum': self.certificate_order_id})
|
||||
receipt_url_donation = reverse('shoppingcart.views.show_receipt', kwargs={'ordernum': self.donation_order_id})
|
||||
receipt_url_courseless_donation = reverse(
|
||||
'shoppingcart.views.show_receipt',
|
||||
kwargs={'ordernum': self.courseless_donation_order_id},
|
||||
)
|
||||
|
||||
self.assertNotContains(response, receipt_url_course)
|
||||
self.assertNotContains(response, receipt_url_course2)
|
||||
self.assertContains(response, receipt_url)
|
||||
self.assertContains(response, receipt_url_cert)
|
||||
self.assertContains(response, receipt_url_donation)
|
||||
self.assertContains(response, receipt_url_courseless_donation)
|
||||
@@ -294,15 +294,6 @@ from student.models import CourseEnrollment
|
||||
<div class="user-info">
|
||||
<ul>
|
||||
|
||||
% if len(order_history_list):
|
||||
<li class="order-history">
|
||||
<span class="title">${_("Order History")}</span>
|
||||
% for order_history_item in order_history_list:
|
||||
<span><a href="${order_history_item['receipt_url']}" rel="noopener" target="_blank" class="edit-name">${order_history_item['order_date']}</a></span>
|
||||
% endfor
|
||||
</li>
|
||||
% endif
|
||||
|
||||
<%include file="${static.get_template_path('dashboard/_dashboard_status_verification.html')}" />
|
||||
|
||||
</ul>
|
||||
|
||||
@@ -296,15 +296,6 @@ from student.models import CourseEnrollment
|
||||
<section class="user-info">
|
||||
<ul>
|
||||
|
||||
% if len(order_history_list):
|
||||
<li class="order-history">
|
||||
<span class="title">${_("Order History")}</span>
|
||||
% for order_history_item in order_history_list:
|
||||
<span><a href="${order_history_item['receipt_url']}" rel="noopener" target="_blank" class="edit-name">${order_history_item['order_date']}</a></span>
|
||||
% endfor
|
||||
</li>
|
||||
% endif
|
||||
|
||||
<%include file="${theming_helpers.get_template_path('dashboard/_dashboard_status_verification.html')}" />
|
||||
|
||||
</ul>
|
||||
|
||||
Reference in New Issue
Block a user