Fix rubric with staff grading

This commit is contained in:
Vik Paruchuri
2013-08-08 19:50:55 -04:00
parent e4bcfa5c21
commit e39abe11db
2 changed files with 12 additions and 12 deletions

View File

@@ -6,7 +6,7 @@ class @Rubric
constructor: (el) ->
@el = el
initialize: (location) ->
initialize: (location) =>
@$(@rubric_sel).data("location", location)
@$('input[class="score-selection"]').change @tracking_callback
# set up the hotkeys
@@ -53,7 +53,7 @@ class @Rubric
@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")
@@ -76,14 +76,14 @@ class @Rubric
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_sel).length
for i in [0..(num_categories-1)]

View File

@@ -223,12 +223,12 @@ class @StaffGrading
setup_score_selection: =>
@score_selection_container.html(@rubric)
$('input[class="score-selection"]').change => @graded_callback()
Rubric.initialize(@location, @el)
@rub = new Rubric(@el)
@rub.initialize(@location)
graded_callback: () =>
# show button if we have scores for all categories
if Rubric.check_complete()
if @rub.check_complete()
@state = state_graded
@submit_button.show()
@@ -236,7 +236,7 @@ class @StaffGrading
#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 && !@list_view && Rubric.check_complete()
else if @is_ctrl==true && event.which == 13 && !@list_view && @rub.check_complete()
@submit_and_get_next()
keyup_handler: (event) =>
@@ -271,8 +271,8 @@ class @StaffGrading
skip_and_get_next: () =>
data =
score: Rubric.get_total_score()
rubric_scores: Rubric.get_score_list()
score: @rub.get_total_score()
rubric_scores: @rub.get_score_list()
feedback: @feedback_area.val()
submission_id: @submission_id
location: @location
@@ -286,8 +286,8 @@ class @StaffGrading
submit_and_get_next: () ->
data =
score: Rubric.get_total_score()
rubric_scores: Rubric.get_score_list()
score: @rub.get_total_score()
rubric_scores: @rub.get_score_list()
feedback: @feedback_area.val()
submission_id: @submission_id
location: @location