删除gpid为空的myshixun

dev_shixuns
daiao 6 years ago
parent 102f967b51
commit 729c079738

@ -384,7 +384,7 @@ class ShixunsController < ApplicationController
shixun_id = shixun_id & my_shixun_ids shixun_id = shixun_id & my_shixun_ids
end end
@shixuns = Shixun.select([:id, :name, :user_id, :challenges_count, :visits, :status, :myshixuns_count, :trainee, :use_scope, :identifier, :image_text]).where(:id => shixun_id, :hidden => 0, :trainee => diff, :status => status).includes(:challenges, :schools, :shixun_members, :users) @shixuns = Shixun.select([:id, :name, :user_id, :challenges_count, :visits, :status, :myshixuns_count, :trainee, :use_scope, :identifier, :image_text, :averge_star]).where(:id => shixun_id, :hidden => 0, :trainee => diff, :status => status).includes(:challenges, :schools, :shixun_members, :users)
if search.present? if search.present?
search_users_id = User.select([:id]).where("concat(lastname, firstname) like '%#{search}%'") search_users_id = User.select([:id]).where("concat(lastname, firstname) like '%#{search}%'")

@ -0,0 +1,11 @@
namespace :myshixun do
desc "delete gpid is no"
task :delete_error_myshixuns => :environment do
begin
myshixuns = Myshixun.where(gpid: nil)
myshixuns.delete_all
rescue Exception => e
puts e
end
end
end
Loading…
Cancel
Save