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
92b7dbdc
Commit
92b7dbdc
authored
Feb 01, 2013
by
Diana Huang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Refactor rubric JS so that we don't have to keep duplicating this code.
parent
1fde3c5e
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
36 additions
and
35 deletions
+36
-35
common/lib/xmodule/xmodule/js/src/combinedopenended/display.coffee
+29
-0
lms/static/coffee/src/peer_grading/peer_grading_problem.coffee
+2
-9
lms/static/coffee/src/staff_grading/staff_grading.coffee
+5
-26
No files found.
common/lib/xmodule/xmodule/js/src/combinedopenended/display.coffee
View file @
92b7dbdc
class
@
Rubric
constructor
:
()
->
# finds the scores for each rubric category
@
get_score_list
:
()
=>
# find the number of categories:
num_categories
=
$
(
'table.rubric tr'
).
length
score_lst
=
[]
# get the score for each one
for
i
in
[
0
..(
num_categories
-
2
)]
score
=
$
(
"input[name='score-selection-
#{
i
}
']:checked"
).
val
()
score_lst
.
push
(
score
)
return
score_lst
@
get_total_score
:
()
->
score_lst
=
@
get_score_list
()
@
check_complete
:
()
->
# check to see whether or not any categories have not been scored
num_categories
=
$
(
'table.rubric tr'
).
length
# -2 because we want to skip the header
for
i
in
[
0
..(
num_categories
-
2
)]
score
=
$
(
"input[name='score-selection-
#{
i
}
']:checked"
).
val
()
if
score
==
undefined
return
false
return
true
class
@
CombinedOpenEnded
class
@
CombinedOpenEnded
constructor
:
(
element
)
->
constructor
:
(
element
)
->
@
element
=
element
@
element
=
element
...
...
lms/static/coffee/src/peer_grading/peer_grading_problem.coffee
View file @
92b7dbdc
...
@@ -239,7 +239,7 @@ class PeerGradingProblem
...
@@ -239,7 +239,7 @@ class PeerGradingProblem
score_lst
=
[]
score_lst
=
[]
# get the score for each one
# get the score for each one
for
i
in
[
0
..(
num_categories
-
1
)]
for
i
in
[
0
..(
num_categories
-
2
)]
score
=
$
(
"input[name='score-selection-
#{
i
}
']:checked"
).
val
()
score
=
$
(
"input[name='score-selection-
#{
i
}
']:checked"
).
val
()
score_lst
.
push
(
score
)
score_lst
.
push
(
score
)
...
@@ -315,15 +315,8 @@ class PeerGradingProblem
...
@@ -315,15 +315,8 @@ class PeerGradingProblem
# called after a grade is selected on the interface
# called after a grade is selected on the interface
graded_callback
:
(
event
)
=>
graded_callback
:
(
event
)
=>
@
grade
=
$
(
"input[name='grade-selection']:checked"
).
val
()
if
@
grade
==
undefined
return
# check to see whether or not any categories have not been scored
# check to see whether or not any categories have not been scored
num_categories
=
$
(
'table.rubric tr'
).
length
if
Rubric
.
check_complete
()
:
for
i
in
[
0
..(
num_categories
-
1
)]
score
=
$
(
"input[name='score-selection-
#{
i
}
']:checked"
).
val
()
if
score
==
undefined
return
# show button if we have scores for all categories
# show button if we have scores for all categories
@
show_submit_button
()
@
show_submit_button
()
...
...
lms/static/coffee/src/staff_grading/staff_grading.coffee
View file @
92b7dbdc
...
@@ -232,35 +232,14 @@ class @StaffGrading
...
@@ -232,35 +232,14 @@ class @StaffGrading
graded_callback
:
()
=>
graded_callback
:
()
=>
@
grade
=
$
(
"input[name='grade-selection']:checked"
).
val
()
if
@
grade
==
undefined
return
# check to see whether or not any categories have not been scored
num_categories
=
$
(
'table.rubric tr'
).
length
for
i
in
[
0
..(
num_categories
-
1
)]
score
=
$
(
"input[name='score-selection-
#{
i
}
']:checked"
).
val
()
if
score
==
undefined
return
# show button if we have scores for all categories
# show button if we have scores for all categories
if
Rubric
.
check_complete
()
@
state
=
state_graded
@
state
=
state_graded
@
submit_button
.
show
()
@
submit_button
.
show
()
set_button_text
:
(
text
)
=>
set_button_text
:
(
text
)
=>
@
action_button
.
attr
(
'value'
,
text
)
@
action_button
.
attr
(
'value'
,
text
)
# finds the scores for each rubric category
get_score_list
:
()
=>
# find the number of categories:
num_categories
=
$
(
'table.rubric tr'
).
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_lst
.
push
(
score
)
return
score_lst
ajax_callback
:
(
response
)
=>
ajax_callback
:
(
response
)
=>
# always clear out errors and messages on transition.
# always clear out errors and messages on transition.
@
error_msg
=
''
@
error_msg
=
''
...
@@ -285,8 +264,8 @@ class @StaffGrading
...
@@ -285,8 +264,8 @@ class @StaffGrading
skip_and_get_next
:
()
=>
skip_and_get_next
:
()
=>
data
=
data
=
score
:
@
grade
score
:
Rubric
.
get_total_score
()
rubric_scores
:
@
get_score_list
()
rubric_scores
:
Rubric
.
get_score_list
()
feedback
:
@
feedback_area
.
val
()
feedback
:
@
feedback_area
.
val
()
submission_id
:
@
submission_id
submission_id
:
@
submission_id
location
:
@
location
location
:
@
location
...
@@ -299,8 +278,8 @@ class @StaffGrading
...
@@ -299,8 +278,8 @@ class @StaffGrading
submit_and_get_next
:
()
->
submit_and_get_next
:
()
->
data
=
data
=
score
:
@
grade
score
:
Rubric
.
get_total_score
()
rubric_scores
:
@
get_score_list
()
rubric_scores
:
Rubric
.
get_score_list
()
feedback
:
@
feedback_area
.
val
()
feedback
:
@
feedback_area
.
val
()
submission_id
:
@
submission_id
submission_id
:
@
submission_id
location
:
@
location
location
:
@
location
...
...
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