This commit is contained in:
Nicolas Bally 2021-06-11 16:03:54 +02:00
parent a7744aa439
commit fcedb9ceaf

View File

@ -18,9 +18,9 @@ class Societe < ApplicationRecord
VContact.update_all(:last_volume_at => nil, :enabled => false, :prime => nil, :ac_rate => nil, :cagnotte => nil, :cumul => nil, :prime => nil) VContact.update_all(:last_volume_at => nil, :enabled => false, :prime => nil, :ac_rate => nil, :cagnotte => nil, :cumul => nil, :prime => nil)
VContact.where(:codeproprietaire => self.valid_codes).update_all(:enabled => true) VContact.where(:codeproprietaire => self.valid_codes).update_all(:enabled => true)
puts "Purge contact" puts "Purge contact"
ActiveRecord::Base.connection.execute("DELETE FROM v_contacts WHERE enabled = 0;") #ActiveRecord::Base.connection.execute("DELETE FROM v_contacts WHERE enabled = 0;")
puts "Purge Volume periodique" puts "Purge Volume periodique"
VolumePeriodique.where("codemanaginn not in(?)", VContact.select(:codemanaginn).group(:codemanaginn).map {|c| c.codemanaginn}).delete_all #VolumePeriodique.where("codemanaginn not in(?)", VContact.select(:codemanaginn).group(:codemanaginn).map {|c| c.codemanaginn}).delete_all
return true return true