Fix: Add pagination for e-conomic customers (max 1000 per page)
This commit is contained in:
parent
f6303fa804
commit
5d8617bed3
@ -310,9 +310,20 @@ async def sync_from_economic() -> Dict[str, Any]:
|
|||||||
from app.services.economic_service import EconomicService
|
from app.services.economic_service import EconomicService
|
||||||
economic = EconomicService()
|
economic = EconomicService()
|
||||||
|
|
||||||
# Get all customers from e-conomic
|
# Get all customers from e-conomic (max 1000 per page)
|
||||||
economic_customers = await economic.get_customers(page=0, page_size=10000)
|
all_customers = []
|
||||||
logger.info(f"📥 Fetched {len(economic_customers)} customers from e-conomic")
|
page = 0
|
||||||
|
while True:
|
||||||
|
customers = await economic.get_customers(page=page, page_size=1000)
|
||||||
|
if not customers:
|
||||||
|
break
|
||||||
|
all_customers.extend(customers)
|
||||||
|
page += 1
|
||||||
|
if len(customers) < 1000: # Last page
|
||||||
|
break
|
||||||
|
|
||||||
|
economic_customers = all_customers
|
||||||
|
logger.info(f"📥 Fetched {len(economic_customers)} customers from e-conomic ({page} pages)")
|
||||||
|
|
||||||
matched_count = 0
|
matched_count = 0
|
||||||
not_matched_count = 0
|
not_matched_count = 0
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user