作品列表为空时缺评列表报错
This commit is contained in:
parent
95ab6dd6c0
commit
a9ff9f96bd
|
@ -245,6 +245,9 @@ class StudentWorkController < ApplicationController
|
||||||
def student_work_absence_penalty
|
def student_work_absence_penalty
|
||||||
render_403 unless User.current.allowed_to?(:as_teacher,@course)
|
render_403 unless User.current.allowed_to?(:as_teacher,@course)
|
||||||
order = params[:order] || "desc"
|
order = params[:order] || "desc"
|
||||||
|
if @homework.student_works.empty?
|
||||||
|
@stundet_works = []
|
||||||
|
else
|
||||||
work_ids = "(" + @homework.student_works.map(&:id).join(",") + ")"
|
work_ids = "(" + @homework.student_works.map(&:id).join(",") + ")"
|
||||||
@stundet_works = StudentWork.find_by_sql("SELECT *,(all_count - has_count) AS absence FROM(
|
@stundet_works = StudentWork.find_by_sql("SELECT *,(all_count - has_count) AS absence FROM(
|
||||||
SELECT * ,
|
SELECT * ,
|
||||||
|
@ -254,6 +257,7 @@ class StudentWorkController < ApplicationController
|
||||||
WHERE homework_common_id = #{@homework.id}
|
WHERE homework_common_id = #{@homework.id}
|
||||||
) AS table_1
|
) AS table_1
|
||||||
ORDER BY absence #{order}")
|
ORDER BY absence #{order}")
|
||||||
|
end
|
||||||
@order = order == "desc" ? "asc" : "desc"
|
@order = order == "desc" ? "asc" : "desc"
|
||||||
respond_to do |format|
|
respond_to do |format|
|
||||||
format.html
|
format.html
|
||||||
|
|
Loading…
Reference in New Issue