Commit 275c9ef7 by Diana Huang

Update API with server and add new meta info box for meta information

parent 7c768cbb
...@@ -27,7 +27,8 @@ class StaffGradingBackend ...@@ -27,7 +27,8 @@ class StaffGradingBackend
success: true success: true
problem_name: 'Problem 1' problem_name: 'Problem 1'
num_graded: 3 num_graded: 3
num_total: 5 min_for_ml: 5
num_pending: 4
prompt: ''' prompt: '''
<h2>S11E3: Metal Bands</h2> <h2>S11E3: Metal Bands</h2>
<p>Shown below are schematic band diagrams for two different metals. Both diagrams appear different, yet both of the elements are undisputably metallic in nature.</p> <p>Shown below are schematic band diagrams for two different metals. Both diagrams appear different, yet both of the elements are undisputably metallic in nature.</p>
...@@ -57,7 +58,8 @@ The standard chunk of Lorem Ipsum used since the 1500s is reproduced below for t ...@@ -57,7 +58,8 @@ The standard chunk of Lorem Ipsum used since the 1500s is reproduced below for t
success: true success: true
problem_name: 'Problem 2' problem_name: 'Problem 2'
num_graded: 2 num_graded: 2
num_total: 5 min_for_ml: 5
num_pending: 4
prompt: 'This is a fake second problem' prompt: 'This is a fake second problem'
submission: 'This is the best submission ever! ' + @mock_cnt submission: 'This is the best submission ever! ' + @mock_cnt
rubric: 'I am a rubric for grading things! ' + @mock_cnt rubric: 'I am a rubric for grading things! ' + @mock_cnt
...@@ -74,17 +76,16 @@ The standard chunk of Lorem Ipsum used since the 1500s is reproduced below for t ...@@ -74,17 +76,16 @@ The standard chunk of Lorem Ipsum used since the 1500s is reproduced below for t
response = response =
@mock('get_next', {location: data.location}) @mock('get_next', {location: data.location})
# get_problem_list # get_problem_list
# sends in a course_id and a grader_id # should get back a list of problem_ids, problem_names, num_graded, min_for_ml
# should get back a list of problem_ids, problem_names, num_graded, num_total
else if cmd == 'get_problem_list' else if cmd == 'get_problem_list'
@mock_cnt = 1 @mock_cnt = 1
response = response =
success: true success: true
problem_list: [ problem_list: [
{location: 'i4x://MITx/3.091x/problem/open_ended_demo1', \ {location: 'i4x://MITx/3.091x/problem/open_ended_demo1', \
problem_name: "Problem 1", num_graded: 3, num_total: 5}, problem_name: "Problem 1", num_graded: 3, num_pending: 5, min_for_ml: 10},
{location: 'i4x://MITx/3.091x/problem/open_ended_demo2', \ {location: 'i4x://MITx/3.091x/problem/open_ended_demo2', \
problem_name: "Problem 2", num_graded: 1, num_total: 5} problem_name: "Problem 2", num_graded: 1, num_pending: 5, min_for_ml: 10}
] ]
else else
response = response =
...@@ -140,6 +141,9 @@ class StaffGrading ...@@ -140,6 +141,9 @@ class StaffGrading
@score_selection_container = $('.score-selection-container') @score_selection_container = $('.score-selection-container')
@submit_button = $('.submit-button') @submit_button = $('.submit-button')
@action_button = $('.action-button') @action_button = $('.action-button')
@problem_meta_info = $('.problem-meta-info-container')
@meta_info_wrapper = $('.meta-info-wrapper')
@ml_error_info_container = $('.ml-error-info-container') @ml_error_info_container = $('.ml-error-info-container')
@breadcrumbs = $('.breadcrumbs') @breadcrumbs = $('.breadcrumbs')
...@@ -156,8 +160,9 @@ class StaffGrading ...@@ -156,8 +160,9 @@ class StaffGrading
@ml_error_info= '' @ml_error_info= ''
@location = '' @location = ''
@prompt_name = '' @prompt_name = ''
@num_total = 0 @min_for_ml = 0
@num_graded = 0 @num_graded = 0
@num_pending = 0
@score = null @score = null
@problems = null @problems = null
...@@ -207,7 +212,7 @@ class StaffGrading ...@@ -207,7 +212,7 @@ class StaffGrading
if response.problem_list if response.problem_list
@problems = response.problem_list @problems = response.problem_list
else if response.submission else if response.submission
@data_loaded(response.prompt, response.submission, response.rubric, response.submission_id, response.max_score, response.ml_error_info, response.problem_name, response.num_graded, response.num_total) @data_loaded(response)
else else
@no_more(response.message) @no_more(response.message)
else else
...@@ -237,18 +242,19 @@ class StaffGrading ...@@ -237,18 +242,19 @@ class StaffGrading
@error_msg = msg @error_msg = msg
@state = state_error @state = state_error
data_loaded: (prompt, submission, rubric, submission_id, max_score, ml_error_info, prompt_name, num_graded, num_total) -> data_loaded: (response) ->
@prompt = prompt @prompt = response.prompt
@submission = submission @submission = response.submission
@rubric = rubric @rubric = response.rubric
@submission_id = submission_id @submission_id = response.submission_id
@feedback_area.val('') @feedback_area.val('')
@max_score = max_score @max_score = response.max_score
@score = null @score = null
@ml_error_info=ml_error_info @ml_error_info=response.ml_error_info
@prompt_name = prompt_name @prompt_name = response.problem_name
@num_graded = num_graded @num_graded = response.num_graded
@num_total = num_total @min_for_ml = response.min_for_ml
@num_pending = response.num_pending
@state = state_grading @state = state_grading
if not @max_score? if not @max_score?
@error("No max score specified for submission.") @error("No max score specified for submission.")
...@@ -257,7 +263,7 @@ class StaffGrading ...@@ -257,7 +263,7 @@ class StaffGrading
@prompt = null @prompt = null
@prompt_name = '' @prompt_name = ''
@num_graded = 0 @num_graded = 0
@num_total = 0 @min_for_ml = 0
@submission = null @submission = null
@rubric = null @rubric = null
@ml_error_info = null @ml_error_info = null
...@@ -289,7 +295,7 @@ class StaffGrading ...@@ -289,7 +295,7 @@ class StaffGrading
@submission_wrapper.toggle(show_grading_elements) @submission_wrapper.toggle(show_grading_elements)
@rubric_wrapper.toggle(show_grading_elements) @rubric_wrapper.toggle(show_grading_elements)
@grading_wrapper.toggle(show_grading_elements) @grading_wrapper.toggle(show_grading_elements)
@ml_error_info_container.toggle(show_grading_elements) @meta_info_wrapper.toggle(show_grading_elements)
@action_button.hide() @action_button.hide()
if @list_view if @list_view
...@@ -299,7 +305,7 @@ class StaffGrading ...@@ -299,7 +305,7 @@ class StaffGrading
problem_link:(problem) -> problem_link:(problem) ->
link = $('<a>').attr('href', "javascript:void(0)").append( link = $('<a>').attr('href', "javascript:void(0)").append(
"#{problem.problem_name} (#{problem.num_graded} graded out of #{problem.num_total})") "#{problem.problem_name} (#{problem.num_graded} graded, #{problem.num_pending} pending)")
.click => .click =>
@get_next_submission problem.location @get_next_submission problem.location
...@@ -333,8 +339,14 @@ class StaffGrading ...@@ -333,8 +339,14 @@ class StaffGrading
else if @state == state_grading else if @state == state_grading
@ml_error_info_container.html(@ml_error_info) @ml_error_info_container.html(@ml_error_info)
meta_list = $("<ul>")
meta_list.append("<li><span class='meta-info'>Pending:</span> #{@num_pending}</li>")
meta_list.append("<li><span class='meta-info'>Graded:</span> #{@num_graded}</li>")
meta_list.append("<li><span class='meta-info'>Needed for ML:</span> #{Math.max(@min_for_ml - @num_graded)}</li>")
@problem_meta_info.append(meta_list)
@prompt_container.html(@prompt) @prompt_container.html(@prompt)
@prompt_name_container.html("#{@prompt_name} <span class='sub-heading'>(#{@num_graded} completed out of #{@num_total})</span>") @prompt_name_container.html("#{@prompt_name}")
@submission_container.html(@make_paragraphs(@submission)) @submission_container.html(@make_paragraphs(@submission))
@rubric_container.html(@rubric) @rubric_container.html(@rubric)
......
...@@ -17,6 +17,14 @@ ...@@ -17,6 +17,14 @@
<section class="container"> <section class="container">
<div class="staff-grading" data-ajax_url="${ajax_url}"> <div class="staff-grading" data-ajax_url="${ajax_url}">
<div class="meta-info-wrapper">
<h3>Meta Information</h3>
<div class="problem-meta-info-container">
</div>
<h3>Maching Learning Information</h3>
<div class="ml-error-info-container">
</div>
</div>
<h1>Staff grading</h1> <h1>Staff grading</h1>
<div class="breadcrumbs"> <div class="breadcrumbs">
</div> </div>
...@@ -24,9 +32,6 @@ ...@@ -24,9 +32,6 @@
</div> </div>
<div class="message-container"> <div class="message-container">
</div> </div>
<section class="ml-info-wrapper">
<div class="ml-error-info-container">
</div>
<section class="problem-list-container"> <section class="problem-list-container">
<h2>Instructions</h2> <h2>Instructions</h2>
<div class="instructions"> <div class="instructions">
......
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