Skip to content

Commit

Permalink
fix: while syncing expenses, include expenses from 5 minutes before l…
Browse files Browse the repository at this point in the history
…ast sync
  • Loading branch information
JustARatherRidiculouslyLongUsername committed Nov 15, 2024
1 parent bed197e commit c8dd139
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion apps/fyle/tasks.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import logging
import traceback
from datetime import datetime
from datetime import datetime, timedelta
from typing import Dict, List

from django.db import transaction
Expand Down Expand Up @@ -88,6 +88,9 @@ def async_create_expense_groups(
expenses = []
reimbursable_expenses_count = 0

if last_synced_at:
last_synced_at = last_synced_at - timedelta(minutes=5)

if FundSourceEnum.PERSONAL in fund_source:
expenses.extend(
platform.expenses.get(
Expand All @@ -108,6 +111,9 @@ def async_create_expense_groups(
workspace.last_synced_at = datetime.now()
reimbursable_expenses_count += len(expenses)

if ccc_last_synced_at:
ccc_last_synced_at = ccc_last_synced_at - timedelta(minutes=5)

if FundSourceEnum.CCC in fund_source:
expenses.extend(
platform.expenses.get(
Expand Down

0 comments on commit c8dd139

Please sign in to comment.