Commit 9a5a9881 by Vik Paruchuri

Revert peer grading problem to master version

parent 2542b6cb
...@@ -179,9 +179,6 @@ class @PeerGradingProblem ...@@ -179,9 +179,6 @@ class @PeerGradingProblem
@grading_panel = $('.grading-panel') @grading_panel = $('.grading-panel')
@content_panel = $('.content-panel') @content_panel = $('.content-panel')
@grading_message = $('.grading-message') @grading_message = $('.grading-message')
@question_header = $('.question-header')
@question_header
@question_header.click @collapse_question
@grading_message.hide() @grading_message.hide()
@grading_wrapper =$('.grading-wrapper') @grading_wrapper =$('.grading-wrapper')
...@@ -236,23 +233,11 @@ class @PeerGradingProblem ...@@ -236,23 +233,11 @@ class @PeerGradingProblem
fetch_submission_essay: () => fetch_submission_essay: () =>
@backend.post('get_next_submission', {location: @location}, @render_submission) @backend.post('get_next_submission', {location: @location}, @render_submission)
# finds the scores for each rubric category
get_score_list: () =>
# find the number of categories:
num_categories = $('ul.rubric-list li').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
construct_data: () -> construct_data: () ->
data = data =
rubric_scores: @get_score_list() rubric_scores: Rubric.get_score_list()
score: @grade score: Rubric.get_total_score()
location: @location location: @location
submission_id: @essay_id_input.val() submission_id: @essay_id_input.val()
submission_key: @submission_key_input.val() submission_key: @submission_key_input.val()
...@@ -283,7 +268,6 @@ class @PeerGradingProblem ...@@ -283,7 +268,6 @@ class @PeerGradingProblem
if response.calibrated and (@calibration == null or @calibration == false) if response.calibrated and (@calibration == null or @calibration == false)
@calibration = false @calibration = false
@fetch_submission_essay() @fetch_submission_essay()
@collapse_question()
# If we were calibrating before and no longer need to, # If we were calibrating before and no longer need to,
# show the interstitial page # show the interstitial page
else if response.calibrated and @calibration == true else if response.calibrated and @calibration == true
...@@ -321,17 +305,11 @@ class @PeerGradingProblem ...@@ -321,17 +305,11 @@ 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)] # show button if we have scores for all categories
score = $("input[name='score-selection-#{i}']:checked").val() @show_submit_button()
if score == undefined @grade = Rubric.get_total_score()
return
# show button if we have scores for all categories
@show_submit_button()
...@@ -405,6 +383,7 @@ class @PeerGradingProblem ...@@ -405,6 +383,7 @@ class @PeerGradingProblem
# render common information between calibration and grading # render common information between calibration and grading
render_submission_data: (response) => render_submission_data: (response) =>
@content_panel.show() @content_panel.show()
@error_container.hide()
@submission_container.append(@make_paragraphs(response.student_response)) @submission_container.append(@make_paragraphs(response.student_response))
@prompt_container.html(response.prompt) @prompt_container.html(response.prompt)
...@@ -452,37 +431,5 @@ class @PeerGradingProblem ...@@ -452,37 +431,5 @@ class @PeerGradingProblem
@submit_button.show() @submit_button.show()
setup_score_selection: (max_score) => setup_score_selection: (max_score) =>
# first, get rid of all the old inputs, if any.
@score_selection_container.html("""
<h3>Overall Score</h3>
<p>Choose an overall score for this submission.</p>
""")
# Now create new labels and inputs for each possible score.
for score in [0..max_score]
id = 'score-' + score
label = """<label for="#{id}">#{score}</label>"""
input = """
<input type="radio" name="grade-selection" id="#{id}" value="#{score}"/>
""" # " fix broken parsing in emacs
@score_selection_container.append(input + label)
# And now hook up an event handler again # And now hook up an event handler again
$("input[name='score-selection']").change @graded_callback $("input[class='score-selection']").change @graded_callback
$("input[name='grade-selection']").change @graded_callback
collapse_question: () =>
@prompt_container.slideToggle()
@prompt_container.toggleClass('open')
if @question_header.text() == "(Hide)"
new_text = "(Show)"
else
new_text = "(Hide)"
@question_header.text(new_text)
#mock_backend = false
#ajax_url = $('.peer-grading').data('ajax_url')
#backend = new PeerGradingProblemBackend(ajax_url, mock_backend)
#$(document).ready(() -> new PeerGradingProblem(backend))
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