Commit e39abe11 by Vik Paruchuri

Fix rubric with staff grading

parent e4bcfa5c
...@@ -6,7 +6,7 @@ class @Rubric ...@@ -6,7 +6,7 @@ class @Rubric
constructor: (el) -> constructor: (el) ->
@el = el @el = el
initialize: (location) -> initialize: (location) =>
@$(@rubric_sel).data("location", location) @$(@rubric_sel).data("location", location)
@$('input[class="score-selection"]').change @tracking_callback @$('input[class="score-selection"]').change @tracking_callback
# set up the hotkeys # set up the hotkeys
...@@ -53,7 +53,7 @@ class @Rubric ...@@ -53,7 +53,7 @@ class @Rubric
@category = @$(@categories[@category_index]) @category = @$(@categories[@category_index])
@category.prepend('> ') @category.prepend('> ')
tracking_callback: (event) -> tracking_callback: (event) =>
target_selection = $(event.target).val() target_selection = $(event.target).val()
# chop off the beginning of the name so that we can get the number of the category # chop off the beginning of the name so that we can get the number of the category
category = $(event.target).data("category") category = $(event.target).data("category")
...@@ -76,14 +76,14 @@ class @Rubric ...@@ -76,14 +76,14 @@ class @Rubric
return score_lst return score_lst
get_total_score: () -> get_total_score: () =>
score_lst = @get_score_list() score_lst = @get_score_list()
tot = 0 tot = 0
for score in score_lst for score in score_lst
tot += parseInt(score) tot += parseInt(score)
return tot return tot
check_complete: () -> check_complete: () =>
# 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 = @$(@rubric_category_sel).length num_categories = @$(@rubric_category_sel).length
for i in [0..(num_categories-1)] for i in [0..(num_categories-1)]
......
...@@ -223,12 +223,12 @@ class @StaffGrading ...@@ -223,12 +223,12 @@ class @StaffGrading
setup_score_selection: => setup_score_selection: =>
@score_selection_container.html(@rubric) @score_selection_container.html(@rubric)
$('input[class="score-selection"]').change => @graded_callback() $('input[class="score-selection"]').change => @graded_callback()
Rubric.initialize(@location, @el) @rub = new Rubric(@el)
@rub.initialize(@location)
graded_callback: () => graded_callback: () =>
# show button if we have scores for all categories # show button if we have scores for all categories
if Rubric.check_complete() if @rub.check_complete()
@state = state_graded @state = state_graded
@submit_button.show() @submit_button.show()
...@@ -236,7 +236,7 @@ class @StaffGrading ...@@ -236,7 +236,7 @@ class @StaffGrading
#Previously, responses were submitted when hitting enter. Add in a modifier that ensures that ctrl+enter is needed. #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 if event.which == 17 && @is_ctrl==false
@is_ctrl=true @is_ctrl=true
else if @is_ctrl==true && event.which == 13 && !@list_view && Rubric.check_complete() else if @is_ctrl==true && event.which == 13 && !@list_view && @rub.check_complete()
@submit_and_get_next() @submit_and_get_next()
keyup_handler: (event) => keyup_handler: (event) =>
...@@ -271,8 +271,8 @@ class @StaffGrading ...@@ -271,8 +271,8 @@ class @StaffGrading
skip_and_get_next: () => skip_and_get_next: () =>
data = data =
score: Rubric.get_total_score() score: @rub.get_total_score()
rubric_scores: Rubric.get_score_list() rubric_scores: @rub.get_score_list()
feedback: @feedback_area.val() feedback: @feedback_area.val()
submission_id: @submission_id submission_id: @submission_id
location: @location location: @location
...@@ -286,8 +286,8 @@ class @StaffGrading ...@@ -286,8 +286,8 @@ class @StaffGrading
submit_and_get_next: () -> submit_and_get_next: () ->
data = data =
score: Rubric.get_total_score() score: @rub.get_total_score()
rubric_scores: Rubric.get_score_list() rubric_scores: @rub.get_score_list()
feedback: @feedback_area.val() feedback: @feedback_area.val()
submission_id: @submission_id submission_id: @submission_id
location: @location location: @location
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment