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
1a5e15fd
Commit
1a5e15fd
authored
Jan 30, 2017
by
Sanford Student
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add course and user id to library content assigned
parent
3d080584
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
24 additions
and
8 deletions
+24
-8
lms/djangoapps/course_blocks/transformers/library_content.py
+17
-5
lms/djangoapps/courseware/module_render.py
+7
-3
No files found.
lms/djangoapps/course_blocks/transformers/library_content.py
View file @
1a5e15fd
...
...
@@ -7,6 +7,7 @@ from openedx.core.lib.block_structure.transformer import BlockStructureTransform
from
xmodule.library_content_module
import
LibraryContentModule
from
xmodule.modulestore.django
import
modulestore
from
eventtracking
import
tracker
from
track
import
contexts
class
ContentLibraryTransformer
(
FilteringTransformerMixin
,
BlockStructureTransformer
):
...
...
@@ -105,7 +106,14 @@ class ContentLibraryTransformer(FilteringTransformerMixin, BlockStructureTransfo
)
# publish events for analytics
self
.
_publish_events
(
block_structure
,
block_key
,
previous_count
,
max_count
,
block_keys
)
self
.
_publish_events
(
block_structure
,
block_key
,
previous_count
,
max_count
,
block_keys
,
usage_info
.
user
.
id
,
)
all_selected_children
.
update
(
usage_info
.
course_key
.
make_usage_key
(
s
[
0
],
s
[
1
])
for
s
in
selected
)
def
check_child_removal
(
block_key
):
...
...
@@ -145,8 +153,7 @@ class ContentLibraryTransformer(FilteringTransformerMixin, BlockStructureTransfo
except
StudentModule
.
DoesNotExist
:
return
None
@classmethod
def
_publish_events
(
cls
,
block_structure
,
location
,
previous_count
,
max_count
,
block_keys
):
def
_publish_events
(
self
,
block_structure
,
location
,
previous_count
,
max_count
,
block_keys
,
user_id
):
"""
Helper method to publish events for analytics purposes
"""
...
...
@@ -171,10 +178,15 @@ class ContentLibraryTransformer(FilteringTransformerMixin, BlockStructureTransfo
"location"
:
unicode
(
location
),
"previous_count"
:
previous_count
,
"result"
:
result
,
"max_count"
:
max_count
"max_count"
:
max_count
,
}
event_data
.
update
(
kwargs
)
tracker
.
emit
(
"edx.librarycontentblock.content.{}"
.
format
(
event_name
),
event_data
)
context
=
contexts
.
course_context_from_course_id
(
location
.
course_key
)
if
user_id
:
context
[
'user_id'
]
=
user_id
full_event_name
=
"edx.librarycontentblock.content.{}"
.
format
(
event_name
)
with
tracker
.
get_tracker
()
.
context
(
full_event_name
,
context
):
tracker
.
emit
(
full_event_name
,
event_data
)
LibraryContentModule
.
publish_selected_children_events
(
block_keys
,
...
...
lms/djangoapps/courseware/module_render.py
View file @
1a5e15fd
...
...
@@ -24,6 +24,7 @@ from opaque_keys import InvalidKeyError
from
opaque_keys.edx.keys
import
UsageKey
,
CourseKey
from
opaque_keys.edx.locations
import
SlashSeparatedCourseKey
from
requests.auth
import
HTTPBasicAuth
from
track
import
contexts
from
xblock.core
import
XBlock
from
xblock.django.request
import
django_to_webob_request
,
webob_to_django_response
from
xblock.exceptions
import
NoSuchHandlerError
,
NoSuchViewError
...
...
@@ -475,13 +476,16 @@ def get_module_system_for_user(user, student_data, # TODO # pylint: disable=to
only_if_higher
=
event
.
get
(
'only_if_higher'
),
)
else
:
aside_context
=
{}
context
=
contexts
.
course_context_from_course_id
(
course_id
)
if
block
.
runtime
.
user_id
:
context
[
'user_id'
]
=
block
.
runtime
.
user_id
context
[
'asides'
]
=
{}
for
aside
in
block
.
runtime
.
get_asides
(
block
):
if
hasattr
(
aside
,
'get_event_context'
):
aside_event_info
=
aside
.
get_event_context
(
event_type
,
event
)
if
aside_event_info
is
not
None
:
aside_context
[
aside
.
scope_ids
.
block_type
]
=
aside_event_info
with
tracker
.
get_tracker
()
.
context
(
'asides'
,
{
'asides'
:
aside_context
}
):
context
[
'asides'
]
[
aside
.
scope_ids
.
block_type
]
=
aside_event_info
with
tracker
.
get_tracker
()
.
context
(
event_type
,
context
):
track_function
(
event_type
,
event
)
def
rebind_noauth_module_to_user
(
module
,
real_user
):
...
...
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