Commit 5914b1cf by Diana Huang

Make the mock backend support different problems, and make sure

the location is passed around properly. Clarify some of the numbers for
the user
parent 94e1a9ff
...@@ -21,6 +21,8 @@ class StaffGradingBackend ...@@ -21,6 +21,8 @@ class StaffGradingBackend
# should take a location as an argument # should take a location as an argument
if cmd == 'get_next' if cmd == 'get_next'
@mock_cnt++ @mock_cnt++
switch data.location
when 'i4x://MITx/3.091x/problem/open_ended_demo1'
response = response =
success: true success: true
problem_name: 'Problem 1' problem_name: 'Problem 1'
...@@ -32,11 +34,27 @@ class StaffGradingBackend ...@@ -32,11 +34,27 @@ class StaffGradingBackend
submission_id: @mock_cnt submission_id: @mock_cnt
max_score: 2 + @mock_cnt % 3 max_score: 2 + @mock_cnt % 3
ml_error_info : 'ML accuracy info: ' + @mock_cnt ml_error_info : 'ML accuracy info: ' + @mock_cnt
when 'i4x://MITx/3.091x/problem/open_ended_demo2'
response =
success: true
problem_name: 'Problem 2'
num_left: 2
num_total: 5
prompt: 'This is a fake second problem'
submission: 'This is the best submission ever! ' + @mock_cnt
rubric: 'I am a rubric for grading things! ' + @mock_cnt
submission_id: @mock_cnt
max_score: 2 + @mock_cnt % 3
ml_error_info : 'ML accuracy info: ' + @mock_cnt
else
response =
success: false
else if cmd == 'save_grade' else if cmd == 'save_grade'
console.log("eval: #{data.score} pts, Feedback: #{data.feedback}") console.log("eval: #{data.score} pts, Feedback: #{data.feedback}")
response = response =
@mock('get_next', {location}) @mock('get_next', {location: data.location})
# get_problem_list # get_problem_list
# sends in a course_id and a grader_id # sends in a course_id and a grader_id
# should get back a list of problem_ids, problem_names, num_left, num_total # should get back a list of problem_ids, problem_names, num_left, num_total
...@@ -45,9 +63,9 @@ class StaffGradingBackend ...@@ -45,9 +63,9 @@ class StaffGradingBackend
response = response =
success: true success: true
problem_list: [ problem_list: [
{location: 'i4x://MITx/3.091x/problem/open_ended_demo', \ {location: 'i4x://MITx/3.091x/problem/open_ended_demo1', \
problem_name: "Problem 1", num_left: 3, num_total: 5}, problem_name: "Problem 1", num_left: 3, num_total: 5},
{location: 'i4x://MITx/3.091x/problem/open_ended_demo', \ {location: 'i4x://MITx/3.091x/problem/open_ended_demo2', \
problem_name: "Problem 2", num_left: 1, num_total: 5} problem_name: "Problem 2", num_left: 1, num_total: 5}
] ]
else else
...@@ -178,7 +196,7 @@ class StaffGrading ...@@ -178,7 +196,7 @@ class StaffGrading
get_next_submission: (location) -> get_next_submission: (location) ->
@location = location @location = location
@list_view = false @list_view = false
@backend.post('get_next', {location}, @ajax_callback) @backend.post('get_next', {location: location}, @ajax_callback)
get_problem_list: () -> get_problem_list: () ->
@list_view = true @list_view = true
...@@ -189,6 +207,7 @@ class StaffGrading ...@@ -189,6 +207,7 @@ class StaffGrading
score: @score score: @score
feedback: @feedback_area.val() feedback: @feedback_area.val()
submission_id: @submission_id submission_id: @submission_id
location: @location
@backend.post('save_grade', data, @ajax_callback) @backend.post('save_grade', data, @ajax_callback)
...@@ -250,7 +269,7 @@ class StaffGrading ...@@ -250,7 +269,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_left} / #{problem.num_total})") "#{problem.problem_name} (#{problem.num_left} left out of #{problem.num_total})")
.click => .click =>
@get_next_submission problem.location @get_next_submission problem.location
...@@ -271,7 +290,7 @@ class StaffGrading ...@@ -271,7 +290,7 @@ 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)
@prompt_container.html(@prompt) @prompt_container.html(@prompt)
@prompt_name_container.html("#{@prompt_name} (#{@num_left} / #{@num_total})") @prompt_name_container.html("#{@prompt_name} <span class='sub-heading'>(#{@num_left} left out of #{@num_total})</span>")
@submission_container.html(@submission) @submission_container.html(@submission)
@rubric_container.html(@rubric) @rubric_container.html(@rubric)
......
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