缺评列表导出问题

This commit is contained in:
sw 2015-07-03 17:30:08 +08:00
parent a90ebbef96
commit 9ee9b0277c
1 changed files with 1 additions and 1 deletions

View File

@ -278,7 +278,7 @@ class StudentWorkController < ApplicationController
work_ids = "(" + @homework.student_works.map(&:id).join(",") + ")"
@stundet_works = StudentWork.find_by_sql("SELECT * FROM (SELECT *,(all_count - has_count) AS absence FROM(
SELECT * ,
(SELECT evaluation_num FROM homework_detail_manuals WHERE homework_detail_manuals.homework_common_id = #{@homework.id}) AS all_count,
(SELECT COUNT(*) FROM `student_works_evaluation_distributions` WHERE user_id = student_works.user_id AND student_work_id IN #{work_ids}) AS all_count,
(SELECT COUNT(*) FROM `student_works_scores` WHERE user_id = student_works.user_id AND student_work_id IN #{work_ids}) AS has_count
FROM `student_works`
WHERE homework_common_id = #{@homework.id}