Skip to content

Commit

Permalink
update formentry.status to include MANUALLY_PERSISTED
Browse files Browse the repository at this point in the history
  • Loading branch information
alesanchezr committed Sep 24, 2024
1 parent f993415 commit ba19a1a
Show file tree
Hide file tree
Showing 3 changed files with 39 additions and 2 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
# Generated by Django 5.1.1 on 2024-09-24 16:29

from django.db import migrations, models


class Migration(migrations.Migration):

dependencies = [
("marketing", "0086_coursetranslation_landing_variables"),
]

operations = [
migrations.AlterField(
model_name="formentry",
name="storage_status",
field=models.CharField(
choices=[
("PENDING", "Pending"),
("PERSISTED", "Persisted"),
("REJECTED", "Rejected"),
("DUPLICATED", "Duplicated"),
("ERROR", "Error"),
],
default="PENDING",
help_text="MANUALLY_PERSISTED means it was copy pasted into active campaign",
max_length=15,
),
),
]
8 changes: 7 additions & 1 deletion breathecode/marketing/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -283,6 +283,7 @@ def save(self, *args, **kwargs):
DUPLICATED = "DUPLICATED"
REJECTED = "REJECTED"
ERROR = "ERROR"
MANUAL = "MANUALLY_PERSISTED"
STORAGE_STATUS = (
(PENDING, "Pending"),
(PERSISTED, "Persisted"),
Expand Down Expand Up @@ -402,7 +403,12 @@ def __init__(self, *args, **kwargs):
sex = models.CharField(max_length=15, null=True, default=None, blank=True, help_text="M=male,F=female,O=other")

# is it saved into active campaign?
storage_status = models.CharField(max_length=15, choices=STORAGE_STATUS, default=PENDING)
storage_status = models.CharField(
max_length=15,
choices=STORAGE_STATUS,
default=PENDING,
help_text="MANUALLY_PERSISTED means it was copy pasted into active campaign",
)
storage_status_text = models.CharField(
default="",
blank=True,
Expand Down
4 changes: 3 additions & 1 deletion breathecode/services/activecampaign/actions/deal_add.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,9 @@ def deal_add(self, webhook, payload: dict, acp_ids):
if entry is None and "deal[contact_email]" in payload:
entry = (
FormEntry.objects.filter(
email=payload["deal[contact_email]"], ac_deal_id__isnull=True, storage_status="PERSISTED"
email=payload["deal[contact_email]"],
ac_deal_id__isnull=True,
storage_status__in=["PERSISTED", "MANUALLY_PERSISTED"],
)
.order_by("-created_at")
.first()
Expand Down

0 comments on commit ba19a1a

Please sign in to comment.