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
a49da5d5
Commit
a49da5d5
authored
Aug 15, 2013
by
Vik Paruchuri
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix rubrics, strip out get results
parent
b6a58085
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
29 additions
and
124 deletions
+29
-124
common/lib/xmodule/xmodule/js/src/combinedopenended/display.coffee
+21
-75
common/lib/xmodule/xmodule/open_ended_grading_classes/combined_open_ended_modulev1.py
+8
-49
No files found.
common/lib/xmodule/xmodule/js/src/combinedopenended/display.coffee
View file @
a49da5d5
...
...
@@ -15,7 +15,6 @@ class @Rubric
# display the 'current' carat
@
categories
=
@
$
(
@
rubric_category_sel
)
@
category
=
@
$
(
@
categories
.
first
())
@
category
.
prepend
(
'> '
)
@
category_index
=
0
# locally scoped jquery.
...
...
@@ -46,12 +45,8 @@ class @Rubric
return
inputs
.
filter
(
"input[value=
#{
selected
}
]"
).
click
()
# move to the next category
old_category_text
=
@
category
.
html
().
substring
(
5
)
@
category
.
html
(
old_category_text
)
@
category_index
++
@
category
=
@
$
(
@
categories
[
@
category_index
])
@
category
.
prepend
(
'> '
)
tracking_callback
:
(
event
)
=>
target_selection
=
$
(
event
.
target
).
val
()
...
...
@@ -98,7 +93,6 @@ class @CombinedOpenEnded
coe_sel
:
'section.combined-open-ended'
reset_button_sel
:
'.reset-button'
next_step_sel
:
'.next-step-button'
status_container_sel
:
'.status-elements'
show_results_sel
:
'.show-results-button'
question_header_sel
:
'.question-header'
submit_evaluation_sel
:
'.submit-evaluation-button'
...
...
@@ -137,15 +131,18 @@ class @CombinedOpenEnded
$
:
(
selector
)
->
$
(
selector
,
@
el
)
reinitialize
:
(
element
)
->
reinitialize
:
()
->
@
has_been_reset
=
false
@
wrapper
=
@
$
(
@
wrapper_sel
)
@
coe
=
@
$
(
@
coe_sel
)
@
ajax_url
=
@
coe
.
data
(
'ajax-url'
)
@
get_html
()
@
coe
=
@
$
(
@
coe_sel
)
#Get data from combinedopenended
@
allow_reset
=
@
coe
.
data
(
'allow_reset'
)
@
id
=
@
coe
.
data
(
'id'
)
@
ajax_url
=
@
coe
.
data
(
'ajax-url'
)
@
state
=
@
coe
.
data
(
'state'
)
@
task_count
=
@
coe
.
data
(
'task-count'
)
@
task_number
=
@
coe
.
data
(
'task-number'
)
...
...
@@ -163,8 +160,6 @@ class @CombinedOpenEnded
@
next_problem_button
=
@
$
(
@
next_step_sel
)
@
next_problem_button
.
click
@
next_problem
@
status_container
=
@
$
(
@
status_container_sel
)
#setup show results
@
show_results_button
=
@
$
(
@
show_results_sel
)
@
show_results_button
.
click
@
show_results
...
...
@@ -183,6 +178,7 @@ class @CombinedOpenEnded
# Where to put the rubric once we load it
@
oe
=
@
$
(
@
open_ended_child_sel
)
@
errors_area
=
@
$
(
@
oe
).
find
(
@
error_sel
)
@
answer_area
=
@
$
(
@
oe
).
find
(
@
answer_area_sel
)
@
prompt_container
=
@
$
(
@
oe
).
find
(
@
prompt_sel
)
...
...
@@ -212,33 +208,18 @@ class @CombinedOpenEnded
@
rebind
()
show_results_current
:
()
=>
data
=
{
'task_number'
:
@
task_number
-
1
}
$
.
postWithPrefix
"
#{
@
ajax_url
}
/get_results"
,
data
,
(
response
)
=>
if
response
.
success
if
(
results_container
?
)
@
results_container
.
after
(
response
.
html
).
remove
()
@
results_container
=
@
$
(
@
result_container_sel
)
@
submit_evaluation_button
=
@
$
(
@
submit_evaluation_sel
)
@
submit_evaluation_button
.
click
@
message_post
Collapsible
.
setCollapsibles
(
@
results_container
)
# make sure we still have click tracking
$
(
'.evaluation-response a'
).
click
@
log_feedback_click
$
(
'input[name="evaluation-score"]'
).
change
@
log_feedback_selection
show_results
:
(
event
)
=>
status_item
=
$
(
event
.
target
).
parent
()
status_number
=
status_item
.
data
(
'status-number'
)
data
=
{
'task_number'
:
status_number
}
$
.
postWithPrefix
"
#{
@
ajax_url
}
/get_results"
,
data
,
(
response
)
=>
if
response
.
success
@
results_container
.
after
(
response
.
html
).
remove
()
@
results_container
=
@
$
(
@
result_container_sel
)
@
submit_evaluation_button
=
@
$
(
@
submit_evaluation_sel
)
@
submit_evaluation_button
.
click
@
message_post
Collapsible
.
setCollapsibles
(
@
results_container
)
else
@
gentle_alert
response
.
error
get_html_callback
:
(
response
)
=>
@
coe
.
replaceWith
(
response
.
html
)
get_html
:
()
=>
url
=
"
#{
@
ajax_url
}
/get_html"
$
.
ajaxWithPrefix
({
type
:
'POST'
,
url
:
url
,
data
:
{},
success
:
@
get_html_callback
,
async
:
false
});
show_combined_rubric_current
:
()
=>
data
=
{}
...
...
@@ -255,36 +236,6 @@ class @CombinedOpenEnded
if
response
.
hide_reset
@
reset_button
.
hide
()
get_last_response
:
()
=>
@
submit_button
.
hide
()
@
answer_area
.
attr
(
"disabled"
,
true
)
data
=
{}
$
.
postWithPrefix
"
#{
@
ajax_url
}
/get_last_response"
,
data
,
(
response
)
=>
if
response
.
success
&&
response
.
response
!=
""
@
answer_area
.
html
(
response
.
response
)
if
response
.
state
!=
'initial'
@
submit_button
.
hide
()
@
answer_area
.
attr
(
"disabled"
,
true
)
if
@
has_been_reset
@
submit_button
.
show
()
@
answer_area
.
attr
(
"disabled"
,
false
)
@
gentle_alert
"Here is your previous answer to this qu
estion."
else
if
@
allow_reset
==
"True"
@
reset_button
.
show
()
@
gentle_alert
"You may reset and answer this question again."
else
@
submit_button
.
show
()
@
answer_area
.
attr
(
"disabled"
,
false
)
@
$
(
@
oe_alert_sel
).
animate
(
opacity
:
0
,
700
)
show_status_current
:
()
=>
data
=
{}
$
.
postWithPrefix
"
#{
@
ajax_url
}
/get_status"
,
data
,
(
response
)
=>
if
response
.
success
@
status_container
.
after
(
response
.
html
).
remove
()
@
status_container
=
$
(
@
status_container_sel
)
message_post
:
(
event
)
=>
external_grader_message
=
$
(
event
.
target
).
parent
().
parent
().
parent
()
evaluation_scoring
=
$
(
event
.
target
).
parent
()
...
...
@@ -319,7 +270,6 @@ class @CombinedOpenEnded
rebind
:
()
=>
@
get_last_response
()
# rebind to the appropriate function for the current state
@
submit_button
.
unbind
(
'click'
)
@
submit_button
.
show
()
...
...
@@ -328,9 +278,6 @@ class @CombinedOpenEnded
@
next_problem_button
.
hide
()
@
hint_area
.
attr
(
'disabled'
,
false
)
if
@
task_number
>
1
or
@
child_state
!=
'initial'
@
show_status_current
()
if
@
task_number
==
1
and
@
child_state
==
'assessing'
@
prompt_hide
()
if
@
child_state
==
'done'
...
...
@@ -338,7 +285,7 @@ class @CombinedOpenEnded
if
@
child_type
==
"openended"
@
skip_button
.
hide
()
if
@
allow_reset
==
"True"
@
show_
results_current
@
show_
combined_rubric_current
()
@
reset_button
.
show
()
@
submit_button
.
hide
()
@
answer_area
.
attr
(
"disabled"
,
true
)
...
...
@@ -375,7 +322,6 @@ class @CombinedOpenEnded
@
submit_button
.
click
@
message_post
else
if
@
child_state
==
'done'
@
show_combined_rubric_current
()
@
show_results_current
()
@
rubric_wrapper
.
hide
()
@
answer_area
.
attr
(
"disabled"
,
true
)
@
replace_text_inputs
()
...
...
@@ -539,7 +485,7 @@ class @CombinedOpenEnded
@
gentle_alert
"Moved to next step."
else
@
gentle_alert
"Your score did not meet the criteria to move to the next step."
@
show_
results
_current
()
@
show_
combined_rubric
_current
()
else
@
errors_area
.
html
(
response
.
error
)
else
...
...
@@ -591,7 +537,7 @@ class @CombinedOpenEnded
# wrap this so that it can be mocked
reload
:
->
location
.
reload
()
@
reinitialize
()
collapse_question
:
(
event
)
=>
@
prompt_container
.
slideToggle
()
...
...
common/lib/xmodule/xmodule/open_ended_grading_classes/combined_open_ended_modulev1.py
View file @
a49da5d5
...
...
@@ -67,7 +67,6 @@ class CombinedOpenEndedV1Module():
ajax actions implemented by combined open ended module are:
'reset' -- resets the whole combined open ended module and returns to the first child moduleresource_string
'next_problem' -- moves to the next child module
'get_results' -- gets results from a given child module
Types of children. Task is synonymous with child module, so each combined open ended module
incorporates multiple children (tasks):
...
...
@@ -351,6 +350,9 @@ class CombinedOpenEndedV1Module():
self
.
update_task_states
()
return
self
.
current_task
.
get_html
(
self
.
system
)
def
get_html_ajax
(
self
,
data
):
return
{
'html'
:
self
.
get_html
()}
def
get_current_attributes
(
self
,
task_number
):
"""
Gets the min and max score to attempt attributes of the specified task.
...
...
@@ -592,53 +594,6 @@ class CombinedOpenEndedV1Module():
html
=
self
.
system
.
render_template
(
'{0}/combined_open_ended_legend.html'
.
format
(
self
.
TEMPLATE_DIR
),
context
)
return
{
'html'
:
html
,
'success'
:
True
}
def
get_results
(
self
,
_data
):
"""
Gets the results of a given grader via ajax.
Input: AJAX data dictionary
Output: Dictionary to be rendered via ajax that contains the result html.
"""
self
.
update_task_states
()
success
,
can_see_rubric
,
error
=
self
.
check_if_student_has_done_needed_grading
()
if
not
can_see_rubric
:
return
{
'html'
:
error
,
'success'
:
False
}
loop_up_to_task
=
self
.
current_task_number
+
1
all_responses
=
[]
for
i
in
xrange
(
0
,
loop_up_to_task
):
all_responses
.
append
(
self
.
get_last_response
(
i
))
context_list
=
[]
for
ri
in
all_responses
:
for
i
in
xrange
(
0
,
len
(
ri
[
'rubric_scores'
])):
feedback
=
ri
[
'feedback_dicts'
][
i
]
.
get
(
'feedback'
,
''
)
rubric_data
=
self
.
rubric_renderer
.
render_rubric
(
stringify_children
(
self
.
static_data
[
'rubric'
]),
ri
[
'rubric_scores'
][
i
])
if
rubric_data
[
'success'
]:
rubric_html
=
rubric_data
[
'html'
]
else
:
rubric_html
=
''
context
=
{
'rubric_html'
:
rubric_html
,
'grader_type'
:
ri
[
'grader_type'
],
'feedback'
:
feedback
,
'grader_id'
:
ri
[
'grader_ids'
][
i
],
'submission_id'
:
ri
[
'submission_ids'
][
i
],
}
context_list
.
append
(
context
)
feedback_table
=
self
.
system
.
render_template
(
'{0}/open_ended_result_table.html'
.
format
(
self
.
TEMPLATE_DIR
),
{
'context_list'
:
context_list
,
'grader_type_image_dict'
:
GRADER_TYPE_IMAGE_DICT
,
'human_grader_types'
:
HUMAN_GRADER_TYPE
,
'rows'
:
50
,
'cols'
:
50
,
})
context
=
{
'results'
:
feedback_table
,
'task_name'
:
"Feedback"
,
'class_name'
:
"result-container"
,
}
html
=
self
.
system
.
render_template
(
'{0}/combined_open_ended_results.html'
.
format
(
self
.
TEMPLATE_DIR
),
context
)
return
{
'html'
:
html
,
'success'
:
True
}
def
get_status_ajax
(
self
,
_data
):
"""
Gets the results of a given grader via ajax.
...
...
@@ -662,11 +617,12 @@ class CombinedOpenEndedV1Module():
handlers
=
{
'next_problem'
:
self
.
next_problem
,
'reset'
:
self
.
reset
,
'get_results'
:
self
.
get_results
,
'get_combined_rubric'
:
self
.
get_rubric
,
'get_status'
:
self
.
get_status_ajax
,
'get_legend'
:
self
.
get_legend
,
'get_last_response'
:
self
.
get_last_response_ajax
,
'get_current_state'
:
self
.
get_current_state
,
'get_html'
:
self
.
get_html_ajax
,
}
if
dispatch
not
in
handlers
:
...
...
@@ -676,6 +632,9 @@ class CombinedOpenEndedV1Module():
d
=
handlers
[
dispatch
](
data
)
return
json
.
dumps
(
d
,
cls
=
ComplexEncoder
)
def
get_current_state
(
self
,
data
):
return
self
.
get_context
()
def
get_last_response_ajax
(
self
,
data
):
return
self
.
get_last_response
(
self
.
current_task_number
)
...
...
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