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
7460c775
Commit
7460c775
authored
Aug 19, 2015
by
Tim Krones
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Allow instructors to search for answers from multiple users simultaneously.
parent
a9f7743d
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
21 additions
and
11 deletions
+21
-11
problem_builder/instructor_tool.py
+11
-6
problem_builder/public/js/instructor_tool.js
+2
-2
problem_builder/tasks.py
+6
-1
problem_builder/templates/html/instructor_tool.html
+2
-2
No files found.
problem_builder/instructor_tool.py
View file @
7460c775
...
@@ -282,7 +282,7 @@ class InstructorToolBlock(XBlock):
...
@@ -282,7 +282,7 @@ class InstructorToolBlock(XBlock):
def
start_export
(
self
,
data
,
suffix
=
''
):
def
start_export
(
self
,
data
,
suffix
=
''
):
""" Start a new asynchronous export """
""" Start a new asynchronous export """
block_types
=
data
.
get
(
'block_types'
,
None
)
block_types
=
data
.
get
(
'block_types'
,
None
)
username
=
data
.
get
(
'username
'
,
None
)
username
s
=
data
.
get
(
'usernames
'
,
None
)
root_block_id
=
data
.
get
(
'root_block_id'
,
None
)
root_block_id
=
data
.
get
(
'root_block_id'
,
None
)
match_string
=
data
.
get
(
'match_string'
,
None
)
match_string
=
data
.
get
(
'match_string'
,
None
)
...
@@ -295,12 +295,17 @@ class InstructorToolBlock(XBlock):
...
@@ -295,12 +295,17 @@ class InstructorToolBlock(XBlock):
user_service
=
self
.
runtime
.
service
(
self
,
'user'
)
user_service
=
self
.
runtime
.
service
(
self
,
'user'
)
if
not
self
.
user_is_staff
():
if
not
self
.
user_is_staff
():
return
{
'error'
:
'permission denied'
}
return
{
'error'
:
'permission denied'
}
if
not
username
:
if
not
username
s
:
user_id
=
None
user_id
s
=
None
else
:
else
:
user_ids
=
[]
for
username
in
usernames
.
split
(
','
):
username
=
username
.
strip
()
user_id
=
user_service
.
get_anonymous_user_id
(
username
,
unicode
(
self
.
runtime
.
course_id
))
user_id
=
user_service
.
get_anonymous_user_id
(
username
,
unicode
(
self
.
runtime
.
course_id
))
if
user_id
is
None
:
if
user_id
:
self
.
raise_error
(
404
,
_
(
"Could not find the specified username."
))
user_ids
.
append
(
user_id
)
if
not
user_ids
:
self
.
raise_error
(
404
,
_
(
"Could not find any of the specified usernames."
))
if
not
root_block_id
:
if
not
root_block_id
:
root_block_id
=
self
.
scope_ids
.
usage_id
root_block_id
=
self
.
scope_ids
.
usage_id
...
@@ -317,7 +322,7 @@ class InstructorToolBlock(XBlock):
...
@@ -317,7 +322,7 @@ class InstructorToolBlock(XBlock):
unicode
(
getattr
(
self
.
runtime
,
'course_id'
,
'course_id'
)),
unicode
(
getattr
(
self
.
runtime
,
'course_id'
,
'course_id'
)),
root_block_id
,
root_block_id
,
block_types
,
block_types
,
user_id
,
user_id
s
,
match_string
,
match_string
,
)
)
if
async_result
.
ready
():
if
async_result
.
ready
():
...
...
problem_builder/public/js/instructor_tool.js
View file @
7460c775
...
@@ -225,7 +225,7 @@ function InstructorToolBlock(runtime, element) {
...
@@ -225,7 +225,7 @@ function InstructorToolBlock(runtime, element) {
var
$deleteButton
=
$element
.
find
(
'.data-export-delete'
);
var
$deleteButton
=
$element
.
find
(
'.data-export-delete'
);
var
$blockTypes
=
$element
.
find
(
"select[name='block_types']"
);
var
$blockTypes
=
$element
.
find
(
"select[name='block_types']"
);
var
$rootBlockId
=
$element
.
find
(
"select[name='root_block_id']"
);
var
$rootBlockId
=
$element
.
find
(
"select[name='root_block_id']"
);
var
$username
=
$element
.
find
(
"input[name='username
']"
);
var
$username
s
=
$element
.
find
(
"input[name='usernames
']"
);
var
$matchString
=
$element
.
find
(
"input[name='match_string']"
);
var
$matchString
=
$element
.
find
(
"input[name='match_string']"
);
var
$resultTable
=
$element
.
find
(
'.data-export-results'
);
var
$resultTable
=
$element
.
find
(
'.data-export-results'
);
...
@@ -335,7 +335,7 @@ function InstructorToolBlock(runtime, element) {
...
@@ -335,7 +335,7 @@ function InstructorToolBlock(runtime, element) {
data
=
{
data
=
{
block_types
:
$blockTypes
.
val
(),
block_types
:
$blockTypes
.
val
(),
root_block_id
:
$rootBlockId
.
val
(),
root_block_id
:
$rootBlockId
.
val
(),
username
:
$username
.
val
(),
username
s
:
$usernames
.
val
(),
match_string
:
$matchString
.
val
()
match_string
:
$matchString
.
val
()
};
};
data
=
JSON
.
stringify
(
data
);
data
=
JSON
.
stringify
(
data
);
...
...
problem_builder/tasks.py
View file @
7460c775
...
@@ -20,7 +20,7 @@ logger = get_task_logger(__name__)
...
@@ -20,7 +20,7 @@ logger = get_task_logger(__name__)
@task
()
@task
()
def
export_data
(
course_id
,
source_block_id_str
,
block_types
,
user_id
,
match_string
):
def
export_data
(
course_id
,
source_block_id_str
,
block_types
,
user_id
s
,
match_string
):
"""
"""
Exports student answers to all MCQ questions to a CSV file.
Exports student answers to all MCQ questions to a CSV file.
"""
"""
...
@@ -64,6 +64,11 @@ def export_data(course_id, source_block_id_str, block_types, user_id, match_stri
...
@@ -64,6 +64,11 @@ def export_data(course_id, source_block_id_str, block_types, user_id, match_stri
# Collect results for each block in blocks_to_include
# Collect results for each block in blocks_to_include
for
block
in
blocks_to_include
:
for
block
in
blocks_to_include
:
if
not
user_ids
:
results
=
_extract_data
(
course_key_str
,
block
,
None
,
match_string
)
rows
+=
results
else
:
for
user_id
in
user_ids
:
results
=
_extract_data
(
course_key_str
,
block
,
user_id
,
match_string
)
results
=
_extract_data
(
course_key_str
,
block
,
user_id
,
match_string
)
rows
+=
results
rows
+=
results
...
...
problem_builder/templates/html/instructor_tool.html
View file @
7460c775
...
@@ -9,8 +9,8 @@
...
@@ -9,8 +9,8 @@
<div
class=
"data-export-field-container"
>
<div
class=
"data-export-field-container"
>
<div
class=
"data-export-field"
>
<div
class=
"data-export-field"
>
<label>
<label>
<span>
{% trans "Username:" %}
</span>
<span>
{% trans "Username
[s]
:" %}
</span>
<input
type=
"text"
name=
"username"
/>
<input
type=
"text"
name=
"username
s"
title=
"Enter one or more usernames, comma separated.
"
/>
</label>
</label>
</div>
</div>
</div>
</div>
...
...
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