-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Adding scheduling logic * lint fix * lint fix * fixing comments * import-projects-base * Import projects base imp (#519) * adding sub module changes * inital run changes * adding is_auto_sync_enabled as project property * minor changes * removing print statements * resolving comment for sub module * resolving comments * lint fixes * switching to master branch * adding app label * removing old code (#517) * removing old code * removing old test and lint fix * Adding projects test (#522) * Adding projects test * adding new test * addin exceptions test * lint fix for test * lint fixes * fyle_integrations_import latest master * adding schedule script * lint fix * rm sub module * add submodule * add submodule fetch --------- Co-authored-by: ashwin1111 <[email protected]>
- Loading branch information
1 parent
9684343
commit 5cb9b05
Showing
31 changed files
with
6,942 additions
and
137 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -13,6 +13,8 @@ jobs: | |
environment: CI Environment | ||
steps: | ||
- uses: actions/checkout@v2 | ||
with: | ||
submodules: recursive | ||
- uses: satackey/[email protected] | ||
continue-on-error: true | ||
- name: Bring up Services and Run Tests | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -10,6 +10,8 @@ jobs: | |
environment: Production | ||
steps: | ||
- uses: actions/checkout@v2 | ||
with: | ||
submodules: recursive | ||
- uses: satackey/[email protected] | ||
continue-on-error: true | ||
- name: push to dockerhub | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -14,6 +14,8 @@ jobs: | |
environment: Staging | ||
steps: | ||
- uses: actions/checkout@v2 | ||
with: | ||
submodules: recursive | ||
- uses: satackey/[email protected] | ||
continue-on-error: true | ||
- name: push to dockerhub | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
[submodule "fyle_integrations_imports"] | ||
path = fyle_integrations_imports | ||
url = https://github.com/fylein/fyle_integrations_imports/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
from datetime import datetime | ||
from django_q.models import Schedule | ||
from apps.workspaces.models import WorkspaceGeneralSettings | ||
from fyle_accounting_mappings.models import MappingSetting | ||
|
||
|
||
def schedule_or_delete_fyle_import_tasks(workspace_general_settings: WorkspaceGeneralSettings, mapping_setting_instance: MappingSetting = None): | ||
""" | ||
Schedule or delete Fyle import tasks based on the configuration. | ||
:param configuration: Workspace Configuration Instance | ||
:param instance: Mapping Setting Instance | ||
:return: None | ||
""" | ||
task_to_be_scheduled = None | ||
# Check if there is a task to be scheduled | ||
if mapping_setting_instance and mapping_setting_instance.import_to_fyle: | ||
task_to_be_scheduled = mapping_setting_instance | ||
|
||
if task_to_be_scheduled: | ||
Schedule.objects.update_or_create( | ||
func='apps.mappings.queues.construct_tasks_and_chain_import_fields_to_fyle', | ||
args='{}'.format(workspace_general_settings.workspace_id), | ||
defaults={ | ||
'schedule_type': Schedule.MINUTES, | ||
'minutes': 24 * 60, | ||
'next_run': datetime.now() | ||
} | ||
) | ||
return | ||
|
||
import_fields_count = MappingSetting.objects.filter( | ||
import_to_fyle=True, | ||
workspace_id=workspace_general_settings.workspace_id, | ||
source_field__in=['PROJECT'] | ||
).count() | ||
|
||
# If the import fields count is 0, delete the schedule | ||
if import_fields_count == 0: | ||
Schedule.objects.filter( | ||
func='apps.mappings.queues.construct_tasks_and_chain_import_fields_to_fyle', | ||
args='{}'.format(workspace_general_settings.workspace_id) | ||
).delete() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Submodule fyle_integrations_imports
added at
ff3f58
Oops, something went wrong.