fix bugs in version 1

This commit is contained in:
BOHUNG 2020-02-21 15:27:03 +08:00
parent 91c018dabf
commit 52c2e92da2
1 changed files with 2 additions and 2 deletions

View File

@ -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