fix save school fail bug

dev_ec
p31729568 6 years ago
parent 2374e6f31c
commit 5360ed4d3a

@ -31,9 +31,9 @@ class CollegesController < ApplicationController
end
def verification_school_identifier
school = School.where(:identifier => params[:identifier]).first
status = school.present? ? 1 : 0
render :json => {status: status}
schools = School.where(identifier: params[:identifier])
schools = schools.where('id != ?', params[:school_id]) if params[:school_id].present?
render :json => { status: schools.exists? ? 1 : 0 }
end
def online_school

@ -4,8 +4,8 @@ class Managements::SchoolsController < Managements::BaseController
def statistics
@sub_type = 1
params[:sort_by] = :teacher_count if params[:sort_by].blank?
params[:sort_direction] = :desc if params[:sort_direction].blank?
params[:sort_by] = params[:sort_by].presence || :teacher_count
params[:sort_direction] = params[:sort_direction].presence || :desc
service = Management::SchoolReportService.new(params)
@obj_count, @schools = service.call
@ -20,8 +20,8 @@ class Managements::SchoolsController < Managements::BaseController
def data_grow
@sub_type = 2
params[:data_type] ||= 'grow'
params[:sort_by] = :teacher_increase_count if params[:sort_by].blank?
params[:sort_direction] = :desc if params[:sort_direction].blank?
params[:sort_by] = params[:sort_by].presence || :teacher_increase_count
params[:sort_direction] = params[:sort_direction].presence || :desc
service = Management::SchoolDataGrowService.new(params)
@grow_summary = service.grow_summary
@ -31,7 +31,7 @@ class Managements::SchoolsController < Managements::BaseController
end
def data_contrast
params[:contrast_column] = :teacher_increase_count if params[:contrast_column].blank?
params[:contrast_column] = params[:contrast_column].presence || :teacher_increase_count
params[:sort_direction] ||= :desc
params[:sort_by] = :percentage

@ -1518,7 +1518,7 @@ end
if search.blank?
@schools = School.where("0=0")
else
@schools = School.where("name like '%#{search}%'")
@schools = School.where("name like ?", "%#{search}%")
end
if params[:index] == '8'
@schools = @schools.reorder("created_at #{@sx_order}")

@ -130,7 +130,10 @@
if($("#unit_head_route").val().trim() !=""){
$.ajax({
url: "<%= verification_school_identifier_colleges_path %>",
data: {identifier: $("#unit_head_route").val().trim()},
data: {
school_id: <%= @school.id %>,
identifier: $("#unit_head_route").val().trim()
},
async:false,
success: function (data) {
if(data.status == 0){

Loading…
Cancel
Save