Refactor CORE API hack to use custdata instead of Customers table

the older table seems more reliable?  at least i just ran across an
example where it was, albeit a demo..
This commit is contained in:
Lance Edgar 2022-01-08 19:49:51 -06:00
parent 802ffddc6d
commit e91fef0e8d

View file

@ -2,7 +2,7 @@
################################################################################ ################################################################################
# #
# Rattail -- Retail Software Framework # Rattail -- Retail Software Framework
# Copyright © 2010-2020 Lance Edgar # Copyright © 2010-2022 Lance Edgar
# #
# This file is part of Rattail. # This file is part of Rattail.
# #
@ -46,7 +46,7 @@ def get_core_members(api, progress=None):
# first we fetch all customer records from CORE DB # first we fetch all customer records from CORE DB
with short_session(Session=CoreSession) as s: with short_session(Session=CoreSession) as s:
db_customers = s.query(corepos.Customer).all() db_customers = s.query(corepos.CustData).all()
s.expunge_all() s.expunge_all()
# now we must fetch each customer account individually from API # now we must fetch each customer account individually from API
@ -59,7 +59,7 @@ def get_core_members(api, progress=None):
if member: if member:
members[dbcust.card_number] = member members[dbcust.card_number] = member
else: else:
logger = log.warning if dbcust.account_holder else log.debug logger = log.warning if dbcust.person_number == 1 else log.debug
logger("could not fetch member from CORE API: %s", logger("could not fetch member from CORE API: %s",
dbcust.card_number) dbcust.card_number)