Skip to content

Commit 6845e1d

Browse files
fix: use global id for user sync filtering (#2992)
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
1 parent d9a8503 commit 6845e1d

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

hubspot_sync/tasks.py

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -387,11 +387,12 @@ def batch_upsert_hubspot_objects( # pylint:disable=too-many-arguments # noqa:
387387
id__in=[id[0] for id in synced_object_ids] # noqa: A001
388388
)
389389
if model_name == "user":
390-
unsynced_objects = (
391-
unsynced_objects.filter(is_active=True, email__contains="@")
392-
.exclude(social_auth__isnull=True)
393-
.order_by(F("hubspot_sync_datetime").asc(nulls_first=True))
394-
)
390+
unsynced_objects = unsynced_objects.filter(
391+
is_active=True,
392+
email__contains="@",
393+
global_id__isnull=False,
394+
last_login__isnull=False,
395+
).order_by(F("hubspot_sync_datetime").asc(nulls_first=True))
395396
unsynced_object_ids = unsynced_objects.values_list("id", flat=True)
396397
object_ids = unsynced_object_ids if create else synced_object_ids
397398
elif not create:

0 commit comments

Comments
 (0)