Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
C
course-discovery
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
edx
course-discovery
Commits
a297c8e0
Commit
a297c8e0
authored
Feb 14, 2017
by
Waheed Ahmed
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added owner_role_modified field in state models.
ECOM-7150
parent
4936ed72
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
45 additions
and
1 deletions
+45
-1
course_discovery/apps/publisher/api/tests/test_views.py
+3
-0
course_discovery/apps/publisher/migrations/0036_auto_20170216_0946.py
+35
-0
course_discovery/apps/publisher/models.py
+6
-0
course_discovery/apps/publisher/views.py
+1
-1
No files found.
course_discovery/apps/publisher/api/tests/test_views.py
View file @
a297c8e0
...
...
@@ -445,6 +445,8 @@ class ChangeCourseStateViewTests(TestCase):
course
=
self
.
course
,
role
=
PublisherUserRole
.
MarketingReviewer
,
user
=
marketing_user
)
old_owner_role_modified
=
self
.
course_state
.
owner_role_modified
response
=
self
.
client
.
patch
(
self
.
change_state_url
,
data
=
json
.
dumps
({
'name'
:
CourseStateChoices
.
Review
}),
...
...
@@ -457,6 +459,7 @@ class ChangeCourseStateViewTests(TestCase):
self
.
assertEqual
(
self
.
course_state
.
name
,
CourseStateChoices
.
Review
)
self
.
assertEqual
(
self
.
course_state
.
owner_role
,
PublisherUserRole
.
MarketingReviewer
)
self
.
assertGreater
(
self
.
course_state
.
owner_role_modified
,
old_owner_role_modified
)
self
.
_assert_email_sent
(
marketing_user
)
...
...
course_discovery/apps/publisher/migrations/0036_auto_20170216_0946.py
0 → 100644
View file @
a297c8e0
# -*- coding: utf-8 -*-
# Generated by Django 1.9.12 on 2017-02-16 09:46
from
__future__
import
unicode_literals
from
django.db
import
migrations
,
models
class
Migration
(
migrations
.
Migration
):
dependencies
=
[
(
'publisher'
,
'0035_publisheruser'
),
]
operations
=
[
migrations
.
AddField
(
model_name
=
'courserunstate'
,
name
=
'owner_role_modified'
,
field
=
models
.
DateTimeField
(
auto_now_add
=
True
,
null
=
True
),
),
migrations
.
AddField
(
model_name
=
'coursestate'
,
name
=
'owner_role_modified'
,
field
=
models
.
DateTimeField
(
auto_now_add
=
True
,
null
=
True
),
),
migrations
.
AddField
(
model_name
=
'historicalcourserunstate'
,
name
=
'owner_role_modified'
,
field
=
models
.
DateTimeField
(
blank
=
True
,
editable
=
False
,
null
=
True
),
),
migrations
.
AddField
(
model_name
=
'historicalcoursestate'
,
name
=
'owner_role_modified'
,
field
=
models
.
DateTimeField
(
blank
=
True
,
editable
=
False
,
null
=
True
),
),
]
course_discovery/apps/publisher/models.py
View file @
a297c8e0
...
...
@@ -7,6 +7,7 @@ from django.core.urlresolvers import reverse
from
django.db
import
models
from
django.db.models.signals
import
pre_save
from
django.dispatch
import
receiver
from
django.utils
import
timezone
from
django.utils.translation
import
ugettext_lazy
as
_
from
django_extensions.db.models
import
TimeStampedModel
from
django_fsm
import
FSMField
,
transition
...
...
@@ -495,6 +496,7 @@ class CourseState(TimeStampedModel, ChangedByMixin):
approved_by_role
=
models
.
CharField
(
blank
=
True
,
null
=
True
,
max_length
=
63
,
choices
=
PublisherUserRole
.
choices
)
owner_role
=
models
.
CharField
(
max_length
=
63
,
choices
=
PublisherUserRole
.
choices
)
course
=
models
.
OneToOneField
(
Course
,
related_name
=
'course_state'
)
owner_role_modified
=
models
.
DateTimeField
(
auto_now_add
=
True
,
null
=
True
,
blank
=
True
)
history
=
HistoricalRecords
()
...
...
@@ -539,8 +541,11 @@ class CourseState(TimeStampedModel, ChangedByMixin):
user_role
=
self
.
course
.
course_user_roles
.
get
(
user
=
user
)
if
user_role
.
role
==
PublisherUserRole
.
MarketingReviewer
:
self
.
owner_role
=
PublisherUserRole
.
CourseTeam
self
.
owner_role_modified
=
timezone
.
now
()
elif
user_role
.
role
==
PublisherUserRole
.
CourseTeam
:
self
.
owner_role
=
PublisherUserRole
.
MarketingReviewer
self
.
owner_role_modified
=
timezone
.
now
()
self
.
review
()
if
waffle
.
switch_is_active
(
'enable_publisher_email_notifications'
):
...
...
@@ -559,6 +564,7 @@ class CourseRunState(TimeStampedModel, ChangedByMixin):
approved_by_role
=
models
.
CharField
(
blank
=
True
,
null
=
True
,
max_length
=
63
,
choices
=
PublisherUserRole
.
choices
)
owner_role
=
models
.
CharField
(
max_length
=
63
,
choices
=
PublisherUserRole
.
choices
)
course_run
=
models
.
OneToOneField
(
CourseRun
,
related_name
=
'course_run_state'
)
owner_role_modified
=
models
.
DateTimeField
(
auto_now_add
=
True
,
null
=
True
,
blank
=
True
)
history
=
HistoricalRecords
()
...
...
course_discovery/apps/publisher/views.py
View file @
a297c8e0
...
...
@@ -399,7 +399,7 @@ class CourseDetailView(mixins.LoginRequiredMixin, mixins.PublisherPermissionMixi
}
if
course_state
.
owner_role
==
course_role
.
role
:
role_widget
[
'ownership'
]
=
timezone
.
now
()
-
course_state
.
modified
role_widget
[
'ownership'
]
=
timezone
.
now
()
-
course_state
.
owner_role_
modified
if
user
==
course_role
.
user
:
role_widget
[
'state_button'
]
=
STATE_BUTTONS
.
get
(
course_state
.
name
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment