Merge branch 'dev'

This commit is contained in:
gregoirenovel 2018-06-07 16:13:16 +02:00
commit 4d7a114f3c
7 changed files with 12 additions and 12 deletions

View file

@ -10,7 +10,7 @@ module Manager
if administrateur.errors.empty? if administrateur.errors.empty?
PipedriveAcceptsDealsJob.perform_later( PipedriveAcceptsDealsJob.perform_later(
create_administrateur_params[:person_id], create_administrateur_params[:person_id],
Pipedrive::DealAdapter::PIPEDRIVE_CAMILLE_ID, current_administration.id,
create_administrateur_params[:stage_id] create_administrateur_params[:stage_id]
) )
@ -26,7 +26,7 @@ module Manager
def refuse_administrateur def refuse_administrateur
PipedriveRefusesDealsJob.perform_later( PipedriveRefusesDealsJob.perform_later(
refuse_administrateur_params[:person_id], refuse_administrateur_params[:person_id],
Pipedrive::DealAdapter::PIPEDRIVE_CAMILLE_ID current_administration.id
) )
AdministrationMailer AdministrationMailer

View file

@ -1,5 +1,5 @@
class PipedriveAcceptsDealsJob < ApplicationJob class PipedriveAcceptsDealsJob < ApplicationJob
def perform(person_id, owner_id, stage_id) def perform(person_id, administration_id, stage_id)
PipedriveService.accept_demande_from_person(person_id, owner_id, stage_id) PipedriveService.accept_demande_from_person(person_id, administration_id, stage_id)
end end
end end

View file

@ -1,5 +1,5 @@
class PipedriveRefusesDealsJob < ApplicationJob class PipedriveRefusesDealsJob < ApplicationJob
def perform(person_id, owner_id) def perform(person_id, administration_id)
PipedriveService.refuse_demande_from_person(person_id, owner_id) PipedriveService.refuse_demande_from_person(person_id, administration_id)
end end
end end

View file

@ -10,8 +10,6 @@ class Pipedrive::DealAdapter
PIPEDRIVE_LOST_STATUS = "lost" PIPEDRIVE_LOST_STATUS = "lost"
PIPEDRIVE_LOST_REASON = "refusé depuis DS" PIPEDRIVE_LOST_REASON = "refusé depuis DS"
PIPEDRIVE_CAMILLE_ID = '3189424'
def self.refuse_deal(deal_id, owner_id) def self.refuse_deal(deal_id, owner_id)
params = { params = {
user_id: owner_id, user_id: owner_id,

View file

@ -1,11 +1,13 @@
class PipedriveService class PipedriveService
def self.accept_demande_from_person(person_id, owner_id, stage_id) def self.accept_demande_from_person(person_id, administration_id, stage_id)
owner_id = BizDev.pipedrive_id(administration_id)
person_deals_ids = Pipedrive::DealAdapter.get_deals_ids_for_person(person_id) person_deals_ids = Pipedrive::DealAdapter.get_deals_ids_for_person(person_id)
person_deals_ids.each { |deal_id| Pipedrive::DealAdapter.update_deal_owner_and_stage(deal_id, owner_id, stage_id) } person_deals_ids.each { |deal_id| Pipedrive::DealAdapter.update_deal_owner_and_stage(deal_id, owner_id, stage_id) }
Pipedrive::PersonAdapter.update_person_owner(person_id, owner_id) Pipedrive::PersonAdapter.update_person_owner(person_id, owner_id)
end end
def self.refuse_demande_from_person(person_id, owner_id) def self.refuse_demande_from_person(person_id, administration_id)
owner_id = BizDev.pipedrive_id(administration_id)
person_deals_ids = Pipedrive::DealAdapter.get_deals_ids_for_person(person_id) person_deals_ids = Pipedrive::DealAdapter.get_deals_ids_for_person(person_id)
person_deals_ids.each { |deal_id| Pipedrive::DealAdapter.refuse_deal(deal_id, owner_id) } person_deals_ids.each { |deal_id| Pipedrive::DealAdapter.refuse_deal(deal_id, owner_id) }
Pipedrive::PersonAdapter.update_person_owner(person_id, owner_id) Pipedrive::PersonAdapter.update_person_owner(person_id, owner_id)

View file

@ -1,4 +1,4 @@
namespace :'2018_06_05_resend_attestation' do namespace :'2018_06_05_resend_attestations' do
task set: :environment do task set: :environment do
procedure = Procedure.find(4247) procedure = Procedure.find(4247)
dossiers = procedure.dossiers.includes(:attestation).where(state: 'accepte').select do |d| dossiers = procedure.dossiers.includes(:attestation).where(state: 'accepte').select do |d|

View file

@ -29,7 +29,7 @@ namespace :'2018_06_05_send_new_attestation' do
41103 41103
] ]
dossiers = ids.map { |id| Dossier.Dossier.find_by(id: id) }.compact dossiers = ids.map { |id| Dossier.find_by(id: id) }.compact
dossiers.each do |dossier| dossiers.each do |dossier|
attestation = dossier.attestation attestation = dossier.attestation