Commit 286c9dad by asadazam93 Committed by AsadAzam

Fixed course declined status on dashboard

parent 7b0c0e8b
...@@ -37,7 +37,7 @@ ...@@ -37,7 +37,7 @@
<td data-order="{{ course_run.owner_role_modified|date:"Y-m-d" }}" > <td data-order="{{ course_run.owner_role_modified|date:"Y-m-d" }}" >
{% if course_run.course_run_state.preview_accepted %} {% if course_run.course_run_state.preview_accepted %}
{% trans "Approved since " %} {% trans "Approved since " %}
{% elif course_run.preview_declined and not course_run.preview_url %} {% elif course_run.preview_declined and course_run.owner_role_is_publisher %}
{% trans "Declined since " %} {% trans "Declined since " %}
{% elif not course_run.preview_url %} {% elif not course_run.preview_url %}
{% trans "Preview Requested since " %} {% trans "Preview Requested since " %}
......
...@@ -225,6 +225,18 @@ class CourseRunWrapperTests(TestCase): ...@@ -225,6 +225,18 @@ class CourseRunWrapperTests(TestCase):
course_run_state.change_owner_role(PublisherUserRole.CourseTeam) course_run_state.change_owner_role(PublisherUserRole.CourseTeam)
assert self.wrapped_course_run.course_team_status == 'Awaiting Course Team Review' assert self.wrapped_course_run.course_team_status == 'Awaiting Course Team Review'
def test_owner_role_is_publisher(self):
"""
Verify that owner_role_is_publisher returns true if owner is publisher and false otherwise
"""
course_run_state = factories.CourseRunStateFactory(
course_run=self.course_run, owner_role=PublisherUserRole.Publisher
)
self.assertEqual(self.wrapped_course_run.owner_role_is_publisher, True)
course_run_state.change_owner_role(PublisherUserRole.CourseTeam)
self.assertEqual(self.wrapped_course_run.owner_role_is_publisher, False)
def test_internal_user_status(self): def test_internal_user_status(self):
""" """
Verify that internal_user_status returns right statuses. Verify that internal_user_status returns right statuses.
......
...@@ -264,6 +264,10 @@ class CourseRunWrapper(BaseWrapper): ...@@ -264,6 +264,10 @@ class CourseRunWrapper(BaseWrapper):
return self.ApprovedByProjectCoordinator return self.ApprovedByProjectCoordinator
@property @property
def owner_role_is_publisher(self):
return self.wrapped_obj.course_run_state.owner_role == PublisherUserRole.Publisher
@property
def owner_role_modified(self): def owner_role_modified(self):
return self.wrapped_obj.course_run_state.owner_role_modified return self.wrapped_obj.course_run_state.owner_role_modified
......
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