diff --git a/app/controllers/managements_controller.rb b/app/controllers/managements_controller.rb index 63389709..2c0761c9 100644 --- a/app/controllers/managements_controller.rb +++ b/app/controllers/managements_controller.rb @@ -2941,7 +2941,7 @@ end else for row in 2 .. rows student_id = worksheet.cell(row, 1) - student_id = student_id.is_a?(Float) ? student_id.to_i : student_id + student_id = student_id.is_a?(Float) ? student_id.to_s.strip.to_i : student_id.to_s.strip member_role = worksheet.cell(row, 4).to_i course_id = worksheet.cell(row, 3) group_name = worksheet.cell(row, 5) @@ -3027,15 +3027,15 @@ end user.admin = false user.activate user.login = prefix + list[0].to_s.strip - user.lastname = list[1] - user.nickname = list[1] + user.lastname = list[1].to_s.strip + user.nickname = list[1].to_s.strip user.professional_certification = 1 user.certification = 1 user.grade = 0 user.password = "12345678" - user.phone = list[5] + user.phone = list[5].blank? ? nil : list[5] if user.save - ue = UserExtensions.new(:user_id => user.id, :gender => 0, :school_id => school_id, :location => school.province, :location_city => school.city, :identity => list[3], :student_id => list[0], :department_id => department.try(:id)) + ue = UserExtensions.new(:user_id => user.id, :gender => 0, :school_id => school_id, :location => school.province, :location_city => school.city, :identity => list[3].to_i, :student_id => list[0].to_s.strip, :department_id => department.try(:id)) if list[3] && list[3].to_i == 0 ue.technical_title = ["教授", "副教授", "讲师", "助教"].include?(list[4]) ? list[4] : "讲师" elsif list[3] && list[3].to_i == 2