Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
E
edx-analytics-data-api
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-data-api
Commits
54a80164
Commit
54a80164
authored
Mar 17, 2017
by
Dmitry Viskov
Committed by
Tyler Hallada
Mar 17, 2017
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Support multi-leaf tagging (#160)
parent
c44f8f51
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
12 additions
and
6 deletions
+12
-6
analytics_data_api/v0/tests/views/test_courses.py
+6
-3
analytics_data_api/v0/views/courses.py
+6
-3
No files found.
analytics_data_api/v0/tests/views/test_courses.py
View file @
54a80164
...
...
@@ -668,6 +668,9 @@ class CourseProblemsAndTagsListViewTests(TestCaseWithAuthentication):
tag_name
=
'difficulty'
,
tag_value
=
tags
[
'difficulty'
][
0
],
total_submissions
=
11
,
correct_submissions
=
4
,
created
=
created
)
G
(
models
.
ProblemsAndTags
,
course_id
=
course_id
,
module_id
=
module_id
,
tag_name
=
'difficulty'
,
tag_value
=
tags
[
'difficulty'
][
1
],
total_submissions
=
11
,
correct_submissions
=
4
,
created
=
created
)
G
(
models
.
ProblemsAndTags
,
course_id
=
course_id
,
module_id
=
module_id
,
tag_name
=
'learning_outcome'
,
tag_value
=
tags
[
'learning_outcome'
][
1
],
total_submissions
=
11
,
correct_submissions
=
4
,
created
=
alt_created
)
G
(
models
.
ProblemsAndTags
,
course_id
=
course_id
,
module_id
=
alt_module_id
,
...
...
@@ -680,8 +683,8 @@ class CourseProblemsAndTagsListViewTests(TestCaseWithAuthentication):
'total_submissions'
:
11
,
'correct_submissions'
:
4
,
'tags'
:
{
u'difficulty'
:
u'Easy'
,
u'learning_outcome'
:
u'Learned a few things'
,
u'difficulty'
:
[
u'Easy'
,
u'Medium'
]
,
u'learning_outcome'
:
[
u'Learned a few things'
]
,
},
'created'
:
alt_created
.
strftime
(
settings
.
DATETIME_FORMAT
)
},
...
...
@@ -690,7 +693,7 @@ class CourseProblemsAndTagsListViewTests(TestCaseWithAuthentication):
'total_submissions'
:
4
,
'correct_submissions'
:
0
,
'tags'
:
{
u'learning_outcome'
:
u'Learned everything'
,
u'learning_outcome'
:
[
u'Learned everything'
]
,
},
'created'
:
created
.
strftime
(
settings
.
DATETIME_FORMAT
)
}
...
...
analytics_data_api/v0/views/courses.py
View file @
54a80164
...
...
@@ -714,7 +714,7 @@ class ProblemsAndTagsListView(BaseCourseView):
* module_id: The ID of the problem.
* total_submissions: Total number of submissions.
* correct_submissions: Total number of *correct* submissions.
* tags: Dictionary that contains pairs "tag key:
tag value
".
* tags: Dictionary that contains pairs "tag key:
[tag value 1, tag value 2, ..., tag value N]
".
"""
serializer_class
=
serializers
.
ProblemsAndTagsSerializer
allow_empty
=
False
...
...
@@ -729,7 +729,10 @@ class ProblemsAndTagsListView(BaseCourseView):
for
v
in
items
:
if
v
.
module_id
in
result
:
result
[
v
.
module_id
][
'tags'
][
v
.
tag_name
]
=
v
.
tag_value
if
v
.
tag_name
not
in
result
[
v
.
module_id
][
'tags'
]:
result
[
v
.
module_id
][
'tags'
][
v
.
tag_name
]
=
[]
result
[
v
.
module_id
][
'tags'
][
v
.
tag_name
]
.
append
(
v
.
tag_value
)
result
[
v
.
module_id
][
'tags'
][
v
.
tag_name
]
.
sort
()
if
result
[
v
.
module_id
][
'created'
]
<
v
.
created
:
result
[
v
.
module_id
][
'created'
]
=
v
.
created
else
:
...
...
@@ -738,7 +741,7 @@ class ProblemsAndTagsListView(BaseCourseView):
'total_submissions'
:
v
.
total_submissions
,
'correct_submissions'
:
v
.
correct_submissions
,
'tags'
:
{
v
.
tag_name
:
v
.
tag_value
v
.
tag_name
:
[
v
.
tag_value
]
},
'created'
:
v
.
created
}
...
...
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