Description:
saves and grades submission in standard mode
Commit status:
[Not Reviewed]
References:
Diff options:
Comments:
0 Commit comments
0 Inline Comments
Unresolved TODOs:
There are no unresolved TODOs
r388:b5766b7ed3ec - - 2 files changed: 18 inserted, 6 deleted
@@ -77,7 +77,7 | |||||
|
77 | prepare_list_information |
|
77 | prepare_list_information |
|
78 | render :action => 'list' and return |
|
78 | render :action => 'list' and return |
|
79 | end |
|
79 | end |
|
80 | - if assignment.expired? |
|
80 | + if (assignment.expired?) and (!GraderConfiguration.standard_mode?) |
|
81 | flash[:notice] = 'Error: หมดเวลาส่งสำหรับข้อนี้' |
|
81 | flash[:notice] = 'Error: หมดเวลาส่งสำหรับข้อนี้' |
|
82 | prepare_list_information |
|
82 | prepare_list_information |
|
83 | render :action => 'list' and return |
|
83 | render :action => 'list' and return |
@@ -101,6 +101,14 | |||||
|
101 | render :action => 'list' and return |
|
101 | render :action => 'list' and return |
|
102 | end |
|
102 | end |
|
103 |
|
103 | ||
|
|
104 | + if GraderConfiguration.standard_mode? | ||
|
|
105 | + test_pair = assignment.test_pair | ||
|
|
106 | + result = test_pair.grade(@submission.output) | ||
|
|
107 | + @submission.points = result[:score]*100 / result[:full_score] | ||
|
|
108 | + @submission.grader_comment = result[:msg] | ||
|
|
109 | + @submission.graded_at = Time.now.gmtime | ||
|
|
110 | + end | ||
|
|
111 | + | ||
|
104 | if @submission.valid? |
|
112 | if @submission.valid? |
|
105 | if @submission.save == false |
|
113 | if @submission.save == false |
|
106 | flash[:notice] = 'Error saving your submission' |
|
114 | flash[:notice] = 'Error saving your submission' |
@@ -314,13 +322,17 | |||||
|
314 | @submission_timeouts = {} |
|
322 | @submission_timeouts = {} |
|
315 | problems.each do |problem| |
|
323 | problems.each do |problem| |
|
316 | assignment = @user.get_test_pair_assignment_for(problem) |
|
324 | assignment = @user.get_test_pair_assignment_for(problem) |
|
317 | - if assignment == nil |
|
325 | + if GraderConfiguration.standard_mode? |
|
318 | timeout = nil |
|
326 | timeout = nil |
|
319 | else |
|
327 | else |
|
320 | - if (assignment.expired?) or (assignment.submitted) |
|
328 | + if assignment == nil |
|
321 |
- timeout = |
|
329 | + timeout = nil |
|
322 | else |
|
330 | else |
|
323 | - timeout = assignment.created_at + TEST_ASSIGNMENT_EXPIRATION_DURATION - Time.new.gmtime |
|
331 | + if (assignment.expired?) or (assignment.submitted) |
|
|
332 | + timeout = 0 | ||
|
|
333 | + else | ||
|
|
334 | + timeout = assignment.created_at + TEST_ASSIGNMENT_EXPIRATION_DURATION - Time.new.gmtime | ||
|
|
335 | + end | ||
|
324 | end |
|
336 | end |
|
325 | end |
|
337 | end |
|
326 | @submission_timeouts[problem.id] = timeout |
|
338 | @submission_timeouts[problem.id] = timeout |
@@ -30,7 +30,7 | |||||
|
30 | <%= form_tag({:controller => 'main', :action => 'submit'}, {:method => 'post', :multipart => true, :id => "submission_form_#{problem.id}_id" }) do %> |
|
30 | <%= form_tag({:controller => 'main', :action => 'submit'}, {:method => 'post', :multipart => true, :id => "submission_form_#{problem.id}_id" }) do %> |
|
31 | <%= hidden_field_tag 'submission[problem_id]', problem.id %> |
|
31 | <%= hidden_field_tag 'submission[problem_id]', problem.id %> |
|
32 | ข้อมูลส่งออก: <%= file_field_tag 'output_file' %> |
|
32 | ข้อมูลส่งออก: <%= file_field_tag 'output_file' %> |
|
33 |
- โปรแกรม |
|
33 | + โปรแกรมของคุณ: <%= file_field_tag 'file' %> |
|
34 | <%= submit_tag 'Submit' %> |
|
34 | <%= submit_tag 'Submit' %> |
|
35 | <% end %> |
|
35 | <% end %> |
|
36 | </div> |
|
36 | </div> |
You need to be logged in to leave comments.
Login now