diff --git a/apps/fyle/tasks.py b/apps/fyle/tasks.py index 4df3eda1..56536379 100644 --- a/apps/fyle/tasks.py +++ b/apps/fyle/tasks.py @@ -3,10 +3,8 @@ from typing import Dict, List from django.db import transaction -from fyle.platform.exceptions import ( - InvalidTokenError as FyleInvalidTokenError, - RetryException -) +from fyle.platform.exceptions import InvalidTokenError as FyleInvalidTokenError +from fyle.platform.exceptions import RetryException from fyle_integrations_platform_connector import PlatformConnector from apps.fyle.actions import create_generator_and_post_in_batches, mark_expenses_as_skipped @@ -110,7 +108,7 @@ def async_create_expense_groups(workspace_id: int, fund_source: List[str], task_ expenses.extend(platform.expenses.get(source_account_type=['PERSONAL_CASH_ACCOUNT'], state=expense_group_settings.expense_state, settled_at=settled_at, filter_credit_expenses=filter_credit_expenses, last_paid_at=last_paid_at)) - if expenses: + if workspace.last_synced_at or expenses: workspace.last_synced_at = datetime.now() reimbursable_expense_count += len(expenses) @@ -138,7 +136,7 @@ def async_create_expense_groups(workspace_id: int, fund_source: List[str], task_ ) ) - if len(expenses) != reimbursable_expense_count: + if workspace.ccc_last_synced_at or len(expenses) != reimbursable_expense_count: workspace.ccc_last_synced_at = datetime.now() workspace.save()