diff --git a/app/models/homework_test.rb b/app/models/homework_test.rb index 7c477bfaf..4ed290ecd 100644 --- a/app/models/homework_test.rb +++ b/app/models/homework_test.rb @@ -2,5 +2,5 @@ class HomeworkTest < ActiveRecord::Base attr_accessible :input, :output, :homework_common_id belongs_to :homework_common - has_one :student_work_test + has_many :student_work_test end diff --git a/app/views/student_work/_programing_work_show.html.erb b/app/views/student_work/_programing_work_show.html.erb index eab8313bc..9b5035a04 100644 --- a/app/views/student_work/_programing_work_show.html.erb +++ b/app/views/student_work/_programing_work_show.html.erb @@ -47,8 +47,9 @@ <%= test.output%> - <%= test.student_work_test.nil? ? "正在编译" : test.student_work_test.status_to_s%> - + <% student_work_test = StudentWorkTest.where(:homework_test_id => test.id,:student_work_id => @work.id).first%> + <%= student_work_test.nil? ? "正在编译" : student_work_test.status_to_s%> + <% end%>