Commit 9f43e82c by Jeff LaJoie Committed by Jeff LaJoie

LEARNER-3771: Adds versioned view for Course Runs

parent 831dadc6
...@@ -29,34 +29,36 @@ ...@@ -29,34 +29,36 @@
<div>{{ course_run.end }}</div> <div>{{ course_run.end }}</div>
</div> </div>
<div class="info-item"> {% if is_seat_version %}
<div class="heading"> <div class="info-item">
{% trans "Enrollment Track" %} <div class="heading">
{% trans "Enrollment Track" %}
</div>
<div>{{ course_run.course_type }}</div>
</div> </div>
<div>{{ course_run.course_type }}</div>
</div>
{% if course_run.seat_price %} {% if course_run.seat_price %}
<div class="info-item"> <div class="info-item">
<div class="heading"> <div class="heading">
{% trans "Certificate Price" %} {% trans "Certificate Price" %}
</div> </div>
<div> <div>
${{ course_run.seat_price }} ${{ course_run.seat_price }}
</div>
</div> </div>
</div> {% endif %}
{% endif %}
{% if course_run.credit_seat_price %} {% if course_run.credit_seat_price %}
<div class="info-item"> <div class="info-item">
<div class="heading"> <div class="heading">
{% trans "Credit Price" %} {% trans "Credit Price" %}
</div> </div>
<div> <div>
${{ course_run.credit_seat_price }} ${{ course_run.credit_seat_price }}
</div>
</div> </div>
</div> {% endif %}
{% endif %} {% endif %}
<div class="info-item"> <div class="info-item">
<div class="heading"> <div class="heading">
......
...@@ -27,6 +27,7 @@ class CourseFactory(factory.DjangoModelFactory): ...@@ -27,6 +27,7 @@ class CourseFactory(factory.DjangoModelFactory):
learner_testimonial = FuzzyText() learner_testimonial = FuzzyText()
level_type = factory.SubFactory(factories.LevelTypeFactory) level_type = factory.SubFactory(factories.LevelTypeFactory)
image = factory.django.ImageField() image = factory.django.ImageField()
version = FuzzyInteger(0, 1)
primary_subject = factory.SubFactory(factories.SubjectFactory) primary_subject = factory.SubFactory(factories.SubjectFactory)
secondary_subject = factory.SubFactory(factories.SubjectFactory) secondary_subject = factory.SubFactory(factories.SubjectFactory)
......
...@@ -824,6 +824,28 @@ class CourseRunDetailTests(SiteMixin, TestCase): ...@@ -824,6 +824,28 @@ class CourseRunDetailTests(SiteMixin, TestCase):
self.course_run.enrollment_end]: self.course_run.enrollment_end]:
self.assertContains(response, value.strftime(self.date_format)) 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): def test_detail_page_with_comments(self):
""" Verify that detail page contains all the data along with comments """ Verify that detail page contains all the data along with comments
for course. for course.
......
...@@ -229,6 +229,8 @@ class CourseRunDetailView(mixins.LoginRequiredMixin, mixins.PublisherPermissionM ...@@ -229,6 +229,8 @@ class CourseRunDetailView(mixins.LoginRequiredMixin, mixins.PublisherPermissionM
if current_owner_role.role == PublisherUserRole.ProjectCoordinator if current_owner_role.role == PublisherUserRole.ProjectCoordinator
else _('project coordinator')) else _('project coordinator'))
context['is_in_preview_review'] = course_run.is_in_preview_review 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 return context
......
...@@ -6,7 +6,7 @@ from django.utils.translation import ugettext_lazy as _ ...@@ -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.course_metadata.choices import CourseRunPacing
from course_discovery.apps.publisher.choices import PublisherUserRole 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 from course_discovery.apps.publisher_comments.models import Comments, CommentTypeChoices
...@@ -151,6 +151,14 @@ class CourseRunWrapper(BaseWrapper): ...@@ -151,6 +151,14 @@ class CourseRunWrapper(BaseWrapper):
) )
@property @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): def organization_key(self):
organization = self.wrapped_obj.course.organizations.first() organization = self.wrapped_obj.course.organizations.first()
if not organization: if not organization:
......
...@@ -7,7 +7,7 @@ msgid "" ...@@ -7,7 +7,7 @@ msgid ""
msgstr "" msgstr ""
"Project-Id-Version: PACKAGE VERSION\n" "Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \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" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n" "Language-Team: LANGUAGE <LL@li.org>\n"
......
...@@ -7,7 +7,7 @@ msgid "" ...@@ -7,7 +7,7 @@ msgid ""
msgstr "" msgstr ""
"Project-Id-Version: PACKAGE VERSION\n" "Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \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" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n" "Language-Team: LANGUAGE <LL@li.org>\n"
......
...@@ -7,7 +7,7 @@ msgid "" ...@@ -7,7 +7,7 @@ msgid ""
msgstr "" msgstr ""
"Project-Id-Version: PACKAGE VERSION\n" "Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \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" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n" "Language-Team: LANGUAGE <LL@li.org>\n"
......
...@@ -7,7 +7,7 @@ msgid "" ...@@ -7,7 +7,7 @@ msgid ""
msgstr "" msgstr ""
"Project-Id-Version: PACKAGE VERSION\n" "Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \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" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\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