diff --git a/Gemfile b/Gemfile index f4697bf5..7dca07cd 100644 --- a/Gemfile +++ b/Gemfile @@ -63,7 +63,7 @@ gem 'elasticsearch-rails' gem 'oauth2' # xlsx -gem 'axlsx_rails', '0.3.0' +# gem 'axlsx_rails', '0.3.0' #Ruby 2.2+ has removed test/unit from the core library. if RUBY_VERSION>='2.2' diff --git a/app/controllers/managements_controller.rb b/app/controllers/managements_controller.rb index 53eb23ae..d4e08240 100644 --- a/app/controllers/managements_controller.rb +++ b/app/controllers/managements_controller.rb @@ -1416,7 +1416,8 @@ end def update_depart_identifier if params[:depart] && params[:identifier] @department = Department.where(:id => params[:depart]).first - @department.update_attributes(:identifier => params[:identifier]) if @department.present? + identifier = params[:identifier].strip.blank? ? nil : params[:identifier].strip + @department.update_attributes(:identifier => identifier) if @department.present? end end diff --git a/app/models/school.rb b/app/models/school.rb index 081f3c0c..fd925f9a 100644 --- a/app/models/school.rb +++ b/app/models/school.rb @@ -64,7 +64,7 @@ class School < ActiveRecord::Base def statistic_url dep = departments.where("identifier is not null").first - url = dep.present? ? "/colleges/#{dep.identifier}/statistics" : "/colleges/#{self.id}/statistics" + url = dep.present? && !dep.identifier.blank? ? "/colleges/#{dep.identifier}/statistics" : "/colleges/#{self.id}/statistics" end def course_act_time