From 52c2e92da26a7cff23cf6f238001a15eaf733b36 Mon Sep 17 00:00:00 2001 From: BOHUNG Date: Fri, 21 Feb 2020 15:27:03 +0800 Subject: [PATCH] fix bugs in version 1 --- app/controllers/admin/olympiamanagements_controller.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/controllers/admin/olympiamanagements_controller.rb b/app/controllers/admin/olympiamanagements_controller.rb index 2669edf..b998d56 100644 --- a/app/controllers/admin/olympiamanagements_controller.rb +++ b/app/controllers/admin/olympiamanagements_controller.rb @@ -22,7 +22,7 @@ class Admin::OlympiamanagementsController < OrbitAdminController @students = OlympiaStudentDataField.where(:sign_up_setting_id=>@sign_up_setting.id) @error_msg = [] if @students.length !=0 - @students.destroy_all + @students.destroy @error_msg << ((I18n.locale.to_s == "zh_tw") ? "已刪除#{@students.length}筆學生資料" : "Already delete #{@students.length} student data.") else @error_msg << ((I18n.locale.to_s == "zh_tw") ? "尚無學生資料" : "There is no student data yet.") @@ -325,7 +325,7 @@ class Admin::OlympiamanagementsController < OrbitAdminController @student_fields = OlympiaStudentDataField.where(:olympia_school_data_fields_id=>params[:olympia_school_id],:sign_up_setting_id=>@sign_up_setting_id).asc(:id).page(page_num).per(10) end def export_sign_up_student_data - @student_data_fields = OlympiaStudentDataField.all.asc(:id) + @student_data_fields = OlympiaStudentDataField.where(:sign_up_setting_id=>@sign_up_setting.id).asc(:id) dir_path = 'tmp/olypiamanagement/' #FileUtils.rm_r(dir_path, :force => true) if Dir.exist?(dir_path) FileUtils.mkdir dir_path if !Dir.exist?(dir_path) #create dir for storing tmp_file if dir doesn't exist