Merge branch 'yuanke' into develop

This commit is contained in:
yuanke 2016-03-26 15:44:54 +08:00
commit 668de3ce4c
1 changed files with 4 additions and 4 deletions

View File

@ -99,7 +99,6 @@ class StudentWorkController < ApplicationController
unless student_work.save unless student_work.save
resultObj[:status] = 200 resultObj[:status] = 200
else else
student_work.name = params[:title] student_work.name = params[:title]
student_work.description = params[:src] student_work.description = params[:src]
@ -110,9 +109,9 @@ class StudentWorkController < ApplicationController
end end
#每次都要把数据存到数据库中 #每次都要把数据存到数据库中
status = resultObj[:status] status = result["status"]
if index == 1 if index == 1
student_work_test = student_work.student_work_tests.build(status: resultObj[:status], student_work_test = student_work.student_work_tests.build(status: status,
results: [resultObj[:results]],src: params[:src]) results: [resultObj[:results]],src: params[:src])
student_work_test.save! student_work_test.save!
resultObj[:testid] = student_work_test.id resultObj[:testid] = student_work_test.id
@ -133,6 +132,7 @@ class StudentWorkController < ApplicationController
if status == 0 if status == 0
resultObj[:status] = 0 resultObj[:status] = 0
end end
student_work.save!
resultObj[:time] = student_work_test.created_at.to_s(:db) resultObj[:time] = student_work_test.created_at.to_s(:db)
resultObj[:index] = student_work.student_work_tests.count resultObj[:index] = student_work.student_work_tests.count
end end