数据库语句使用rails已有的
This commit is contained in:
parent
dc3837da76
commit
c6174406fb
|
@ -596,7 +596,7 @@ class AdminController < ApplicationController
|
|||
#代码测试列表
|
||||
def code_work_tests
|
||||
#求出所有条数
|
||||
tCount = StudentWorkTest.find_by_sql("select count(*) from code_tests").first['count(*)']
|
||||
tCount = CodeTests.count()
|
||||
|
||||
#设置个空的数组 以便paginateHelper来分页
|
||||
@code_work_tests = []
|
||||
|
@ -615,7 +615,8 @@ class AdminController < ApplicationController
|
|||
if is_test[test['student_work_id']] != nil
|
||||
test['is_test'] = is_test[test['student_work_id']]
|
||||
else
|
||||
test['is_test'] = CodeTests.find_by_sql("select is_test from student_works where id = #{test['student_work_id']}").first['is_test']
|
||||
test['is_test'] = StudentWork.find(test['student_work_id']).is_test
|
||||
#test['is_test'] = CodeTests.find_by_sql("select is_test from student_works where id = #{test['student_work_id']}").first['is_test']
|
||||
is_test[test['student_work_id']] = test['is_test']
|
||||
end
|
||||
end
|
||||
|
|
|
@ -40,7 +40,7 @@
|
|||
<%=link_to(test['homework_id'], student_work_index_path(:homework => test['homework_id']))%>
|
||||
</td>
|
||||
<td style="text-align: center; " title='<%=test['student_work_id']%>'>
|
||||
<% if test['is_test'] == 0 %>
|
||||
<% if !test['is_test'] %>
|
||||
<%=link_to(test['student_work_id'], student_work_index_path(:homework => test['homework_id'],:student_work_id=>test['student_work_id']))%>
|
||||
<% else %>
|
||||
<%=link_to(test['student_work_id'], new_user_commit_homework_users_path(homework_id: test['homework_id'], is_test: true))%>
|
||||
|
|
Loading…
Reference in New Issue