Closed PrenSJ2 closed 4 months ago
Attention: Patch coverage is 93.90244%
with 5 lines
in your changes missing coverage. Please review.
Project coverage is 93.86%. Comparing base (
ed2cefa
) to head (fd16a05
). Report is 11 commits behind head on main.
Files | Patch % | Lines |
---|---|---|
app/pipedrive/_schema.py | 92.98% | 1 Missing and 3 partials :warning: |
app/pipedrive/views.py | 96.00% | 0 Missing and 1 partial :warning: |
:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.
Fix #188
The Problem
The sales team often merge Pipedrive Objects (Organizations, Persons, Deals)
this causes the custom field
hermes_id
to be combined 123 --> '123, 456'which in turn causes a validation error as we are expecting the
hermes_id
to be typeFK_FIELD
which is anint
Solution
In
PipedriveEvent
vaidate_obj
, ifhermes_id
is astr
we use the newly createdhandle_duplicate_hermes_ids
to select a main object and update all the associated objects to have the main object idTesting
make restore-from-live
python -m uvicorn app.main:app --reload
localhost:8000/pipedrive/callback/
Test Deal
meeting/create
/pipedrive/callback/
with:check that the deal id for the newly created meeting is now 5712 check that the deal you created has been deleted
Testing Organisation
/contact/create
/deal/create
/pipedrive/callback/
{ "v": 1, "matches_filters": { "current": [] }, "meta": { "action": "updated", "object": "person" }, "current": { "id": 29664, "im": [ { "value": "", "primary": true } ], "name": "Test Person", "email": [ { "label": "work", "value": "test_person@example.com", "primary": true } ], "label": null, "notes": null, "phone": [ { "label": "", "value": "61 666666666", "primary": true } ], "org_id": 7578, "add_time": "2024-05-13 06:40:18", "birthday": null, "cc_email": "tutorcruncher@pipedrivemail.com", "obj_type": "person", "org_name": "Tutor Company", "owner_id": 15761943, "job_title": null, "label_ids": [], "last_name": "Owner", "company_id": 11324733, "doi_status": 1, "first_char": "p", "first_name": "Tutor", "owner_name": "Sam", "picture_id": null, "visible_to": "3", "active_flag": true, "delete_time": null, "files_count": 0, "notes_count": 1, "update_time": "2024-05-23 15:42:03", "postal_address": null, "followers_count": 1, "picture_128_url": null, "won_deals_count": 0, "activities_count": 0, "last_activity_id": null, "lost_deals_count": 0, "marketing_status": "no_consent", "next_activity_id": null, "open_deals_count": 1, "closed_deals_count": 0, "last_activity_date": null, "next_activity_date": null, "next_activity_time": null, "email_messages_count": 3, "postal_address_route": null, "done_activities_count": 0, "postal_address_country": null, "last_incoming_mail_time": "2024-05-13 10:32:54", "last_outgoing_mail_time": "2024-05-23 15:41:56", "postal_address_locality": null, "related_won_deals_count": 0, "undone_activities_count": 0, "related_lost_deals_count": 0, "related_open_deals_count": 0, "postal_address_subpremise": null, "postal_address_postal_code": null, "postal_address_sublocality": null, "related_closed_deals_count": 0, "participant_open_deals_count": 0, "postal_address_street_number": null, "participant_closed_deals_count": 0, "postal_address_formatted_address": null, "postal_address_admin_area_level_1": null, "postal_address_admin_area_level_2": null, "00230e1468e98ca253e39870d14256cfc8b77514": null, "5b1e493cfb81e5817c481b149b3b32891bdf3312": null, "8c2f326b6be255cd3d5cf4ee7385eaf544a47f1d": "89348", "c1c3c51f1a26713b786a5274e450e997fd0c813b": null, "c2cce53d5a10e5124154a4cabc0aaf4199e4d94d": null, "c52a0f158c49ae8a2c428ac4fdc5575554e3760c": null, "c608baee9f204e6a09e5c741dc8159e9295c1dbb": null, "ccefbc26a1f2c753e467440c7420e7342e761c44": null, "f11fc7f795d827ef2edb02e729599ca291b77311": null } , "previous": { "id": 29664, "im": [ { "value": "", "primary": true } ], "name": "Test Person", "email": [ { "label": "work", "value": "test_person@example.com", "primary": true } ], "label": null, "notes": null, "phone": [ { "label": "", "value": "61 666666666", "primary": true } ], "org_id": 7578, "add_time": "2024-05-13 06:40:18", "birthday": null, "cc_email": "tutorcruncher@pipedrivemail.com", "obj_type": "person", "org_name": "Tutor Company", "owner_id": 15761943, "job_title": null, "label_ids": [], "last_name": "Owner", "company_id": 11324733, "doi_status": 1, "first_char": "p", "first_name": "Tutor", "owner_name": "Sam", "picture_id": null, "visible_to": "3", "active_flag": true, "delete_time": null, "files_count": 0, "notes_count": 1, "update_time": "2024-05-23 15:42:03", "postal_address": null, "followers_count": 1, "picture_128_url": null, "won_deals_count": 0, "activities_count": 0, "last_activity_id": null, "lost_deals_count": 0, "marketing_status": "no_consent", "next_activity_id": null, "open_deals_count": 1, "closed_deals_count": 0, "last_activity_date": null, "next_activity_date": null, "next_activity_time": null, "email_messages_count": 3, "postal_address_route": null, "done_activities_count": 0, "postal_address_country": null, "last_incoming_mail_time": "2024-05-13 10:32:54", "last_outgoing_mail_time": "2024-05-23 15:41:56", "postal_address_locality": null, "related_won_deals_count": 0, "undone_activities_count": 0, "related_lost_deals_count": 0, "related_open_deals_count": 0, "postal_address_subpremise": null, "postal_address_postal_code": null, "postal_address_sublocality": null, "related_closed_deals_count": 0, "participant_open_deals_count": 0, "postal_address_street_number": null, "participant_closed_deals_count": 0, "postal_address_formatted_address": null, "postal_address_admin_area_level_1": null, "postal_address_admin_area_level_2": null, "00230e1468e98ca253e39870d14256cfc8b77514": null, "5b1e493cfb81e5817c481b149b3b32891bdf3312": null, "8c2f326b6be255cd3d5cf4ee7385eaf544a47f1d": "89348, {new_person_id}", // hermes id "c1c3c51f1a26713b786a5274e450e997fd0c813b": null, "c2cce53d5a10e5124154a4cabc0aaf4199e4d94d": null, "c52a0f158c49ae8a2c428ac4fdc5575554e3760c": null, "c608baee9f204e6a09e5c741dc8159e9295c1dbb": null, "ccefbc26a1f2c753e467440c7420e7342e761c44": null, "f11fc7f795d827ef2edb02e729599ca291b77311": null }, "event": "updated.person" }