Merge pull request #5337 from betagouv/fix-broken-empty-demandes-screen

fix demandes adapter when no demandes
This commit is contained in:
Keirua 2020-07-07 10:04:41 +02:00 committed by GitHub
commit 11b9847a33
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -6,7 +6,10 @@ class Pipedrive::PersonAdapter
PIPEDRIVE_ROBOT_ID = '11381160'
def self.get_demandes_from_persons_owned_by_robot
Pipedrive::API.get_persons_owned_by_user(PIPEDRIVE_ROBOT_ID).map do |datum|
demandes = Pipedrive::API.get_persons_owned_by_user(PIPEDRIVE_ROBOT_ID)
if demandes.present?
demandes.map do |datum|
{
person_id: datum['id'],
nom: datum['name'],
@ -18,6 +21,9 @@ class Pipedrive::PersonAdapter
deadline: datum[PIPEDRIVE_DEADLINE_ATTRIBUTE_ID]
}
end
else
[]
end
end
def self.update_person_owner(person_id, owner_id)