Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
P
problem-builder
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
OpenEdx
problem-builder
Commits
e0f62ff8
Commit
e0f62ff8
authored
Jul 07, 2015
by
Tim Krones
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Allow instructors to filter answers by content.
parent
3e4edf40
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
26 additions
and
5 deletions
+26
-5
problem_builder/public/js/student_answers_dashboard.js
+3
-1
problem_builder/student_answers_dashboard.py
+3
-1
problem_builder/tasks.py
+9
-3
problem_builder/templates/html/student_answers_dashboard.html
+11
-0
No files found.
problem_builder/public/js/student_answers_dashboard.js
View file @
e0f62ff8
...
...
@@ -13,6 +13,7 @@ function StudentAnswersDashboardBlock(runtime, element) {
var
$blockTypes
=
$element
.
find
(
"select[name='block_types']"
);
var
$rootBlockId
=
$element
.
find
(
"input[name='root_block_id']"
);
var
$username
=
$element
.
find
(
"input[name='username']"
);
var
$matchString
=
$element
.
find
(
"input[name='match_string']"
);
var
$resultTable
=
$element
.
find
(
'.data-export-results'
);
var
status
;
...
...
@@ -139,7 +140,8 @@ function StudentAnswersDashboardBlock(runtime, element) {
data
=
{
block_types
:
$blockTypes
.
val
(),
root_block_id
:
$rootBlockId
.
val
(),
username
:
$username
.
val
()
username
:
$username
.
val
(),
match_string
:
$matchString
.
val
()
};
data
=
JSON
.
stringify
(
data
);
}
else
{
...
...
problem_builder/student_answers_dashboard.py
View file @
e0f62ff8
...
...
@@ -163,6 +163,7 @@ class StudentAnswersDashboardBlock(XBlock):
block_types
=
data
.
get
(
'block_types'
,
None
)
username
=
data
.
get
(
'username'
,
None
)
root_block_id
=
data
.
get
(
'root_block_id'
,
None
)
match_string
=
data
.
get
(
'match_string'
,
None
)
if
not
root_block_id
:
root_block_id
=
self
.
scope_ids
.
usage_id
# Block ID not in workbench runtime.
...
...
@@ -190,7 +191,8 @@ class StudentAnswersDashboardBlock(XBlock):
root_block_id
,
block_types
,
user_id
,
get_root
=
get_root
,
match_string
,
get_root
=
get_root
)
if
async_result
.
ready
():
# In development mode, the task may have executed synchronously.
...
...
problem_builder/tasks.py
View file @
e0f62ff8
...
...
@@ -21,7 +21,7 @@ logger = get_task_logger(__name__)
@task
()
def
export_data
(
course_id
,
source_block_id_str
,
block_types
,
user_id
,
get_root
=
True
):
def
export_data
(
course_id
,
source_block_id_str
,
block_types
,
user_id
,
match_string
,
get_root
=
True
):
"""
Exports student answers to all MCQ questions to a CSV file.
"""
...
...
@@ -93,7 +93,9 @@ def export_data(course_id, source_block_id_str, block_types, user_id, get_root=T
student_id
=
submission
.
get
(
'student_id'
,
user_id
)
# Extract data for display
row
=
_extract_data_for_display
(
submission
,
student_id
,
block_type
)
# "row" will be None if answer does not match "match_string"
row
=
_extract_data_for_display
(
submission
,
student_id
,
block_type
,
match_string
)
if
row
:
rows
.
append
(
row
)
# Generate the CSV:
...
...
@@ -113,7 +115,7 @@ def export_data(course_id, source_block_id_str, block_types, user_id, get_root=T
}
def
_extract_data_for_display
(
submission
,
student_id
,
block_type
):
def
_extract_data_for_display
(
submission
,
student_id
,
block_type
,
match_string
):
"""
Extract data that will be displayed on Student Answers Dashboard
from `submission`.
...
...
@@ -143,6 +145,10 @@ def _extract_data_for_display(submission, student_id, block_type):
answer
=
choice_block
.
content
break
# Short-circuit if answer does not match search criteria
if
not
match_string
.
lower
()
in
answer
.
lower
():
return
# Unit
mentoring_block
=
modulestore
()
.
get_item
(
block
.
parent
)
unit
=
modulestore
()
.
get_item
(
mentoring_block
.
parent
)
...
...
problem_builder/templates/html/student_answers_dashboard.html
View file @
e0f62ff8
...
...
@@ -41,6 +41,17 @@
{% trans "Input the username of a student if you wish to query for a specific one. Otherwise, it will grab all results for all students." %}
</div>
</div>
<div
class=
"data-export-field-container"
>
<div
class=
"data-export-field"
>
<label>
<span>
{% trans "Match answers containing:" %}
</span>
<input
type=
"text"
name=
"match_string"
/>
</label>
</div>
<div
class=
"data-export-helptext"
>
{% trans "Input text that all answers must match (case will be ignored). Otherwise, answers will not be filtered by content." %}
</div>
</div>
</div>
<div
class=
"data-export-actions"
>
<button
class=
"data-export-start"
>
{% trans "Start a new export" %}
</button>
...
...
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