Commit 9f43e82c by Jeff LaJoie Committed by Jeff LaJoie

LEARNER-3771: Adds versioned view for Course Runs

parent 831dadc6
......@@ -29,6 +29,7 @@
<div>{{ course_run.end }}</div>
</div>
{% if is_seat_version %}
<div class="info-item">
<div class="heading">
{% trans "Enrollment Track" %}
......@@ -57,6 +58,7 @@
</div>
</div>
{% endif %}
{% endif %}
<div class="info-item">
<div class="heading">
......
......@@ -27,6 +27,7 @@ class CourseFactory(factory.DjangoModelFactory):
learner_testimonial = FuzzyText()
level_type = factory.SubFactory(factories.LevelTypeFactory)
image = factory.django.ImageField()
version = FuzzyInteger(0, 1)
primary_subject = factory.SubFactory(factories.SubjectFactory)
secondary_subject = factory.SubFactory(factories.SubjectFactory)
......
......@@ -824,6 +824,28 @@ class CourseRunDetailTests(SiteMixin, TestCase):
self.course_run.enrollment_end]:
self.assertContains(response, value.strftime(self.date_format))
def test_course_run_with_version(self):
"""
Verify that a SEAT_VERSION course still shows enrollment
track data, and an ENTITLEMENT_VERSION course does not
"""
self.client.logout()
self.client.login(username=self.user.username, password=USER_PASSWORD)
# For SEAT_VERSION Enrollment Track should be shown
self.course.version = Course.SEAT_VERSION
self.course.save()
response = self.client.get(self.page_url)
self.assertEqual(response.status_code, 200)
self.assertContains(response, 'Enrollment Track')
# For ENTITLEMENT_VERSION no Enrollment Track should be show
self.course.version = Course.ENTITLEMENT_VERSION
self.course.save()
response = self.client.get(self.page_url)
self.assertEqual(response.status_code, 200)
self.assertNotContains(response, 'Enrollment Track')
def test_detail_page_with_comments(self):
""" Verify that detail page contains all the data along with comments
for course.
......
......@@ -229,6 +229,8 @@ class CourseRunDetailView(mixins.LoginRequiredMixin, mixins.PublisherPermissionM
if current_owner_role.role == PublisherUserRole.ProjectCoordinator
else _('project coordinator'))
context['is_in_preview_review'] = course_run.is_in_preview_review
context['is_seat_version'] = course_run.is_seat_version
context['is_entitlement_version'] = course_run.is_entitlement_version
return context
......
......@@ -6,7 +6,7 @@ from django.utils.translation import ugettext_lazy as _
from course_discovery.apps.course_metadata.choices import CourseRunPacing
from course_discovery.apps.publisher.choices import PublisherUserRole
from course_discovery.apps.publisher.models import Seat
from course_discovery.apps.publisher.models import Course, Seat
from course_discovery.apps.publisher_comments.models import Comments, CommentTypeChoices
......@@ -151,6 +151,14 @@ class CourseRunWrapper(BaseWrapper):
)
@property
def is_seat_version(self):
return self.wrapped_obj.course.version == Course.SEAT_VERSION
@property
def is_entitlement_version(self):
return self.wrapped_obj.course.version == Course.ENTITLEMENT_VERSION
@property
def organization_key(self):
organization = self.wrapped_obj.course.organizations.first()
if not organization:
......
......@@ -7,7 +7,7 @@ msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2018-02-05 18:37+0000\n"
"POT-Creation-Date: 2018-02-06 14:34+0000\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
......
......@@ -7,7 +7,7 @@ msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2018-02-05 18:37+0000\n"
"POT-Creation-Date: 2018-02-06 14:34+0000\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
......
......@@ -7,7 +7,7 @@ msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2018-02-05 18:37+0000\n"
"POT-Creation-Date: 2018-02-06 14:34+0000\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
......
......@@ -7,7 +7,7 @@ msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2018-02-05 18:37+0000\n"
"POT-Creation-Date: 2018-02-06 14:34+0000\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment