Skip to content

Commit

Permalink
resolve comments
Browse files Browse the repository at this point in the history
  • Loading branch information
labhvam5 committed Dec 6, 2023
1 parent 2b272bf commit 110366e
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 6 deletions.
8 changes: 4 additions & 4 deletions scripts/python/create-update-new-categories-import.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,25 +9,25 @@
try:
# Create/update new schedules in a transaction block
with transaction.atomic():
deleted_count = 0
updated_count = 0
for schedule in existing_import_enabled_schedules:
random_number = random.randint(1, 23)
configuration = WorkspaceGeneralSettings.objects.get(workspace_id=schedule['args'])
if not configuration.import_vendors_as_merchants:
print('Deleting schedule for workspace_id: ', schedule['args'])
Schedule.objects.get(
Schedule.objects.filter(
func='apps.mappings.tasks.auto_import_and_map_fyle_fields',
args=schedule['args']
).delete()
if configuration.import_categories or configuration.import_items:
print('Creating schedule for workspace_id: ', schedule['args'])
Schedule.objects.create(
Schedule.objects.update_or_create(
func='apps.mappings.queues.construct_tasks_and_chain_import_fields_to_fyle',
args=schedule['args'],
schedule_type= Schedule.MINUTES,
minutes=24 * 60,
next_run=datetime.now() + timedelta(hours=random_number)
)
# remove this sanity check after running this script
raise Exception("This is a sanity check")
except Exception as e:
print(e)
Original file line number Diff line number Diff line change
Expand Up @@ -256,8 +256,6 @@ def test_resolve_expense_attribute_errors(db):
attribute_type='CATEGORY'
).first()

print(source_category)

category_mapping_count = Mapping.objects.filter(workspace_id=workspace_id, source_id=source_category.id).count()

# category mapping is not present
Expand Down

0 comments on commit 110366e

Please sign in to comment.