Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Ajout d'attributs dans Brevo pour les structures #1513

Merged
merged 6 commits into from
Dec 9, 2024

Conversation

chloend
Copy link
Contributor

@chloend chloend commented Nov 11, 2024

Quoi ?

Partie 2 de la synchro Brevo, donc suite de la PR1468
Ajout d'attributs dans la liste des Structures dans Brevo.

Pourquoi ?

Pour segmenter les envois d’email marketing, et ne pas multiplier les listes sur Brevo.

Comment ?

En ajoutant 3 attributs dans siae.extra_data :

  • siae.completion_rate
  • siae.tender_email_send_count_annotated (besoins reçus les 90 derniers jours)
  • siae.tender_detail_contact_click_count_annotatedsiae.tender_detail_contact_click_count_annotated (nombre de fois qu'une structure est intéressée par un besoin ces 90 derniers jours)

Ces deux derniers attributs ne sont pas directement ceux de Siae mais des champs annotés dans un queryset de SiaeQueryset

Enfin, le dictionnaire est initialisé et/ou mis à jour dans la commande crm_brevo_sync_companies.

@chloend chloend changed the title feat : Ajout d'attributs dans Brevo pour les structures feat: Ajout d'attributs dans Brevo pour les structures Nov 11, 2024
@chloend chloend force-pushed the chloend/company-attributes branch 2 times, most recently from b38d41e to 7b0ab70 Compare November 17, 2024 17:27
@chloend chloend marked this pull request as ready for review November 17, 2024 17:33
Copy link
Contributor

@SebastienReuiller SebastienReuiller left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Des petits retours, essentiellement pour la lisibilité ;)

lemarche/siaes/models.py Outdated Show resolved Hide resolved
lemarche/siaes/models.py Outdated Show resolved Hide resolved
@chloend chloend force-pushed the chloend/company-attributes branch 2 times, most recently from 1c9faa8 to 8482909 Compare November 27, 2024 09:32
@SebastienReuiller SebastienReuiller self-requested a review November 28, 2024 09:26
Copy link
Contributor

@SebastienReuiller SebastienReuiller left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Top !

self.assertEqual(
siae_with_recent_stats.tender_detail_contact_click_count_annotated,
1,
"Les clics de contact récents dans les 90 jours devraient être 1",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Trop bien les messages sur les asserts !

@chloend chloend force-pushed the chloend/company-attributes branch 3 times, most recently from 7cd8329 to d92f5d9 Compare December 4, 2024 08:15
Copy link
Contributor

@madjid-asa madjid-asa left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Je te propose qu'on finalise ça ensemble demain, faudrait ajouter les nouveaux attributs sur brevo et juste les renommer comme il faut et on peut envoyer :)

@@ -146,6 +146,7 @@ def create_or_update_company(siae):
"geo_range": siae.geo_range,
"app_url": get_object_share_url(siae),
"app_admin_url": get_object_admin_url(siae),
**siae.extra_data, # includes completion_rate, tender_email_send_count, etc.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tu risque d'inclure des attributs en trop si tu fait ça, vaut mieux les nommé pour éviter d'ajouter d'autres attributs qu'il peut y avoir dans extra_data.


# extra_data update if needed
if siae.extra_data != new_extra_data:
siae.extra_data = new_extra_data
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

extra_data peut contenir d'autres attributs que ceux là, donc en faisant ça t'écrase les anciens attributs ^^ faudrait juste écraser les anciennes clés.

D'ailleurs je pense que les clés ne doivent pas correspondre dans Brevo, faut utiliser une notation de type TAUX_DE_COMPLETION sans accents :)

@@ -78,6 +79,24 @@ def get_city_filter(perimeter, with_country=False):
return filters


def count_field(field_name, date_limit):
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Jolie

@chloend chloend force-pushed the chloend/company-attributes branch from c3d5e1d to ae5db36 Compare December 5, 2024 14:13
@chloend chloend requested a review from madjid-asa December 5, 2024 14:17
}

# extra_data update if needed
if siae.extra_data != new_extra_data:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
if siae.extra_data != new_extra_data:
if siae.extra_data.get('brevo_company_data') != new_extra_data:

@chloend chloend requested a review from madjid-asa December 9, 2024 16:25
Copy link
Contributor

@madjid-asa madjid-asa left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM 🎉

@chloend chloend merged commit f41f5c5 into master Dec 9, 2024
8 checks passed
@chloend chloend deleted the chloend/company-attributes branch December 9, 2024 16:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants