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

Import Logs for Deps Import #186

Closed
wants to merge 47 commits into from
Closed
Changes from 1 commit
Commits
Show all changes
47 commits
Select commit Hold shift + click to select a range
f6df1ec
Delete purchase_invoice, line_items on failed exports from hh2, type-…
Hrishabh17 May 21, 2024
372c628
Merge branch 'master' of github.com:fylein/fyle-sage-desktop-api
Hrishabh17 May 21, 2024
d0ad337
Merge branch 'master' of github.com:fylein/fyle-sage-desktop-api
Hrishabh17 May 24, 2024
7825b9e
Merge branch 'master' of github.com:fylein/fyle-sage-desktop-api
Hrishabh17 May 27, 2024
b79c74c
Merge branch 'master' of github.com:fylein/fyle-sage-desktop-api
Hrishabh17 May 27, 2024
97779c6
Merge branch 'master' of github.com:fylein/fyle-sage-desktop-api
Hrishabh17 May 28, 2024
601e3cb
Merge branch 'master' of github.com:fylein/fyle-sage-desktop-api
Hrishabh17 May 28, 2024
fb78432
Refactor deps schedule to run post Job import
Hrishabh17 Jun 3, 2024
57a4ed4
Fyle Card <> Vendor Mapping setup
Hrishabh17 Jun 3, 2024
19dfa7d
Added script to add mapping_settings
Hrishabh17 Jun 3, 2024
151e397
Fix post release script
Hrishabh17 Jun 4, 2024
ffbe1f5
Projects and Deps fields disable v1
Hrishabh17 Jun 4, 2024
372e5ab
Merge branch 'master' of github.com:fylein/fyle-sage-desktop-api
Hrishabh17 Jun 4, 2024
737c79d
Remove dep setting trigger, add logger
Hrishabh17 Jun 4, 2024
da072df
Merge branch 'refactor-deps-import' into vendor-card-mapping
Hrishabh17 Jun 4, 2024
e2f4cef
Modified script, added additional test case
Hrishabh17 Jun 4, 2024
5bc9075
lint fix
Hrishabh17 Jun 4, 2024
c6a4697
Remove mock object
Hrishabh17 Jun 4, 2024
f667558
Merge branch 'refactor-deps-import' into vendor-card-mapping
Hrishabh17 Jun 4, 2024
1c2e3c1
Add details while logging
Hrishabh17 Jun 4, 2024
0e98a8a
Merge branch 'refactor-deps-import' into vendor-card-mapping
Hrishabh17 Jun 4, 2024
d23f0cd
modify post-release script
Hrishabh17 Jun 4, 2024
7dd6145
Merge branch 'vendor-card-mapping' into disable-sage-fields
Hrishabh17 Jun 4, 2024
f1a31f1
bump accounting-mapping version
Hrishabh17 Jun 4, 2024
505fabc
modify the variable_name, add conditional update
Hrishabh17 Jun 5, 2024
e85f6b2
Add example objects
Hrishabh17 Jun 5, 2024
b1f39ca
Added loggers
Hrishabh17 Jun 5, 2024
555a72c
Added test cases
Hrishabh17 Jun 5, 2024
675c37a
Merge branch 'master' of github.com:fylein/fyle-sage-desktop-api
Hrishabh17 Jun 5, 2024
84ba2e9
Dependent Field optimizations
Hrishabh17 Jun 6, 2024
6dd28a9
fix failing test
Hrishabh17 Jun 6, 2024
aa96f62
Added Import Log for Deps
Hrishabh17 Jun 6, 2024
51e76e5
Fix post-release script
Hrishabh17 Jun 6, 2024
6cbcb7d
Merge branch 'dep-field-optimization' into dep-import-log
Hrishabh17 Jun 6, 2024
6c54fdc
fix failing test cases
Hrishabh17 Jun 6, 2024
1da8a7d
Set cost category import to fail on cost code fail
Hrishabh17 Jun 7, 2024
9aefa9f
Modify handle_import_exception for both class and func
Hrishabh17 Jun 7, 2024
173d31a
Modify test cases
Hrishabh17 Jun 7, 2024
5dac65e
fix ordering of saving import_log
Hrishabh17 Jun 7, 2024
ef99211
Move the import_log creation to ImportLog method
Hrishabh17 Jun 7, 2024
771c939
Merge branch 'master' of github.com:fylein/fyle-sage-desktop-api
Hrishabh17 Jun 10, 2024
0d688ac
Merge branch 'master' of github.com:fylein/fyle-sage-desktop-api
Hrishabh17 Jun 11, 2024
53d90b1
Merge branch 'master' of github.com:fylein/fyle-sage-desktop-api
Hrishabh17 Jun 11, 2024
766beb3
Merged master and bumped accounting-mappings version
Hrishabh17 Jun 11, 2024
8393600
Add logger in import
Hrishabh17 Jun 12, 2024
7a6d4fa
Merge branch 'master' into dep-import-log
Hrishabh17 Jun 12, 2024
30b7c50
Merge branch 'master' into dep-import-log
Hrishabh17 Jun 13, 2024
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
5 changes: 1 addition & 4 deletions apps/sage300/dependent_fields.py
Original file line number Diff line number Diff line change
Expand Up @@ -158,17 +158,14 @@ def post_dependent_expense_field_values(workspace_id: int, dependent_field_setti
posted_cost_types = post_dependent_cost_code(cost_code_import_log, dependent_field_setting, platform, filters)
if posted_cost_types:
filters['cost_code_name__in'] = posted_cost_types
post_dependent_cost_type(cost_category_import_log, dependent_field_setting, platform, filters)

if cost_code_import_log.status in ['FAILED', 'FATAL']:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

wouldn't there be exception incase of errors?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Both post_cost_code and post_cost_type method are decoarated with handle_import_exception

  1. If post of cost code fails, we handle in exception handler decorator and set the import log status to Failed.
  2. When the call returns we check the status, if its in Complete, we call the post of cost type (here if error occurs the status will be Failed/Fatal). Otherwise we mark complete.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

also fixed the call ordering, it was wrong earlier. can check code again for this.

cost_category_import_log.status = 'FAILED'
cost_category_import_log.error_log = {'message': 'Importing COST_CODE failed'}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we're storing all details in the exception, why are we overriding?

Screenshot 2024-06-13 at 10 59 17 AM

cost_category_import_log.save()
return
else:
cost_category_import_log.status = 'COMPLETE'
cost_category_import_log.error_log = []
cost_category_import_log.save()
post_dependent_cost_type(cost_category_import_log, dependent_field_setting, platform, filters)

DependentFieldSetting.objects.filter(workspace_id=workspace_id).update(last_successful_import_at=datetime.now())
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we should bring this inside else block, else we might mark timestamp even for failed runs


Expand Down
Loading