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

fix: Changement de conditions de synchronisation des DDB vers le crm brevo #1622

Open
wants to merge 5 commits into
base: master
Choose a base branch
from

Conversation

madjid-asa
Copy link
Contributor

Quoi ?

Changement de conditions de synchronisation des DDB vers le crm brevo. Au lieu de synchroniser par rapport au montant, on synchronise juste si l'attribut is_followed_by_us=True

Pourquoi ?

Certains cas sont compliqué à jugé sur le prix dans un premier temps.

@madjid-asa madjid-asa requested review from Guilouf and chloend January 2, 2025 12:02
@madjid-asa madjid-asa self-assigned this Jan 2, 2025
lemarche/tenders/tests/test_admin.py Outdated Show resolved Hide resolved
lemarche/tenders/tests/test_admin.py Show resolved Hide resolved
lemarche/tenders/tests/test_admin.py Outdated Show resolved Hide resolved
lemarche/tenders/admin.py Show resolved Hide resolved
Comment on lines +263 to +274
proj_resulted_in_reserved_tender = forms.BooleanField(
widget=forms.CheckboxInput(),
required=False,
label=Tender._meta.get_field("proj_resulted_in_reserved_tender").verbose_name,
)

is_reserved_tender = forms.BooleanField(
widget=forms.CheckboxInput(),
required=False,
label=Tender._meta.get_field("is_reserved_tender").verbose_name,
)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

ça sort un peu du cadre de la PR mais c'est un petit quick win pour faciliter la saisie pour les bizdev

# Full message expected: duplicate key value violates unique constraint "tenders_tender_slug_0f0b821f_uniq" DETAIL: Key (slug)=(...) already exists. # noqa
if "tenders_tender_slug" in str(e):
self.set_slug(with_uuid=True)
with transaction.atomic():
Copy link
Collaborator

Choose a reason for hiding this comment

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

Je ne vois pas à quoi sert la transaction; s'il y a une erreur de contrainte d'intégrité, il n'y aura pas de commit du SQL ?

self.admin = TenderAdmin(Tender, self.admin_site)

def setUpRequest(self, tender, is_followed_by_us):
tender.is_followed_by_us = is_followed_by_us
Copy link
Collaborator

Choose a reason for hiding this comment

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

Est ce que c'est utile ? Si j'ai bien compris c'est déjà set par la factory, pourquoi le reset et refaire un save()?
Normalement tu pourrais définir ta request dans le setup, et l'appeler avec un self.request, pas besoin des args tender et is_followed_by_us

# Initialize and apply SessionMiddleware
middleware = SessionMiddleware(get_response)
middleware.process_request(request)
request.session.save() # Save the session to avoid any issues
Copy link
Collaborator

Choose a reason for hiding this comment

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

Ca marche sans, je dirais que le moins c'est le mieux ;)

self.assertIn(".", response.url)

# Verify the flash messages
messages = request._messages._queued_messages
Copy link
Collaborator

Choose a reason for hiding this comment

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

Ca marche, mais ce sont des attributs privés, la voie "officielle" c'est celle là j'ai l'impression https://docs.djangoproject.com/en/5.1/ref/contrib/messages/#django.contrib.messages.get_messages

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.

2 participants