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
f59045c3
Commit
f59045c3
authored
Aug 08, 2013
by
Vik Paruchuri
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Scope rubrics locally, make them into classes
parent
803b7eb2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
40 additions
and
29 deletions
+40
-29
common/lib/xmodule/xmodule/js/src/combinedopenended/display.coffee
+34
-24
common/lib/xmodule/xmodule/js/src/peergrading/peer_grading_problem.coffee
+6
-5
No files found.
common/lib/xmodule/xmodule/js/src/combinedopenended/display.coffee
View file @
f59045c3
class
@
Rubric
constructor
:
()
->
@
initialize
:
(
location
,
el
)
->
rubric_category_sel
:
'.rubric-category'
rubric_sel
:
'.rubric'
constructor
:
(
el
)
->
@
el
=
el
$
(
'.rubric'
,
@
el
).
data
(
"location"
,
location
)
$
(
'input[class="score-selection"]'
,
@
el
).
change
@
tracking_callback
initialize
:
(
location
)
->
@
$
(
@
rubric_sel
).
data
(
"location"
,
location
)
@
$
(
'input[class="score-selection"]'
).
change
@
tracking_callback
# set up the hotkeys
$
(
window
).
unbind
(
'keydown'
,
@
keypress_callback
)
$
(
window
).
keydown
@
keypress_callback
# display the 'current' carat
@
categories
=
$
(
'.rubric-category'
,
el
)
@
category
=
$
(
@
categories
.
first
(),
el
)
@
categories
=
@
$
(
@
rubric_category_s
el
)
@
category
=
@
$
(
@
categories
.
first
()
)
@
category
.
prepend
(
'> '
)
@
category_index
=
0
@
keypress_callback
:
(
event
)
=>
# locally scoped jquery.
$
:
(
selector
)
->
$
(
selector
,
@
el
)
keypress_callback
:
(
event
)
=>
# don't try to do this when user is typing in a text input
if
$
(
event
.
target
).
is
(
'input, textarea'
)
return
...
...
@@ -31,7 +39,7 @@ class @Rubric
# if we actually have a current category (not past the end)
if
(
@
category_index
<=
@
categories
.
length
)
# find the valid selections for this category
inputs
=
$
(
"input[name='score-selection-
#{
@
category_index
}
']"
)
inputs
=
@
$
(
"input[name='score-selection-
#{
@
category_index
}
']"
)
max_score
=
inputs
.
length
-
1
if
selected
>
max_score
or
selected
<
0
...
...
@@ -42,44 +50,44 @@ class @Rubric
old_category_text
=
@
category
.
html
().
substring
(
5
)
@
category
.
html
(
old_category_text
)
@
category_index
++
@
category
=
$
(
@
categories
[
@
category_index
],
@
el
)
@
category
=
@
$
(
@
categories
[
@
category_index
]
)
@
category
.
prepend
(
'> '
)
@
tracking_callback
:
(
event
)
->
tracking_callback
:
(
event
)
->
target_selection
=
$
(
event
.
target
).
val
()
# chop off the beginning of the name so that we can get the number of the category
category
=
$
(
event
.
target
).
data
(
"category"
)
location
=
$
(
'.rubric'
,
@
el
).
data
(
'location'
)
location
=
@
$
(
@
rubric_s
el
).
data
(
'location'
)
# probably want the original problem location as well
data
=
{
location
:
location
,
selection
:
target_selection
,
category
:
category
}
Logger
.
log
'rubric_select'
,
data
# finds the scores for each rubric category
@
get_score_list
:
()
=>
get_score_list
:
()
=>
# find the number of categories:
num_categories
=
$
(
'.rubric-category'
,
@
el
).
length
num_categories
=
@
$
(
@
rubric_category_s
el
).
length
score_lst
=
[]
# get the score for each one
for
i
in
[
0
..(
num_categories
-
1
)]
score
=
$
(
"input[name='score-selection-
#{
i
}
']:checked"
).
val
()
score
=
@
$
(
"input[name='score-selection-
#{
i
}
']:checked"
).
val
()
score_lst
.
push
(
score
)
return
score_lst
@
get_total_score
:
()
->
get_total_score
:
()
->
score_lst
=
@
get_score_list
()
tot
=
0
for
score
in
score_lst
tot
+=
parseInt
(
score
)
return
tot
@
check_complete
:
()
->
check_complete
:
()
->
# check to see whether or not any categories have not been scored
num_categories
=
$
(
'.rubric-category'
,
@
el
).
length
num_categories
=
@
$
(
@
rubric_category_s
el
).
length
for
i
in
[
0
..(
num_categories
-
1
)]
score
=
$
(
"input[name='score-selection-
#{
i
}
']:checked"
,
@
el
).
val
()
score
=
@
$
(
"input[name='score-selection-
#{
i
}
']:checked"
).
val
()
if
score
==
undefined
return
false
return
true
...
...
@@ -143,7 +151,8 @@ class @CombinedOpenEnded
@
location
=
@
coe
.
data
(
'location'
)
# set up handlers for click tracking
Rubric
.
initialize
(
@
location
,
@
coe
)
@
rub
=
new
Rubric
(
@
coe
)
@
rub
.
initialize
(
@
location
)
@
is_ctrl
=
false
#Setup reset
@
reset_button
=
@
$
(
@
reset_button_sel
)
...
...
@@ -390,7 +399,8 @@ class @CombinedOpenEnded
if
response
.
success
@
rubric_wrapper
.
html
(
response
.
rubric_html
)
@
rubric_wrapper
.
show
()
Rubric
.
initialize
(
@
location
,
@
coe
)
@
rub
=
new
Rubric
(
@
coe
)
@
rub
.
initialize
(
@
location
)
@
answer_area
.
html
(
response
.
student_response
)
@
child_state
=
'assessing'
@
find_assessment_elements
()
...
...
@@ -408,7 +418,7 @@ class @CombinedOpenEnded
#Previously, responses were submitted when hitting enter. Add in a modifier that ensures that ctrl+enter is needed.
if
event
.
which
==
17
&&
@
is_ctrl
==
false
@
is_ctrl
=
true
else
if
@
is_ctrl
==
true
&&
event
.
which
==
13
&&
@
child_state
==
'assessing'
&&
Rubric
.
check_complete
()
else
if
@
is_ctrl
==
true
&&
event
.
which
==
13
&&
@
child_state
==
'assessing'
&&
@
rub
.
check_complete
()
@
save_assessment
(
event
)
keyup_handler
:
(
event
)
=>
...
...
@@ -418,9 +428,9 @@ class @CombinedOpenEnded
save_assessment
:
(
event
)
=>
event
.
preventDefault
()
if
@
child_state
==
'assessing'
&&
Rubric
.
check_complete
()
checked_assessment
=
Rubric
.
get_total_score
()
score_list
=
Rubric
.
get_score_list
()
if
@
child_state
==
'assessing'
&&
@
rub
.
check_complete
()
checked_assessment
=
@
rub
.
get_total_score
()
score_list
=
@
rub
.
get_score_list
()
data
=
{
'assessment'
:
checked_assessment
,
'score_list'
:
score_list
}
$
.
postWithPrefix
"
#{
@
ajax_url
}
/save_assessment"
,
data
,
(
response
)
=>
if
response
.
success
...
...
common/lib/xmodule/xmodule/js/src/peergrading/peer_grading_problem.coffee
View file @
f59045c3
...
...
@@ -309,8 +309,8 @@ class @PeerGradingProblem
construct_data
:
()
->
data
=
rubric_scores
:
Rubric
.
get_score_list
()
score
:
Rubric
.
get_total_score
()
rubric_scores
:
@
rub
.
get_score_list
()
score
:
@
rub
.
get_total_score
()
location
:
@
location
submission_id
:
@
essay_id_input
.
val
()
submission_key
:
@
submission_key_input
.
val
()
...
...
@@ -398,11 +398,11 @@ class @PeerGradingProblem
# called after a grade is selected on the interface
graded_callback
:
(
event
)
=>
# check to see whether or not any categories have not been scored
if
Rubric
.
check_complete
()
if
@
rub
.
check_complete
()
# show button if we have scores for all categories
@
grading_message
.
hide
()
@
show_submit_button
()
@
grade
=
Rubric
.
get_total_score
()
@
grade
=
@
rub
.
get_total_score
()
keydown_handler
:
(
event
)
=>
#Previously, responses were submitted when hitting enter. Add in a modifier that ensures that ctrl+enter is needed.
...
...
@@ -507,7 +507,8 @@ class @PeerGradingProblem
@
submit_button
.
hide
()
@
action_button
.
hide
()
@
calibration_feedback_panel
.
hide
()
Rubric
.
initialize
(
@
location
,
@
el
)
@
rub
=
new
Rubric
(
@
el
)
@
rub
.
initialize
(
@
location
)
render_calibration_feedback
:
(
response
)
=>
...
...
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