From 69ed83fae1a2473223189a4972a90e7e81c8afd2 Mon Sep 17 00:00:00 2001 From: SylorHuang Date: Wed, 3 Jul 2019 17:34:02 +0800 Subject: [PATCH] fix bug --- app/controllers/homework_commons_controller.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/controllers/homework_commons_controller.rb b/app/controllers/homework_commons_controller.rb index 018218799..66dd7c864 100644 --- a/app/controllers/homework_commons_controller.rb +++ b/app/controllers/homework_commons_controller.rb @@ -196,7 +196,7 @@ class HomeworkCommonsController < ApplicationController end if params[:format] == "xlsx" - complete_works = @work_excel.exist? ? @work_excel.where("work_status > 0").size : 0 + complete_works = @work_excel.present? ? @work_excel.where("work_status > 0").size : 0 if @user_course_identity >= Course::STUDENT tip_exception(403, "无权限操作") elsif complete_works == 0 @@ -216,7 +216,7 @@ class HomeworkCommonsController < ApplicationController if @user_course_identity >= Course::STUDENT tip_exception(403, "无权限操作") else - if @work_excel.exist? + if @work_excel.present? zip_works = @work_excel&.where("work_status > 0") status = checkfileSize(zip_works) else