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
114d800c
Commit
114d800c
authored
Feb 06, 2013
by
Chris Dodge
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
need to make path_to_location a dictionary since it needs to be keyed by the location
parent
5a25d7fa
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
5 additions
and
3 deletions
+5
-3
lms/djangoapps/django_comment_client/utils.py
+5
-3
No files found.
lms/djangoapps/django_comment_client/utils.py
View file @
114d800c
...
@@ -166,6 +166,7 @@ def initialize_discussion_info(course):
...
@@ -166,6 +166,7 @@ def initialize_discussion_info(course):
# get all discussion models within this course_id
# get all discussion models within this course_id
all_modules
=
modulestore
()
.
get_items
([
'i4x'
,
course
.
location
.
org
,
course
.
location
.
course
,
'discussion'
,
None
],
course_id
=
course_id
)
all_modules
=
modulestore
()
.
get_items
([
'i4x'
,
course
.
location
.
org
,
course
.
location
.
course
,
'discussion'
,
None
],
course_id
=
course_id
)
path_to_locations
=
{}
for
module
in
all_modules
:
for
module
in
all_modules
:
skip_module
=
False
skip_module
=
False
for
key
in
(
'id'
,
'discussion_category'
,
'for'
):
for
key
in
(
'id'
,
'discussion_category'
,
'for'
):
...
@@ -176,7 +177,7 @@ def initialize_discussion_info(course):
...
@@ -176,7 +177,7 @@ def initialize_discussion_info(course):
# cdodge: pre-compute the path_to_location. Note this can throw an exception for any
# cdodge: pre-compute the path_to_location. Note this can throw an exception for any
# dangling discussion modules
# dangling discussion modules
try
:
try
:
_DISCUSSIONINFO
[
course
.
id
][
'path_to_location'
]
=
path_to_location
(
modulestore
(),
course
.
id
,
module
.
location
)
path_to_locations
[
module
.
location
]
=
path_to_location
(
modulestore
(),
course
.
id
,
module
.
location
)
except
NoPathToItem
:
except
NoPathToItem
:
log
.
warning
(
"Could not compute path_to_location for {0}. Perhaps this is an orphaned discussion module?!? Skipping..."
.
format
(
module
.
location
))
log
.
warning
(
"Could not compute path_to_location for {0}. Perhaps this is an orphaned discussion module?!? Skipping..."
.
format
(
module
.
location
))
skip_module
=
True
skip_module
=
True
...
@@ -245,6 +246,7 @@ def initialize_discussion_info(course):
...
@@ -245,6 +246,7 @@ def initialize_discussion_info(course):
_DISCUSSIONINFO
[
course
.
id
][
'id_map'
]
=
discussion_id_map
_DISCUSSIONINFO
[
course
.
id
][
'id_map'
]
=
discussion_id_map
_DISCUSSIONINFO
[
course
.
id
][
'category_map'
]
=
category_map
_DISCUSSIONINFO
[
course
.
id
][
'category_map'
]
=
category_map
_DISCUSSIONINFO
[
course
.
id
][
'timestamp'
]
=
datetime
.
now
()
_DISCUSSIONINFO
[
course
.
id
][
'timestamp'
]
=
datetime
.
now
()
_DISCUSSIONINFO
[
course
.
id
][
'path_to_location'
]
=
path_to_locations
class
JsonResponse
(
HttpResponse
):
class
JsonResponse
(
HttpResponse
):
...
@@ -402,8 +404,8 @@ def get_courseware_context(content, course):
...
@@ -402,8 +404,8 @@ def get_courseware_context(content, course):
title
=
id_map
[
id
][
"title"
]
title
=
id_map
[
id
][
"title"
]
# cdodge: did we pre-compute, if so, then let's use that rather than recomputing
# cdodge: did we pre-compute, if so, then let's use that rather than recomputing
if
'path_to_location'
in
_DISCUSSIONINFO
[
course
.
id
]:
if
'path_to_location'
in
_DISCUSSIONINFO
[
course
.
id
]
and
location
in
_DISCUSSIONINFO
[
course
.
id
][
'path_to_location'
]
:
(
course_id
,
chapter
,
section
,
position
)
=
_DISCUSSIONINFO
[
course
.
id
][
'path_to_location'
]
(
course_id
,
chapter
,
section
,
position
)
=
_DISCUSSIONINFO
[
course
.
id
][
'path_to_location'
]
[
location
]
else
:
else
:
(
course_id
,
chapter
,
section
,
position
)
=
path_to_location
(
modulestore
(),
course
.
id
,
location
)
(
course_id
,
chapter
,
section
,
position
)
=
path_to_location
(
modulestore
(),
course
.
id
,
location
)
...
...
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