Commit ba64068d by Waheed Ahmed

Added new columns on dashboard.

ECOM-7648
parent 8dd066ce
...@@ -670,6 +670,16 @@ class CourseRunState(TimeStampedModel, ChangedByMixin): ...@@ -670,6 +670,16 @@ class CourseRunState(TimeStampedModel, ChangedByMixin):
""" Check that course run is published or not.""" """ Check that course run is published or not."""
return self.name == CourseRunStateChoices.Published return self.name == CourseRunStateChoices.Published
@property
def is_draft(self):
""" Check that course run is in Draft state or not."""
return self.name == CourseRunStateChoices.Draft
@property
def is_in_review(self):
""" Check that course run is in Review state or not."""
return self.name == CourseRunStateChoices.Review
class PublisherUser(User): class PublisherUser(User):
""" Publisher User Proxy Model. """ """ Publisher User Proxy Model. """
......
...@@ -677,3 +677,21 @@ class CourseRunStateTests(TestCase): ...@@ -677,3 +677,21 @@ class CourseRunStateTests(TestCase):
self.course_run_state.name = CourseRunStateChoices.Published self.course_run_state.name = CourseRunStateChoices.Published
self.course_run_state.save() self.course_run_state.save()
self.assertTrue(self.course_run_state.is_published) self.assertTrue(self.course_run_state.is_published)
def test_is_draft(self):
"""
Verify that method return is_draft status.
"""
self.assertFalse(self.course_run_state.is_draft)
self.course_run_state.name = CourseRunStateChoices.Draft
self.course_run_state.save()
self.assertTrue(self.course_run_state.is_draft)
def test_is_in_review(self):
"""
Verify that method return is_in_review status.
"""
self.assertFalse(self.course_run_state.is_in_review)
self.course_run_state.name = CourseRunStateChoices.Review
self.course_run_state.save()
self.assertTrue(self.course_run_state.is_in_review)
...@@ -1407,6 +1407,14 @@ class DashboardTests(TestCase): ...@@ -1407,6 +1407,14 @@ class DashboardTests(TestCase):
for tab in ['progress', 'preview', 'studio', 'published']: for tab in ['progress', 'preview', 'studio', 'published']:
self.assertContains(response, '<li role="tab" id="tab-{tab}" class="tab"'.format(tab=tab)) self.assertContains(response, '<li role="tab" id="tab-{tab}" class="tab"'.format(tab=tab))
def test_site_name(self):
"""
Verify that site_name is available in context.
"""
response = self.client.get(self.page_url)
site = Site.objects.first()
self.assertEqual(response.context['site_name'], site.name)
class ToggleEmailNotificationTests(TestCase): class ToggleEmailNotificationTests(TestCase):
""" Tests for `ToggleEmailNotification` view. """ """ Tests for `ToggleEmailNotification` view. """
......
...@@ -8,6 +8,7 @@ from django.test import TestCase ...@@ -8,6 +8,7 @@ from django.test import TestCase
from course_discovery.apps.core.tests.helpers import make_image_file from course_discovery.apps.core.tests.helpers import make_image_file
from course_discovery.apps.course_metadata.choices import CourseRunPacing from course_discovery.apps.course_metadata.choices import CourseRunPacing
from course_discovery.apps.course_metadata.tests.factories import OrganizationFactory, PersonFactory, PositionFactory from course_discovery.apps.course_metadata.tests.factories import OrganizationFactory, PersonFactory, PositionFactory
from course_discovery.apps.publisher.choices import CourseRunStateChoices, PublisherUserRole
from course_discovery.apps.publisher.models import Seat from course_discovery.apps.publisher.models import Seat
from course_discovery.apps.publisher.tests import factories from course_discovery.apps.publisher.tests import factories
from course_discovery.apps.publisher.wrappers import CourseRunWrapper from course_discovery.apps.publisher.wrappers import CourseRunWrapper
...@@ -200,3 +201,57 @@ class CourseRunWrapperTests(TestCase): ...@@ -200,3 +201,57 @@ class CourseRunWrapperTests(TestCase):
] ]
self.assertEqual(self.wrapped_course_run.course_staff, expected) self.assertEqual(self.wrapped_course_run.course_staff, expected)
def _assert_course_run_status(self, actual_status, expected_status_text, expected_date):
"""
Assert course run statuses.
"""
expected_status = {'status_text': expected_status_text, 'date': expected_date}
self.assertEqual(actual_status, expected_status)
def _change_state_and_owner(self, course_run_state):
"""
Change course run state to review and ownership to project coordinator.
"""
course_run_state.name = CourseRunStateChoices.Review
course_run_state.change_owner_role(PublisherUserRole.ProjectCoordinator)
def test_course_team_status(self):
"""
Verify that course_team_status returns right statuses.
"""
course_run_state = factories.CourseRunStateFactory(
course_run=self.course_run, owner_role=PublisherUserRole.CourseTeam
)
self._assert_course_run_status(
self.wrapped_course_run.course_team_status, 'In Draft since', self.wrapped_course_run.owner_role_modified
)
self._change_state_and_owner(course_run_state)
self._assert_course_run_status(
self.wrapped_course_run.course_team_status, 'Submitted on', self.wrapped_course_run.owner_role_modified
)
course_run_state.change_owner_role(PublisherUserRole.CourseTeam)
self._assert_course_run_status(
self.wrapped_course_run.course_team_status, 'In Review since', self.wrapped_course_run.owner_role_modified
)
def test_internal_user_status(self):
"""
Verify that internal_user_status returns right statuses.
"""
course_run_state = factories.CourseRunStateFactory(
course_run=self.course_run, owner_role=PublisherUserRole.CourseTeam
)
self._assert_course_run_status(self.wrapped_course_run.internal_user_status, 'n/a', '')
self._change_state_and_owner(course_run_state)
self._assert_course_run_status(
self.wrapped_course_run.internal_user_status, 'In Review since', self.wrapped_course_run.owner_role_modified
)
course_run_state.change_owner_role(PublisherUserRole.CourseTeam)
self._assert_course_run_status(
self.wrapped_course_run.internal_user_status, 'Reviewed on', self.wrapped_course_run.owner_role_modified
)
...@@ -7,6 +7,7 @@ from datetime import datetime, timedelta ...@@ -7,6 +7,7 @@ from datetime import datetime, timedelta
import waffle import waffle
from django.contrib import messages from django.contrib import messages
from django.contrib.sites.models import Site
from django.core.exceptions import ObjectDoesNotExist from django.core.exceptions import ObjectDoesNotExist
from django.core.urlresolvers import reverse from django.core.urlresolvers import reverse
from django.db import transaction from django.db import transaction
...@@ -116,6 +117,9 @@ class Dashboard(mixins.LoginRequiredMixin, ListView): ...@@ -116,6 +117,9 @@ class Dashboard(mixins.LoginRequiredMixin, ListView):
# shows 'studio request' tab only to project coordinators # shows 'studio request' tab only to project coordinators
context['is_project_coordinator'] = is_project_coordinator_user(self.request.user) context['is_project_coordinator'] = is_project_coordinator_user(self.request.user)
site = Site.objects.first()
context['site_name'] = 'edX' if 'edx' in site.name else site.name
return context return context
......
"""Publisher Wrapper Classes""" """Publisher Wrapper Classes"""
from datetime import timedelta from datetime import timedelta
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.models import Seat from course_discovery.apps.publisher.models import Seat
...@@ -204,3 +207,29 @@ class CourseRunWrapper(BaseWrapper): ...@@ -204,3 +207,29 @@ class CourseRunWrapper(BaseWrapper):
staff_list.append(staff_dict) staff_list.append(staff_dict)
return staff_list return staff_list
@property
def course_team_status(self):
course_run_state = self.wrapped_obj.course_run_state
if course_run_state.is_draft and course_run_state.owner_role == PublisherUserRole.CourseTeam:
return {'status_text': _('In Draft since'), 'date': self.owner_role_modified}
elif (course_run_state.owner_role == PublisherUserRole.ProjectCoordinator and
(course_run_state.is_in_review or course_run_state.is_draft)):
return {'status_text': _('Submitted on'), 'date': self.owner_role_modified}
elif course_run_state.is_in_review and course_run_state.owner_role == PublisherUserRole.CourseTeam:
return {'status_text': _('In Review since'), 'date': self.owner_role_modified}
@property
def internal_user_status(self):
course_run_state = self.wrapped_obj.course_run_state
if course_run_state.is_draft and course_run_state.owner_role == PublisherUserRole.CourseTeam:
return {'status_text': _('n/a'), 'date': ''}
elif (course_run_state.owner_role == PublisherUserRole.ProjectCoordinator and
(course_run_state.is_in_review or course_run_state.is_draft)):
return {'status_text': _('In Review since'), 'date': self.owner_role_modified}
elif course_run_state.is_in_review and course_run_state.owner_role == PublisherUserRole.CourseTeam:
return {'status_text': _('Reviewed on'), 'date': self.owner_role_modified}
@property
def owner_role_modified(self):
return self.wrapped_obj.course_run_state.owner_role_modified
...@@ -7,14 +7,14 @@ msgid "" ...@@ -7,14 +7,14 @@ 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-04-05 15:29+0500\n" "POT-Creation-Date: 2017-04-06 12:30+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"
"Language: \n"
"MIME-Version: 1.0\n" "MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n" "Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n" "Content-Transfer-Encoding: 8bit\n"
"Language: \n"
#: apps/api/filters.py #: apps/api/filters.py
#, python-brace-format #, python-brace-format
...@@ -457,7 +457,7 @@ msgstr "" ...@@ -457,7 +457,7 @@ msgstr ""
msgid "Publisher" msgid "Publisher"
msgstr "" msgstr ""
#: apps/publisher/choices.py #: apps/publisher/choices.py templates/publisher/dashboard/_in_progress.html
msgid "Course Team" msgid "Course Team"
msgstr "" msgstr ""
...@@ -848,6 +848,26 @@ msgstr "" ...@@ -848,6 +848,26 @@ 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 "New comment added" msgid "New comment added"
msgstr "" msgstr ""
......
...@@ -7,14 +7,14 @@ msgid "" ...@@ -7,14 +7,14 @@ 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-04-05 15:29+0500\n" "POT-Creation-Date: 2017-04-06 12:30+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"
"Language: \n"
"MIME-Version: 1.0\n" "MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n" "Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n" "Content-Transfer-Encoding: 8bit\n"
"Language: \n"
#: static/js/catalogs-change-form.js #: static/js/catalogs-change-form.js
msgid "Preview" msgid "Preview"
......
...@@ -7,14 +7,14 @@ msgid "" ...@@ -7,14 +7,14 @@ 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-04-05 15:29+0500\n" "POT-Creation-Date: 2017-04-06 12:30+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"
"Language: \n"
"MIME-Version: 1.0\n" "MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n" "Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n" "Content-Transfer-Encoding: 8bit\n"
"Language: \n"
"Plural-Forms: nplurals=2; plural=(n != 1);\n" "Plural-Forms: nplurals=2; plural=(n != 1);\n"
#: apps/api/filters.py #: apps/api/filters.py
...@@ -569,7 +569,7 @@ msgstr "Märkétïng Révïéwér Ⱡ'σяєм ιρѕυм ∂σłσя ѕιт α ...@@ -569,7 +569,7 @@ 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 #: apps/publisher/choices.py templates/publisher/dashboard/_in_progress.html
msgid "Course Team" msgid "Course Team"
msgstr "Çöürsé Téäm Ⱡ'σяєм ιρѕυм ∂σłσя #" msgstr "Çöürsé Téäm Ⱡ'σяєм ιρѕυм ∂σłσя #"
...@@ -1005,6 +1005,26 @@ msgid "Course run updated successfully." ...@@ -1005,6 +1005,26 @@ 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 "New comment added" msgid "New comment added"
msgstr "Néw çömmént äddéd Ⱡ'σяєм ιρѕυм ∂σłσя ѕιт αмє#" msgstr "Néw çömmént äddéd Ⱡ'σяєм ιρѕυм ∂σłσя ѕιт αмє#"
......
...@@ -7,14 +7,14 @@ msgid "" ...@@ -7,14 +7,14 @@ 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-04-05 15:29+0500\n" "POT-Creation-Date: 2017-04-06 12:30+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"
"Language: \n"
"MIME-Version: 1.0\n" "MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n" "Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n" "Content-Transfer-Encoding: 8bit\n"
"Language: \n"
"Plural-Forms: nplurals=2; plural=(n != 1);\n" "Plural-Forms: nplurals=2; plural=(n != 1);\n"
#: static/js/catalogs-change-form.js #: static/js/catalogs-change-form.js
......
...@@ -141,4 +141,13 @@ ...@@ -141,4 +141,13 @@
display: block; display: block;
} }
} }
\ No newline at end of file #progress {
max-width: 100%;
overflow-x: auto;
.dataTables_wrapper {
@include padding-right(20px);
width: 120%;
}
}
...@@ -20,6 +20,12 @@ ...@@ -20,6 +20,12 @@
<th role="button"> <th role="button">
{% trans "End" %} {% trans "End" %}
</th> </th>
<th role="button">
{% trans "Course Team" %}
</th>
<th role="button">
{{ site_name }}
</th>
</tr> </tr>
</thead> </thead>
<tbody> <tbody>
...@@ -40,6 +46,14 @@ ...@@ -40,6 +46,14 @@
<td> <td>
{{ course_run.end|date:"Y-m-d" }} {{ course_run.end|date:"Y-m-d" }}
</td> </td>
<td>
{{ course_run.course_team_status.status_text }}<br>
{{ course_run.course_team_status.date|date:'m/d/y' }}
</td>
<td>
{{ course_run.internal_user_status.status_text }}<br>
{{ course_run.internal_user_status.date|date:'m/d/y' }}
</td>
</tr> </tr>
{% endfor %} {% endfor %}
</tbody> </tbody>
......
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