From 3612347adf1a17ea5dab1da78d450c2beb85facb Mon Sep 17 00:00:00 2001 From: Elemar Rodrigues Severo Junior Date: Fri, 10 Jan 2025 17:34:07 -0300 Subject: [PATCH] Update .gitignore and improve Pipedrive client error handling - Added new timesheet files to .gitignore to prevent them from being tracked. - Enhanced error handling in the Pipedrive client by adding a check for None data in the fetched results, improving robustness. - Updated sorting logic in DealsPage to handle potential undefined client names, ensuring consistent behavior. These changes enhance the project's maintainability and error resilience. --- .gitignore | 13 +++++++++++++ .../src/omni_models/syntactic/pipedrive/client.py | 3 +++ frontend/src/app/about-us/deals/page.tsx | 2 +- 3 files changed, 17 insertions(+), 1 deletion(-) diff --git a/.gitignore b/.gitignore index aaa2f8b4..0a3ebf8f 100644 --- a/.gitignore +++ b/.gitignore @@ -105,6 +105,7 @@ src/flask_session/ nb/cache/ src/cache/ + frontend/yarn.lock # Uncomment if you're using Poetry # poetry.lock @@ -115,3 +116,15 @@ frontend/yarn.lock # Uncomment if you're using PDM # pdm.lock # .pdm.toml +ts_2024/abr_2024.timesheet +ts_2024/ago_2024.timesheet +ts_2024/dez_2024.timesheet +ts_2024/fev_2024.timesheet +ts_2024/jan_2024.timesheet +ts_2024/jul_2024.timesheet +ts_2024/jun_2024.timesheet +ts_2024/mai_2024.timesheet +ts_2024/mar_2024.timesheet +ts_2024/nov_2024.timesheet +ts_2024/out_2024.timesheet +ts_2024/set_2024.timesheet diff --git a/backend/models/src/omni_models/syntactic/pipedrive/client.py b/backend/models/src/omni_models/syntactic/pipedrive/client.py index 7d606d6b..35bacde4 100644 --- a/backend/models/src/omni_models/syntactic/pipedrive/client.py +++ b/backend/models/src/omni_models/syntactic/pipedrive/client.py @@ -59,6 +59,9 @@ def _fetch_all(self, entity, params=None): data = self.__fetch(entity, start, params) if data is None or 'data' not in data: break + if data['data'] is None: + break + all_data.extend(data['data']) if not self.__has_next_page(data): diff --git a/frontend/src/app/about-us/deals/page.tsx b/frontend/src/app/about-us/deals/page.tsx index ffe90c85..f8d0e220 100644 --- a/frontend/src/app/about-us/deals/page.tsx +++ b/frontend/src/app/about-us/deals/page.tsx @@ -338,7 +338,7 @@ export default function DealsPage() { acc.push({ clientName, deals: [deal] }); } return acc; - }, []).sort((a, b) => a.clientName.localeCompare(b.clientName)); + }, []).sort((a, b) => a.clientName?.localeCompare(b.clientName)); }; const groupedProspects = groupDeals(prospects);