|
|
@ -106,11 +106,9 @@ class HomeworkCommonsController < ApplicationController
|
|
|
|
|
|
|
|
|
|
|
|
student_works = @homework.all_works
|
|
|
|
student_works = @homework.all_works
|
|
|
|
@all_member_count = student_works.size
|
|
|
|
@all_member_count = student_works.size
|
|
|
|
logger.info("##########__________@homework.publish_time______________#############{@homework.publish_time}")
|
|
|
|
|
|
|
|
if @homework.publish_time.blank? || (@homework.publish_time > Time.now)
|
|
|
|
if @homework.publish_time.blank? || (@homework.publish_time > Time.now)
|
|
|
|
@student_works = []
|
|
|
|
@student_works = []
|
|
|
|
if params[:format] == "xlsx" || params[:format] == "zip"
|
|
|
|
if (params[:format] == "xlsx") || (params[:format] == "zip")
|
|
|
|
logger.info("##########__________params[:format]______________#############{params[:format]}")
|
|
|
|
|
|
|
|
normal_status(-1,"作业未发布")
|
|
|
|
normal_status(-1,"作业未发布")
|
|
|
|
end
|
|
|
|
end
|
|
|
|
else
|
|
|
|
else
|
|
|
@ -198,7 +196,7 @@ class HomeworkCommonsController < ApplicationController
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
if params[:format] == "xlsx"
|
|
|
|
if params[:format] == "xlsx"
|
|
|
|
complete_works = @work_excel.where("work_status > 0").size
|
|
|
|
complete_works = @work_excel.exist? ? @work_excel.where("work_status > 0").size : 0
|
|
|
|
if @user_course_identity >= Course::STUDENT
|
|
|
|
if @user_course_identity >= Course::STUDENT
|
|
|
|
tip_exception(403, "无权限操作")
|
|
|
|
tip_exception(403, "无权限操作")
|
|
|
|
elsif complete_works == 0
|
|
|
|
elsif complete_works == 0
|
|
|
@ -218,8 +216,13 @@ class HomeworkCommonsController < ApplicationController
|
|
|
|
if @user_course_identity >= Course::STUDENT
|
|
|
|
if @user_course_identity >= Course::STUDENT
|
|
|
|
tip_exception(403, "无权限操作")
|
|
|
|
tip_exception(403, "无权限操作")
|
|
|
|
else
|
|
|
|
else
|
|
|
|
zip_works = @work_excel.where("work_status > 0")
|
|
|
|
if @work_excel.exist?
|
|
|
|
|
|
|
|
zip_works = @work_excel&.where("work_status > 0")
|
|
|
|
status = checkfileSize(zip_works)
|
|
|
|
status = checkfileSize(zip_works)
|
|
|
|
|
|
|
|
else
|
|
|
|
|
|
|
|
status = -1
|
|
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
if status == 0
|
|
|
|
if status == 0
|
|
|
|
respond_to do |format|
|
|
|
|
respond_to do |format|
|
|
|
|
format.zip{
|
|
|
|
format.zip{
|
|
|
|