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
8dc58e54
Commit
8dc58e54
authored
Sep 29, 2017
by
Adam Palay
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
address coursegraph issue where components had the same block id but different locations
parent
bfe2b67e
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
11 additions
and
5 deletions
+11
-5
openedx/core/djangoapps/coursegraph/management/commands/tests/test_dump_to_neo4j.py
+7
-2
openedx/core/djangoapps/coursegraph/tasks.py
+4
-3
No files found.
openedx/core/djangoapps/coursegraph/management/commands/tests/test_dump_to_neo4j.py
View file @
8dc58e54
...
@@ -56,15 +56,20 @@ class TestDumpToNeo4jCommandBase(SharedModuleStoreTestCase):
...
@@ -56,15 +56,20 @@ class TestDumpToNeo4jCommandBase(SharedModuleStoreTestCase):
The side-pointing arrows (->) are PRECEDES relationships; the more
The side-pointing arrows (->) are PRECEDES relationships; the more
vertical lines are PARENT_OF relationships.
vertical lines are PARENT_OF relationships.
The vertical in this course and the first video have the same
display_name, so that their block_ids are the same. This is to
test for a bug where xblocks with the same block_ids (but different
locations) pointed to themselves erroneously.
"""
"""
super
(
TestDumpToNeo4jCommandBase
,
cls
)
.
setUpClass
()
super
(
TestDumpToNeo4jCommandBase
,
cls
)
.
setUpClass
()
cls
.
course
=
CourseFactory
.
create
()
cls
.
course
=
CourseFactory
.
create
()
cls
.
chapter
=
ItemFactory
.
create
(
parent
=
cls
.
course
,
category
=
'chapter'
)
cls
.
chapter
=
ItemFactory
.
create
(
parent
=
cls
.
course
,
category
=
'chapter'
)
cls
.
sequential
=
ItemFactory
.
create
(
parent
=
cls
.
chapter
,
category
=
'sequential'
)
cls
.
sequential
=
ItemFactory
.
create
(
parent
=
cls
.
chapter
,
category
=
'sequential'
)
cls
.
vertical
=
ItemFactory
.
create
(
parent
=
cls
.
sequential
,
category
=
'vertical'
)
cls
.
vertical
=
ItemFactory
.
create
(
parent
=
cls
.
sequential
,
category
=
'vertical'
,
display_name
=
'subject'
)
cls
.
html
=
ItemFactory
.
create
(
parent
=
cls
.
vertical
,
category
=
'html'
)
cls
.
html
=
ItemFactory
.
create
(
parent
=
cls
.
vertical
,
category
=
'html'
)
cls
.
problem
=
ItemFactory
.
create
(
parent
=
cls
.
vertical
,
category
=
'problem'
)
cls
.
problem
=
ItemFactory
.
create
(
parent
=
cls
.
vertical
,
category
=
'problem'
)
cls
.
video
=
ItemFactory
.
create
(
parent
=
cls
.
vertical
,
category
=
'video'
)
cls
.
video
=
ItemFactory
.
create
(
parent
=
cls
.
vertical
,
category
=
'video'
,
display_name
=
'subject'
)
cls
.
video2
=
ItemFactory
.
create
(
parent
=
cls
.
vertical
,
category
=
'video'
)
cls
.
video2
=
ItemFactory
.
create
(
parent
=
cls
.
vertical
,
category
=
'video'
)
cls
.
course2
=
CourseFactory
.
create
()
cls
.
course2
=
CourseFactory
.
create
()
...
...
openedx/core/djangoapps/coursegraph/tasks.py
View file @
8dc58e54
...
@@ -167,15 +167,16 @@ def serialize_course(course_id):
...
@@ -167,15 +167,16 @@ def serialize_course(course_id):
fields
[
field_name
]
=
coerce_types
(
value
)
fields
[
field_name
]
=
coerce_types
(
value
)
node
=
Node
(
block_type
,
'item'
,
**
fields
)
node
=
Node
(
block_type
,
'item'
,
**
fields
)
location_to_node
[
item
.
location
.
block_id
]
=
node
location_to_node
[
item
.
location
.
version_agnostic
()
]
=
node
# create relationships
# create relationships
relationships
=
[]
relationships
=
[]
for
item
in
items
:
for
item
in
items
:
previous_child_node
=
None
previous_child_node
=
None
for
index
,
child
in
enumerate
(
item
.
get_children
()):
for
index
,
child
in
enumerate
(
item
.
get_children
()):
parent_node
=
location_to_node
.
get
(
item
.
location
.
block_id
)
parent_node
=
location_to_node
.
get
(
item
.
location
.
version_agnostic
())
child_node
=
location_to_node
.
get
(
child
.
location
.
block_id
)
child_node
=
location_to_node
.
get
(
child
.
location
.
version_agnostic
())
if
parent_node
is
not
None
and
child_node
is
not
None
:
if
parent_node
is
not
None
and
child_node
is
not
None
:
child_node
[
"index"
]
=
index
child_node
[
"index"
]
=
index
...
...
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