申请学校的更改

This commit is contained in:
cxt 2016-08-01 13:57:55 +08:00
parent 87e3707b52
commit 3bc696a597
2 changed files with 27 additions and 7 deletions

View File

@ -676,7 +676,9 @@ class AdminController < ApplicationController
users.each do |user|
user.update_column("school_id", school[0].id)
end
aas.school.destroy
if aas.school_id != school[0].id.to_i
aas.school.destroy
end
aas.update_attribute(:school_id, school[0].id)
rescue Exception => e
puts e
@ -687,7 +689,7 @@ class AdminController < ApplicationController
end
def all_schools
apply_schools = ApplyAddSchools.where("status != 1")
apply_schools = ApplyAddSchools.where("status = 0")
apply_school_ids = apply_schools.empty? ? "(-1)" : "(" + apply_schools.map{|sc| sc.school_id}.join(',') + ")"
if !params[:search].nil?
search = "%#{params[:search].to_s.strip.downcase}%"

View File

@ -11,7 +11,7 @@
#
# It's strongly recommended to check this file into your version control system.
ActiveRecord::Schema.define(:version => 20160725091759) do
ActiveRecord::Schema.define(:version => 20160729124833) do
create_table "activities", :force => true do |t|
t.integer "act_id", :null => false
@ -52,9 +52,24 @@ ActiveRecord::Schema.define(:version => 20160725091759) do
add_index "api_keys", ["access_token"], :name => "index_api_keys_on_access_token"
add_index "api_keys", ["user_id"], :name => "index_api_keys_on_user_id"
create_table "applied_messages", :force => true do |t|
t.integer "user_id"
t.integer "applied_id"
t.string "applied_type"
t.integer "viewed", :default => 0
t.integer "status", :default => 0
t.datetime "created_at", :null => false
t.datetime "updated_at", :null => false
t.string "name"
t.integer "applied_user_id"
t.integer "role"
t.integer "project_id"
end
create_table "applied_projects", :force => true do |t|
t.integer "project_id", :null => false
t.integer "user_id", :null => false
t.integer "project_id", :null => false
t.integer "user_id", :null => false
t.integer "role", :default => 0
end
create_table "apply_add_schools", :force => true do |t|
@ -1106,9 +1121,10 @@ ActiveRecord::Schema.define(:version => 20160725091759) do
end
create_table "member_roles", :force => true do |t|
t.integer "member_id", :null => false
t.integer "role_id", :null => false
t.integer "member_id", :null => false
t.integer "role_id", :null => false
t.integer "inherited_from"
t.integer "is_current", :default => 1
end
add_index "member_roles", ["member_id"], :name => "index_member_roles_on_member_id"
@ -1539,6 +1555,8 @@ ActiveRecord::Schema.define(:version => 20160725091759) do
t.integer "boards_reply_count", :default => 0
t.integer "visits", :default => 0
t.integer "hot", :default => 0
t.string "invite_code"
t.string "qrcode"
end
add_index "projects", ["lft"], :name => "index_projects_on_lft"