Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
E
edx-platform
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
edx-platform
Commits
59b3dc61
Commit
59b3dc61
authored
Jan 23, 2013
by
Kevin Chugh
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
lms producing grouped content
parent
b26c59bd
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
29 additions
and
2 deletions
+29
-2
lms/djangoapps/courseware/courses.py
+1
-0
lms/djangoapps/django_comment_client/base/views.py
+19
-0
lms/djangoapps/django_comment_client/forum/views.py
+7
-0
lms/lib/comment_client/thread.py
+2
-2
No files found.
lms/djangoapps/courseware/courses.py
View file @
59b3dc61
...
...
@@ -72,6 +72,7 @@ def get_cohort_id(user, course_id):
and if the course is not cohorted or the user is an instructor, return None
"""
return
101
def
is_commentable_cohorted
(
course_id
,
commentable_id
):
"""
...
...
lms/djangoapps/django_comment_client/base/views.py
View file @
59b3dc61
...
...
@@ -21,6 +21,7 @@ from django.contrib.auth.models import User
from
mitxmako.shortcuts
import
render_to_response
,
render_to_string
from
courseware.courses
import
get_course_with_access
from
courseware.courses
import
get_cohort_id
from
django_comment_client.utils
import
JsonResponse
,
JsonError
,
extract
,
get_courseware_context
...
...
@@ -83,6 +84,24 @@ def create_thread(request, course_id, commentable_id):
'course_id'
:
course_id
,
'user_id'
:
request
.
user
.
id
,
})
#now cohort id
#if the group id came in from the form, set it there, otherwise,
#see if the user and the commentable are cohorted
print
post
group_id
=
None
if
'group_id'
in
post
:
group_id
=
post
[
'group_id'
]
if
group_id
is
None
:
group_id
=
get_cohort_id
(
request
.
user
,
course_id
)
if
group_id
is
not
None
:
thread
.
update_attributes
(
**
{
'group_id'
:
group_id
})
thread
.
save
()
if
post
.
get
(
'auto_subscribe'
,
'false'
)
.
lower
()
==
'true'
:
user
=
cc
.
User
.
from_django_user
(
request
.
user
)
...
...
lms/djangoapps/django_comment_client/forum/views.py
View file @
59b3dc61
...
...
@@ -11,6 +11,7 @@ from django.contrib.auth.models import User
from
mitxmako.shortcuts
import
render_to_response
,
render_to_string
from
courseware.courses
import
get_course_with_access
from
courseware.courses
import
get_cohort_id
from
courseware.access
import
has_access
from
urllib
import
urlencode
...
...
@@ -58,6 +59,12 @@ def get_threads(request, course_id, discussion_id=None, per_page=THREADS_PER_PAG
user
.
default_sort_key
=
request
.
GET
.
get
(
'sort_key'
)
user
.
save
()
#if the course-user is cohorted, then add the group id
group_id
=
get_cohort_id
(
user
,
course_id
);
if
group_id
:
default_query_params
[
"group_id"
]
=
group_id
;
query_params
=
merge_dict
(
default_query_params
,
strip_none
(
extract
(
request
.
GET
,
[
'page'
,
'sort_key'
,
'sort_order'
,
'text'
,
'tags'
,
'commentable_ids'
])))
...
...
lms/lib/comment_client/thread.py
View file @
59b3dc61
...
...
@@ -10,12 +10,12 @@ class Thread(models.Model):
'closed'
,
'tags'
,
'votes'
,
'commentable_id'
,
'username'
,
'user_id'
,
'created_at'
,
'updated_at'
,
'comments_count'
,
'unread_comments_count'
,
'at_position_list'
,
'children'
,
'type'
,
'highlighted_title'
,
'highlighted_body'
,
'endorsed'
,
'read'
'highlighted_body'
,
'endorsed'
,
'read'
,
'group_id'
]
updatable_fields
=
[
'title'
,
'body'
,
'anonymous'
,
'anonymous_to_peers'
,
'course_id'
,
'closed'
,
'tags'
,
'user_id'
,
'commentable_id'
,
'closed'
,
'tags'
,
'user_id'
,
'commentable_id'
,
'group_id'
]
initializable_fields
=
updatable_fields
...
...
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