修改回调函数
This commit is contained in:
parent
b6e123e476
commit
17e6102005
|
@ -124,7 +124,7 @@ class StudentWorkController < ApplicationController
|
|||
url = "http://test.gitlab.trustie.net/api/questions/#{@homework.homework_detail_programing.question_id}/solutions.json"
|
||||
uri = URI(url)
|
||||
solutions = {
|
||||
id:stundet_work.id,
|
||||
stundet_work_id:stundet_work.id,
|
||||
src:stundet_work.description,
|
||||
language:1
|
||||
}
|
||||
|
@ -372,9 +372,15 @@ class StudentWorkController < ApplicationController
|
|||
|
||||
#设置编程作业得分
|
||||
def set_program_score
|
||||
stundet_work = StudentWork.find_by_id params[:id]
|
||||
if stundet_work
|
||||
stundet_work.update_column("student_score",params[:status] == 0 ? 100 : 0)
|
||||
stundet_work = StudentWork.find_by_id params[:student_work_id]
|
||||
if stundet_work && params[:result] && params[:results].class.to_s == "Array"
|
||||
homework_common = stundet_work.homework_common
|
||||
params[:results].each do |result|
|
||||
homework_test = homework_common.homework_tests.where("input = #{result[:input]} AND output = #{result[:output]}").first
|
||||
if homework_test
|
||||
StudentWorkTest.create(:student_work_id => stundet_work.id,:homework_test_id => homework_test.id,:result => result[:status])
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
|
Loading…
Reference in New Issue