Skip to content

Commit

Permalink
Update workspace last synced at fix (#578)
Browse files Browse the repository at this point in the history
  • Loading branch information
ruuushhh authored Mar 6, 2024
1 parent 39b385e commit 83ad5ad
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions apps/fyle/tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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)

Expand Down Expand Up @@ -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()
Expand Down

0 comments on commit 83ad5ad

Please sign in to comment.