代码测试rake
This commit is contained in:
parent
05a8944dcf
commit
dc820b6365
|
@ -1,19 +1,27 @@
|
|||
namespace :find do
|
||||
namespace :findworktest do
|
||||
desc "Find student work error score test"
|
||||
task :find do
|
||||
task :find=> :environment do
|
||||
puts "start find."
|
||||
|
||||
worktests = StudentWorkTest.where("select a.* from student_work_tests a where id = (select max(id) from student_work_tests where student_work_tests.student_work_id = a.student_work_id)")
|
||||
worktests = StudentWorkTest.find_by_sql("select a.* from student_work_tests a where id = (select max(id) from student_work_tests where student_work_tests.student_work_id = a.student_work_id)")
|
||||
|
||||
allcount = 0
|
||||
|
||||
worktests.each do|worktest|
|
||||
|
||||
testcount = worktest.student_work.homework_common.homework_tests.size
|
||||
|
||||
if testcount != worktest.results.count && worktest.student_work.system_score == 100
|
||||
puts "error score"
|
||||
puts "work_id="+worktest.student_work.id
|
||||
puts "worktest_id="+worktest.id
|
||||
if !worktest.student_work.nil? && !worktest.student_work.homework_common.nil? && !worktest.student_work.homework_common.homework_tests.nil?
|
||||
testcount = worktest.student_work.homework_common.homework_tests.size
|
||||
if testcount != worktest.results.count && worktest.student_work.system_score == 100
|
||||
puts "------------------------------------"
|
||||
puts "error score"
|
||||
puts "testcount="+testcount.to_s
|
||||
puts "resultscount="+worktest.results.count.to_s
|
||||
puts "work_id="+worktest.student_work.id.to_s
|
||||
puts "worktest_id="+worktest.id.to_s
|
||||
puts "homework_common_id="+worktest.student_work.homework_common.id.to_s
|
||||
allcount = allcount + 1
|
||||
puts "allcount="+allcount.to_s
|
||||
puts "------------------------------------"
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
|
|
Loading…
Reference in New Issue