From bf74ba8108def9d50164235d13d315c65ea7afaa Mon Sep 17 00:00:00 2001 From: Lance Edgar Date: Thu, 7 Sep 2023 20:58:35 -0500 Subject: [PATCH] Ignore non-CORE equity payments when importing from CORE hopefully a good idea..? --- rattail_corepos/importing/corepos/db.py | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/rattail_corepos/importing/corepos/db.py b/rattail_corepos/importing/corepos/db.py index b9d7a3b..7957e8d 100644 --- a/rattail_corepos/importing/corepos/db.py +++ b/rattail_corepos/importing/corepos/db.py @@ -285,6 +285,17 @@ class MemberEquityPaymentImporter(FromCOREPOS, corepos_importing.model.MemberEqu query=query, key=key) + def cache_query(self): + query = super().cache_query() + model = self.model + + # ignore existing payments not known to be in CORE + # TODO: is this in fact a good idea? + query = query.join(model.CoreMemberEquityPayment)\ + .filter(model.CoreMemberEquityPayment.corepos_transaction_number != None) + + return query + def get_member(self, card_number): if hasattr(self, 'members_by_card_number'): return self.members_by_card_number.get(card_number)