Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
E
edx-analytics-dashboard
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-analytics-dashboard
Commits
07892189
Commit
07892189
authored
Sep 28, 2015
by
Dennis Jen
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Video structure returns modules of any graded status.
parent
0cdcf18c
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
24 additions
and
6 deletions
+24
-6
analytics_dashboard/courses/presenters/__init__.py
+6
-1
analytics_dashboard/courses/presenters/performance.py
+11
-0
common/course_structure.py
+7
-5
No files found.
analytics_dashboard/courses/presenters/__init__.py
View file @
07892189
...
@@ -90,6 +90,11 @@ class CourseAPIPresenterMixin(object):
...
@@ -90,6 +90,11 @@ class CourseAPIPresenterMixin(object):
""" Module type to retrieve structure for. E.g. video, problem. """
""" Module type to retrieve structure for. E.g. video, problem. """
pass
pass
@property
def
module_graded_type
(
self
):
""" Graded module type to review structure for. E.g. True, False, None. """
return
None
def
get_cache_key
(
self
,
name
):
def
get_cache_key
(
self
,
name
):
""" Returns sanitized key for caching. """
""" Returns sanitized key for caching. """
return
sanitize_cache_key
(
u'{}_{}'
.
format
(
self
.
course_id
,
name
))
return
sanitize_cache_key
(
u'{}_{}'
.
format
(
self
.
course_id
,
name
))
...
@@ -114,7 +119,7 @@ class CourseAPIPresenterMixin(object):
...
@@ -114,7 +119,7 @@ class CourseAPIPresenterMixin(object):
if
not
found_structure
:
if
not
found_structure
:
structure
=
self
.
_get_structure
()
structure
=
self
.
_get_structure
()
found_structure
=
CourseStructure
.
course_structure_to_sections
(
structure
,
self
.
module_type
,
found_structure
=
CourseStructure
.
course_structure_to_sections
(
structure
,
self
.
module_type
,
graded
=
Fals
e
)
graded
=
self
.
module_graded_typ
e
)
cache
.
set
(
all_sections_key
,
found_structure
)
cache
.
set
(
all_sections_key
,
found_structure
)
for
section
in
found_structure
:
for
section
in
found_structure
:
...
...
analytics_dashboard/courses/presenters/performance.py
View file @
07892189
...
@@ -368,3 +368,14 @@ class CoursePerformancePresenter(CourseAPIPresenterMixin, BasePresenter):
...
@@ -368,3 +368,14 @@ class CoursePerformancePresenter(CourseAPIPresenterMixin, BasePresenter):
@property
@property
def
module_type
(
self
):
def
module_type
(
self
):
return
'problem'
return
'problem'
@property
def
module_graded_type
(
self
):
"""
Get ungraded blocks.
This is a bit confusing as this presenter is used to show both graded and
ungraded content. The ungraded content uses CourseAPIPresenterMixin::course_structure
which then gets the module grade type for filtering.
"""
return
False
common/course_structure.py
View file @
07892189
...
@@ -17,8 +17,6 @@ class CourseStructure(object):
...
@@ -17,8 +17,6 @@ class CourseStructure(object):
if
block_type
:
if
block_type
:
kwargs
[
u'type'
]
=
block_type
kwargs
[
u'type'
]
=
block_type
kwargs
.
setdefault
(
u'graded'
,
False
)
matched
=
True
matched
=
True
for
name
,
value
in
kwargs
.
iteritems
():
for
name
,
value
in
kwargs
.
iteritems
():
matched
&=
(
block
.
get
(
name
,
None
)
==
value
)
matched
&=
(
block
.
get
(
name
,
None
)
==
value
)
...
@@ -99,10 +97,14 @@ class CourseStructure(object):
...
@@ -99,10 +97,14 @@ class CourseStructure(object):
if
len
(
block_types
)
>
0
:
if
len
(
block_types
)
>
0
:
block_types
=
list
(
block_types
)
block_types
=
list
(
block_types
)
block_type
=
block_types
.
pop
(
0
)
block_type
=
block_types
.
pop
(
0
)
filter_kwargs
=
{
'block_type'
:
block_type
,
}
if
graded
is
not
None
:
filter_kwargs
[
'graded'
]
=
graded
structure_sections
=
CourseStructure
.
_filter_children
(
blocks
,
section_id
,
structure_sections
=
CourseStructure
.
_filter_children
(
blocks
,
section_id
,
graded
=
graded
,
require_format
=
False
,
block_type
=
block_type
,
**
filter_kwargs
)
require_format
=
False
)
for
section
in
structure_sections
:
for
section
in
structure_sections
:
children
=
CourseStructure
.
_build_sections
(
blocks
,
section
[
u'id'
],
graded
,
block_types
)
children
=
CourseStructure
.
_build_sections
(
blocks
,
section
[
u'id'
],
graded
,
block_types
)
...
...
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