commit
8c8d11706c
@ -1,6 +1,6 @@
|
||||
json.partial! 'shixuns/right', locals: { shixun: @shixun }
|
||||
|
||||
#json.follow follow?(@shixun.owner, User.current)
|
||||
#json.fans_count @fans_count
|
||||
#json.followed_count @followed_count
|
||||
json.follow follow?(@shixun.owner, User.current)
|
||||
json.fans_count @fans_count
|
||||
json.followed_count @followed_count
|
||||
json.user_shixuns_count @user_own_shixuns
|
||||
|
@ -1,34 +0,0 @@
|
||||
class DeleteIvalidData < ActiveRecord::Migration[5.2]
|
||||
def change
|
||||
users = User.find_by_sql("select count(*) as user_count, login from users group by login having user_count>1")
|
||||
users.each do |user|
|
||||
valid_users = User.where(login: user.login)
|
||||
valid_users.each do |valid_user|
|
||||
unless valid_user.lastname.present?
|
||||
valid_user.delete
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
mail_users = User.find_by_sql("select count(*) as user_count, mail from users where mail is not null group by mail having user_count>1")
|
||||
mail_users.each do |mail_user|
|
||||
valid_mail_users = User.where(mail: mail_user.mail)
|
||||
valid_mail_users.each do |valid_mail_user|
|
||||
unless valid_mail_user.lastname.present?
|
||||
valid_mail_user.delete
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
phone_users = User.find_by_sql("select count(*) as user_count, phone from users where phone is not null group by phone having user_count>1")
|
||||
phone_users.each do |phone_user|
|
||||
valid_phone_users = User.where(phone: phone_user.phone)
|
||||
valid_phone_users.each do |valid_phone_user|
|
||||
unless valid_phone_user.lastname.present?
|
||||
valid_phone_user.delete
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
@ -0,0 +1,34 @@
|
||||
class SyncIvalidUsers < ActiveRecord::Migration[5.2]
|
||||
# def change
|
||||
# users = User.where.not(id: 2).find_by_sql("select count(*) as user_count, login from users group by login having user_count>1")
|
||||
# users.each do |user|
|
||||
# valid_users = User.where(login: user.login)
|
||||
# valid_users.each do |valid_user|
|
||||
# unless valid_user.lastname.present?
|
||||
# valid_user.delete
|
||||
# end
|
||||
# end
|
||||
# end
|
||||
#
|
||||
# mail_users = User.where.not(id: 2).find_by_sql("select count(*) as user_count, mail from users where mail is not null group by mail having user_count>1")
|
||||
# mail_users.each do |mail_user|
|
||||
# valid_mail_users = User.where(mail: mail_user.mail)
|
||||
# valid_mail_users.each do |valid_mail_user|
|
||||
# unless valid_mail_user.lastname.present?
|
||||
# valid_mail_user.delete
|
||||
# end
|
||||
# end
|
||||
# end
|
||||
#
|
||||
#
|
||||
# phone_users = User.where.not(id: 2).find_by_sql("select count(*) as user_count, phone from users where phone is not null group by phone having user_count>1")
|
||||
# phone_users.each do |phone_user|
|
||||
# valid_phone_users = User.where(phone: phone_user.phone)
|
||||
# valid_phone_users.each do |valid_phone_user|
|
||||
# unless valid_phone_user.lastname.present?
|
||||
# valid_phone_user.delete
|
||||
# end
|
||||
# end
|
||||
# end
|
||||
# end
|
||||
end
|
@ -1,16 +1,15 @@
|
||||
class ModifyScriptAndDescriptionForShixuninfo < ActiveRecord::Migration[5.2]
|
||||
def change
|
||||
Shixun.find_each do |shixun|
|
||||
if shixun.shixun_info
|
||||
shixun.shixun_info.update_attributes(propaedeutics: shixun[:propaedeutics],
|
||||
description: shixun[:description],
|
||||
evaluate_script: shixun[:evaluate_script],
|
||||
shixun_id: shixun[:id])
|
||||
else
|
||||
ShixunInfo.create!(propaedeutics: shixun[:propaedeutics], description: shixun[:description],
|
||||
evaluate_script: shixun[:evaluate_script], shixun_id: shixun.id)
|
||||
end
|
||||
end
|
||||
remove_columns :shixuns, :description, :propaedeutics, :evaluate_script
|
||||
end
|
||||
end
|
||||
class ModifyShixunInfoForShixuns < ActiveRecord::Migration[5.2]
|
||||
def change
|
||||
Shixun.find_each do |shixun|
|
||||
if shixun.shixun_info
|
||||
shixun.shixun_info.update_attributes(propaedeutics: shixun[:propaedeutics],
|
||||
description: shixun[:description],
|
||||
evaluate_script: shixun[:evaluate_script],
|
||||
shixun_id: shixun[:id])
|
||||
else
|
||||
ShixunInfo.create!(propaedeutics: shixun[:propaedeutics], description: shixun[:description],
|
||||
evaluate_script: shixun[:evaluate_script], shixun_id: shixun.id)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
@ -0,0 +1,7 @@
|
||||
class RemoveShixunLongTextForShixuns < ActiveRecord::Migration[5.2]
|
||||
def change
|
||||
if Shixun.first.has_attribute?(:description)
|
||||
remove_columns :shixuns, :description, :propaedeutics, :evaluate_script
|
||||
end
|
||||
end
|
||||
end
|
Loading…
Reference in new issue