Commit 9a85c583 by Waheed Ahmed

Added columns to course listing page.

ECOM-7834
parent df5010ee
...@@ -557,6 +557,7 @@ class CourseState(TimeStampedModel, ChangedByMixin): ...@@ -557,6 +557,7 @@ class CourseState(TimeStampedModel, ChangedByMixin):
elif state == CourseStateChoices.Approved: elif state == CourseStateChoices.Approved:
user_role = self.course.course_user_roles.get(user=user) user_role = self.course.course_user_roles.get(user=user)
self.approved_by_role = user_role.role self.approved_by_role = user_role.role
self.marketing_reviewed = True
self.approved() self.approved()
if is_notifications_enabled: if is_notifications_enabled:
...@@ -577,6 +578,36 @@ class CourseState(TimeStampedModel, ChangedByMixin): ...@@ -577,6 +578,36 @@ class CourseState(TimeStampedModel, ChangedByMixin):
self.owner_role_modified = timezone.now() self.owner_role_modified = timezone.now()
self.save() self.save()
@property
def is_draft(self):
""" Check that course is in Draft state or not."""
return self.name == CourseStateChoices.Draft
@property
def is_in_review(self):
""" Check that course is in Review state or not."""
return self.name == CourseStateChoices.Review
@property
def course_team_status(self):
if self.is_draft and self.owner_role == PublisherUserRole.CourseTeam and not self.marketing_reviewed:
return {'status_text': _('In Draft since'), 'date': self.owner_role_modified}
elif self.owner_role == PublisherUserRole.MarketingReviewer:
return {'status_text': _('Submitted on'), 'date': self.owner_role_modified}
elif self.owner_role == PublisherUserRole.CourseTeam and self.is_approved:
return {'status_text': _('Reviewed on'), 'date': self.owner_role_modified}
elif self.marketing_reviewed and self.owner_role == PublisherUserRole.CourseTeam:
return {'status_text': _('In Review since'), 'date': self.owner_role_modified}
@property
def internal_user_status(self):
if self.is_draft and self.owner_role == PublisherUserRole.CourseTeam:
return {'status_text': _('n/a'), 'date': ''}
elif self.owner_role == PublisherUserRole.MarketingReviewer and (self.is_in_review or self.is_draft):
return {'status_text': _('In Review since'), 'date': self.owner_role_modified}
elif self.marketing_reviewed:
return {'status_text': _('Reviewed on'), 'date': self.owner_role_modified}
class CourseRunState(TimeStampedModel, ChangedByMixin): class CourseRunState(TimeStampedModel, ChangedByMixin):
""" Publisher Workflow Course Run State Model. """ """ Publisher Workflow Course Run State Model. """
......
...@@ -518,6 +518,64 @@ class CourseStateTests(TestCase): ...@@ -518,6 +518,64 @@ class CourseStateTests(TestCase):
self.course_state.change_owner_role(role) self.course_state.change_owner_role(role)
self.assertEqual(self.course_state.owner_role, role) self.assertEqual(self.course_state.owner_role, role)
def _assert_course_run_status(self, actual_status, expected_status_text, expected_date):
"""
Assert course statuses.
"""
expected_status = {'status_text': expected_status_text, 'date': expected_date}
self.assertEqual(actual_status, expected_status)
def _change_state_and_owner(self, course_state):
"""
Change course state to review and ownership to marketing.
"""
course_state.name = CourseStateChoices.Review
course_state.change_owner_role(PublisherUserRole.MarketingReviewer)
def test_course_team_status(self):
"""
Verify that course_team_status returns right statuses.
"""
course_state = factories.CourseStateFactory(owner_role=PublisherUserRole.CourseTeam)
self._assert_course_run_status(
course_state.course_team_status, 'In Draft since', course_state.owner_role_modified
)
self._change_state_and_owner(course_state)
self._assert_course_run_status(
course_state.course_team_status, 'Submitted on', course_state.owner_role_modified
)
course_state.marketing_reviewed = True
course_state.change_owner_role(PublisherUserRole.CourseTeam)
self._assert_course_run_status(
course_state.course_team_status, 'In Review since', course_state.owner_role_modified
)
course_state.approved()
course_state.save()
self._assert_course_run_status(
course_state.course_team_status, 'Reviewed on', course_state.owner_role_modified
)
def test_internal_user_status(self):
"""
Verify that internal_user_status returns right statuses.
"""
course_state = factories.CourseStateFactory(owner_role=PublisherUserRole.CourseTeam)
self._assert_course_run_status(course_state.internal_user_status, 'n/a', '')
self._change_state_and_owner(course_state)
self._assert_course_run_status(
course_state.internal_user_status, 'In Review since', course_state.owner_role_modified
)
course_state.marketing_reviewed = True
course_state.change_owner_role(PublisherUserRole.CourseTeam)
self._assert_course_run_status(
course_state.internal_user_status, 'Reviewed on', course_state.owner_role_modified
)
@ddt.ddt @ddt.ddt
class CourseRunStateTests(TestCase): class CourseRunStateTests(TestCase):
......
...@@ -775,6 +775,8 @@ class CourseListView(mixins.LoginRequiredMixin, ListView): ...@@ -775,6 +775,8 @@ class CourseListView(mixins.LoginRequiredMixin, ListView):
def get_context_data(self, **kwargs): def get_context_data(self, **kwargs):
context = super(CourseListView, self).get_context_data(**kwargs) context = super(CourseListView, self).get_context_data(**kwargs)
context['publisher_hide_features_for_pilot'] = waffle.switch_is_active('publisher_hide_features_for_pilot') context['publisher_hide_features_for_pilot'] = waffle.switch_is_active('publisher_hide_features_for_pilot')
site = Site.objects.first()
context['site_name'] = 'edX' if 'edx' in site.name.lower() else site.name
return context return context
......
...@@ -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: 2017-05-29 16:50+0500\n" "POT-Creation-Date: 2017-05-30 14:29+0500\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"
...@@ -480,7 +480,8 @@ msgstr "" ...@@ -480,7 +480,8 @@ msgstr ""
msgid "Publisher" msgid "Publisher"
msgstr "" msgstr ""
#: apps/publisher/choices.py templates/publisher/dashboard/_in_progress.html #: apps/publisher/choices.py templates/publisher/courses.html
#: templates/publisher/dashboard/_in_progress.html
msgid "Course Team" msgid "Course Team"
msgstr "" msgstr ""
...@@ -826,6 +827,26 @@ msgstr "" ...@@ -826,6 +827,26 @@ msgstr ""
msgid "Course Role" msgid "Course Role"
msgstr "" msgstr ""
#: apps/publisher/models.py apps/publisher/wrappers.py
msgid "In Draft since"
msgstr ""
#: apps/publisher/models.py apps/publisher/wrappers.py
msgid "Submitted on"
msgstr ""
#: apps/publisher/models.py apps/publisher/wrappers.py
msgid "Reviewed on"
msgstr ""
#: apps/publisher/models.py apps/publisher/wrappers.py
msgid "In Review since"
msgstr ""
#: apps/publisher/models.py apps/publisher/wrappers.py
msgid "n/a"
msgstr ""
#: apps/publisher/validators.py #: apps/publisher/validators.py
#, python-format #, python-format
msgid "" msgid ""
...@@ -927,26 +948,6 @@ msgstr "" ...@@ -927,26 +948,6 @@ msgstr ""
msgid "Course run updated successfully." msgid "Course run updated successfully."
msgstr "" msgstr ""
#: apps/publisher/wrappers.py
msgid "In Draft since"
msgstr ""
#: apps/publisher/wrappers.py
msgid "Submitted on"
msgstr ""
#: apps/publisher/wrappers.py
msgid "In Review since"
msgstr ""
#: apps/publisher/wrappers.py
msgid "n/a"
msgstr ""
#: apps/publisher/wrappers.py
msgid "Reviewed on"
msgstr ""
#: apps/publisher_comments/emails.py #: apps/publisher_comments/emails.py
msgid "Comment added:" msgid "Comment added:"
msgstr "" msgstr ""
......
...@@ -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: 2017-05-29 16:50+0500\n" "POT-Creation-Date: 2017-05-30 14:29+0500\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: 2017-05-29 16:50+0500\n" "POT-Creation-Date: 2017-05-30 14:29+0500\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"
...@@ -595,7 +595,8 @@ msgstr "Märkétïng Révïéwér Ⱡ'σяєм ιρѕυм ∂σłσя ѕιт α ...@@ -595,7 +595,8 @@ msgstr "Märkétïng Révïéwér Ⱡ'σяєм ιρѕυм ∂σłσя ѕιт α
msgid "Publisher" msgid "Publisher"
msgstr "Püßlïshér Ⱡ'σяєм ιρѕυм ∂σł#" msgstr "Püßlïshér Ⱡ'σяєм ιρѕυм ∂σł#"
#: apps/publisher/choices.py templates/publisher/dashboard/_in_progress.html #: apps/publisher/choices.py templates/publisher/courses.html
#: templates/publisher/dashboard/_in_progress.html
msgid "Course Team" msgid "Course Team"
msgstr "Çöürsé Téäm Ⱡ'σяєм ιρѕυм ∂σłσя #" msgstr "Çöürsé Téäm Ⱡ'σяєм ιρѕυм ∂σłσя #"
...@@ -970,6 +971,26 @@ msgstr "Örgänïzätïön Rölé Ⱡ'σяєм ιρѕυм ∂σłσя ѕιт α ...@@ -970,6 +971,26 @@ msgstr "Örgänïzätïön Rölé Ⱡ'σяєм ιρѕυм ∂σłσя ѕιт α
msgid "Course Role" msgid "Course Role"
msgstr "Çöürsé Rölé Ⱡ'σяєм ιρѕυм ∂σłσя #" msgstr "Çöürsé Rölé Ⱡ'σяєм ιρѕυм ∂σłσя #"
#: apps/publisher/models.py apps/publisher/wrappers.py
msgid "In Draft since"
msgstr "Ìn Dräft sïnçé Ⱡ'σяєм ιρѕυм ∂σłσя ѕιт#"
#: apps/publisher/models.py apps/publisher/wrappers.py
msgid "Submitted on"
msgstr "Süßmïttéd ön Ⱡ'σяєм ιρѕυм ∂σłσя ѕ#"
#: apps/publisher/models.py apps/publisher/wrappers.py
msgid "Reviewed on"
msgstr "Révïéwéd ön Ⱡ'σяєм ιρѕυм ∂σłσя #"
#: apps/publisher/models.py apps/publisher/wrappers.py
msgid "In Review since"
msgstr "Ìn Révïéw sïnçé Ⱡ'σяєм ιρѕυм ∂σłσя ѕιт α#"
#: apps/publisher/models.py apps/publisher/wrappers.py
msgid "n/a"
msgstr "n/ä Ⱡ'σяєм#"
#: apps/publisher/validators.py #: apps/publisher/validators.py
#, python-format #, python-format
msgid "" msgid ""
...@@ -1092,26 +1113,6 @@ msgid "Course run updated successfully." ...@@ -1092,26 +1113,6 @@ msgid "Course run updated successfully."
msgstr "" msgstr ""
"Çöürsé rün üpdätéd süççéssfüllý. Ⱡ'σяєм ιρѕυм ∂σłσя ѕιт αмєт, ¢σηѕє¢тє#" "Çöürsé rün üpdätéd süççéssfüllý. Ⱡ'σяєм ιρѕυм ∂σłσя ѕιт αмєт, ¢σηѕє¢тє#"
#: apps/publisher/wrappers.py
msgid "In Draft since"
msgstr "Ìn Dräft sïnçé Ⱡ'σяєм ιρѕυм ∂σłσя ѕιт#"
#: apps/publisher/wrappers.py
msgid "Submitted on"
msgstr "Süßmïttéd ön Ⱡ'σяєм ιρѕυм ∂σłσя ѕ#"
#: apps/publisher/wrappers.py
msgid "In Review since"
msgstr "Ìn Révïéw sïnçé Ⱡ'σяєм ιρѕυм ∂σłσя ѕιт α#"
#: apps/publisher/wrappers.py
msgid "n/a"
msgstr "n/ä Ⱡ'σяєм#"
#: apps/publisher/wrappers.py
msgid "Reviewed on"
msgstr "Révïéwéd ön Ⱡ'σяєм ιρѕυм ∂σłσя #"
#: apps/publisher_comments/emails.py #: apps/publisher_comments/emails.py
msgid "Comment added:" msgid "Comment added:"
msgstr "Çömmént äddéd: Ⱡ'σяєм ιρѕυм ∂σłσя ѕιт#" msgstr "Çömmént äddéd: Ⱡ'σяєм ιρѕυм ∂σłσя ѕιт#"
......
...@@ -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: 2017-05-29 16:50+0500\n" "POT-Creation-Date: 2017-05-30 14:29+0500\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"
......
...@@ -28,6 +28,12 @@ ...@@ -28,6 +28,12 @@
<th role="button"> <th role="button">
{% trans "Runs" %} {% trans "Runs" %}
</th> </th>
<th role="button">
{% trans "Course Team" %}
</th>
<th role="button">
{{ site_name }}
</th>
<th></th> <th></th>
</tr> </tr>
</thead> </thead>
...@@ -53,6 +59,14 @@ ...@@ -53,6 +59,14 @@
{{ course.publisher_course_runs.count }} {{ course.publisher_course_runs.count }}
</td> </td>
<td> <td>
{{ course.course_state.course_team_status.status_text }}<br>
{{ course.course_state.course_team_status.date|date:'m/d/y' }}
</td>
<td>
{{ course.course_state.internal_user_status.status_text }}<br>
{{ course.course_state.internal_user_status.date|date:'m/d/y' }}
</td>
<td>
{% if not publisher_hide_features_for_pilot and course|can_edit_course:request.user %} {% if not publisher_hide_features_for_pilot and course|can_edit_course:request.user %}
<a href="{% url 'publisher:publisher_courses_edit' course.id %}" class="btn btn-brand btn-small btn-course-edit"> <a href="{% url 'publisher:publisher_courses_edit' course.id %}" class="btn btn-brand btn-small btn-course-edit">
{% trans "Edit" %} {% trans "Edit" %}
......
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