From 802c8ab87b79ea501e262527da1802bd7f5c2b28 Mon Sep 17 00:00:00 2001 From: Lance Edgar Date: Wed, 14 Aug 2024 09:12:32 -0500 Subject: [PATCH] fix: work around, log error when datasync can't locate member --- rattail_corepos/datasync/rattail.py | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/rattail_corepos/datasync/rattail.py b/rattail_corepos/datasync/rattail.py index 5b6e925..18ff5dd 100644 --- a/rattail_corepos/datasync/rattail.py +++ b/rattail_corepos/datasync/rattail.py @@ -24,11 +24,16 @@ DataSync for Rattail DB """ +import logging + from sqlalchemy import orm from rattail.datasync import DataSyncImportConsumer +log = logging.getLogger(__name__) + + class FromCOREAPIToRattail(DataSyncImportConsumer): """ Consumer for CORE POS (API) -> Rattail datasync @@ -69,6 +74,11 @@ class FromCOREAPIToRattail(DataSyncImportConsumer): else: # import member data from API, into various Rattail tables member = self.get_host_object(session, change) + if not member: + # TODO: should log.warning() instead but for now i + # need to see this in action and further troubleshoot + log.error("CORE member not found for change: %s", change) + continue self.process_change(session, self.importers['Customer'], host_object=member) shoppers = self.importers['CustomerShopper'].get_shoppers_for_member(member)