|
|
@ -104,7 +104,7 @@ class HomeworkCommonsController < ApplicationController
|
|
|
|
@shixun = @homework.shixuns.take if @homework.homework_type == "practice"
|
|
|
|
@shixun = @homework.shixuns.take if @homework.homework_type == "practice"
|
|
|
|
|
|
|
|
|
|
|
|
student_works = @homework.all_works
|
|
|
|
student_works = @homework.all_works
|
|
|
|
@all_member_count = student_works.count
|
|
|
|
@all_member_count = student_works.size
|
|
|
|
if @homework.publish_time.nil? || @homework.publish_time > Time.now
|
|
|
|
if @homework.publish_time.nil? || @homework.publish_time > Time.now
|
|
|
|
@student_works = []
|
|
|
|
@student_works = []
|
|
|
|
respond_to do |format|
|
|
|
|
respond_to do |format|
|
|
|
@ -135,14 +135,14 @@ class HomeworkCommonsController < ApplicationController
|
|
|
|
end
|
|
|
|
end
|
|
|
|
elsif @user_course_identity < Course::STUDENT
|
|
|
|
elsif @user_course_identity < Course::STUDENT
|
|
|
|
@student_works = @homework.teacher_works(@member)
|
|
|
|
@student_works = @homework.teacher_works(@member)
|
|
|
|
@all_member_count = @student_works.count
|
|
|
|
@all_member_count = @student_works.size
|
|
|
|
elsif @user_course_identity > Course::STUDENT && @homework.work_public
|
|
|
|
elsif @user_course_identity > Course::STUDENT && @homework.work_public
|
|
|
|
@student_works = student_works
|
|
|
|
@student_works = student_works
|
|
|
|
else
|
|
|
|
else
|
|
|
|
@student_works = []
|
|
|
|
@student_works = []
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
unless @student_works.size == 0
|
|
|
|
unless @student_works.blank?
|
|
|
|
# 教师评阅搜索 0: 未评, 1 已评
|
|
|
|
# 教师评阅搜索 0: 未评, 1 已评
|
|
|
|
unless params[:teacher_comment].blank?
|
|
|
|
unless params[:teacher_comment].blank?
|
|
|
|
student_work_ids = StudentWorksScore.where(student_work_id: @student_works.map(&:id)).pluck(:student_work_id)
|
|
|
|
student_work_ids = StudentWorksScore.where(student_work_id: @student_works.map(&:id)).pluck(:student_work_id)
|
|
|
@ -187,12 +187,13 @@ class HomeworkCommonsController < ApplicationController
|
|
|
|
# 分页参数
|
|
|
|
# 分页参数
|
|
|
|
page = params[:page] || 1
|
|
|
|
page = params[:page] || 1
|
|
|
|
limit = params[:limit] || 20
|
|
|
|
limit = params[:limit] || 20
|
|
|
|
@student_works = @student_works.page(page).per(limit).includes(:student_works_scores)
|
|
|
|
@student_works = @student_works.page(page).per(limit)
|
|
|
|
if @homework.homework_type == "practice"
|
|
|
|
if @homework.homework_type == "practice"
|
|
|
|
@student_works = @student_works.includes(user: :user_extension, myshixun: :games)
|
|
|
|
@student_works = @student_works.includes(:student_works_scores, user: :user_extension, myshixun: :games)
|
|
|
|
else
|
|
|
|
else
|
|
|
|
@student_works = @student_works.includes(:student_works_scores, :project, user: :user_extension)
|
|
|
|
@student_works = @student_works.includes(:student_works_scores, :project, user: :user_extension)
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
# @members = @course.students.where(user_id: @student_works.pluck(:user_id)).includes(:course_group)
|
|
|
|
end
|
|
|
|
end
|
|
|
|
respond_to do |format|
|
|
|
|
respond_to do |format|
|
|
|
|
format.json
|
|
|
|
format.json
|
|
|
|