Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rm chain poc #377

Closed
wants to merge 3 commits into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 5 additions & 7 deletions apps/xero/queue.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

from django.db.models import Q
from django_q.models import Schedule
from django_q.tasks import Chain
from django_q.tasks import async_task
from xerosdk.exceptions import InvalidGrant, UnsuccessfulAuthentication

from apps.fyle.models import Expense, ExpenseGroup
Expand Down Expand Up @@ -94,16 +94,14 @@ def __create_chain_and_run(fyle_credentials: FyleCredential, xero_connection, in
:param fund_source: Fund source
:return: None
"""
chain = Chain()
chain.append("apps.fyle.tasks.sync_dimensions", fyle_credentials, True)
async_task("apps.fyle.tasks.sync_dimensions", fyle_credentials, True)

chain.append('apps.xero.tasks.update_expense_and_post_summary', in_progress_expenses, workspace_id, fund_source)
async_task('apps.xero.tasks.update_expense_and_post_summary', in_progress_expenses, workspace_id, fund_source)

for task in chain_tasks:
chain.append(task['target'], task['expense_group_id'], task['task_log_id'], xero_connection, task['last_export'])
async_task(task['target'], task['expense_group_id'], task['task_log_id'], xero_connection, task['last_export'])

chain.append('apps.fyle.tasks.post_accounting_export_summary', fyle_credentials.workspace.fyle_org_id, workspace_id, fund_source, True)
chain.run()
async_task('apps.fyle.tasks.post_accounting_export_summary', fyle_credentials.workspace.fyle_org_id, workspace_id, fund_source, True)


def schedule_bills_creation(workspace_id: int, expense_group_ids: List[str], is_auto_export: bool, fund_source: str) -> list:
Expand Down
Loading