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
69711a91
Commit
69711a91
authored
Jan 24, 2013
by
Victor Shnayder
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix inline discussion cohorting, debug logging
parent
fb7614a8
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
30 additions
and
4 deletions
+30
-4
common/djangoapps/course_groups/cohorts.py
+17
-2
common/lib/xmodule/xmodule/course_module.py
+13
-2
No files found.
common/djangoapps/course_groups/cohorts.py
View file @
69711a91
...
...
@@ -40,7 +40,18 @@ def is_commentable_cohorted(course_id, commentable_id):
Http404 if the course doesn't exist.
"""
course
=
courses
.
get_course_by_id
(
course_id
)
ans
=
commentable_id
in
course
.
cohorted_discussions
()
if
not
course
.
is_cohorted
:
# this is the easy case :)
ans
=
False
elif
commentable_id
in
course
.
top_level_discussion_topic_ids
:
# top level discussions have to be manually configured as cohorted
# (default is not)
ans
=
commentable_id
in
course
.
cohorted_discussions
()
else
:
# inline discussions are cohorted by default
ans
=
True
log
.
debug
(
"is_commentable_cohorted({0}, {1}) = {2}"
.
format
(
course_id
,
commentable_id
,
ans
))
...
...
@@ -49,7 +60,11 @@ def is_commentable_cohorted(course_id, commentable_id):
def
get_cohort
(
user
,
course_id
):
c
=
_get_cohort
(
user
,
course_id
)
log
.
debug
(
"get_cohort({0}, {1}) = {2}"
.
format
(
user
,
course_id
,
c
.
id
))
log
.
debug
(
"get_cohort({0}, {1}) = {2}"
.
format
(
user
,
course_id
,
c
.
id
if
c
is
not
None
else
None
))
return
c
def
_get_cohort
(
user
,
course_id
):
"""
...
...
common/lib/xmodule/xmodule/course_module.py
View file @
69711a91
...
...
@@ -371,10 +371,21 @@ class CourseDescriptor(SequenceDescriptor):
return
bool
(
config
.
get
(
"cohorted"
))
@property
def
top_level_discussion_topic_ids
(
self
):
"""
Return list of topic ids defined in course policy.
"""
topics
=
self
.
metadata
.
get
(
"discussion_topics"
,
{})
return
[
d
[
"id"
]
for
d
in
topics
.
values
()]
@property
def
cohorted_discussions
(
self
):
"""
Return the set of discussions that is cohorted. It may be the empty
set.
Return the set of discussions that is explicitly cohorted. It may be
the empty set. Note that all inline discussions are automatically
cohorted based on the course's is_cohorted setting.
"""
config
=
self
.
metadata
.
get
(
"cohort_config"
)
if
config
is
None
:
...
...
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