-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Code prepend support for PROJECT, Dep Fields, CATEGORY, MERCHANT, COS…
…T_CENTER, CUSTOM fields (#205) * add import_code_fields, test cases * fix param name * add condition before adding dep fields * add condition before adding dep fields * Job, Dep Field code-prepending support (#206) * Job, Dep Field code-prepending support * auto map feature * fix comments - add util func, handle code in VENDOR_TYPE * fix existing test cases * Add check for syncing jobs, deps and add test cases * update func name * added unit tests * fix failing test * add project import related test cases * fix lint * remove redundant db calls * rename helper func, fix is_job_sync_allowed method * add support for code prepending in CATEGORY (#208) * add support for code prepending in CATEGORY * rename the helper method * rename the helper method * add support for code prepending in MERCHANT (#209) * add support for code prepending in MERCHANT * change the callback methods are sent * bug fix * rename the helper method * fix callback method mapping of vendor * Code naming support cost center (#210) * add support for code prepending in COST_CENTER * rename the helper method * add support for code prepending in CUSTOM attribute (#211) * add support for code prepending in CUSTOM attribute * improve test case * add test cases (#212) * Job, Dep Field code-prepending support * auto map feature * fix comments - add util func, handle code in VENDOR_TYPE * fix existing test cases * Add check for syncing jobs, deps and add test cases * update func name * added unit tests * fix failing test * add project import related test cases * fix lint * remove redundant db calls * add support for code prepending in CATEGORY * add support for code prepending in MERCHANT * change the callback methods are sent * bug fix * add support for code prepending in COST_CENTER * rename helper func, fix is_job_sync_allowed method * rename the helper method * rename the helper method * rename the helper method * fix callback method mapping of vendor * rename the helper method * add support for code prepending in CUSTOM attribute * improve test case * add test cases * method refactor * add validation for adding code post import (#214) * add validation for adding code post import * add loggers * remove mapping, refactor validations (#215) * remove mapping, refactor validations * fix lint * Add code_prepend support in export (#216) * Add code_prepend support in export * code-prepend changes in custom fields * fix 500 internal error (#217) * remove unnecessary check * optimize the api call * optimize the query * add api for import config (#218) * refactor project callback func, dep field func * add additional condition for updating the dependent field setting last import flag * bump accounting mapping version * remove print stmt, remove mapping condition * add delimiter in the imported field
- Loading branch information
1 parent
5ad34f1
commit 085ad02
Showing
44 changed files
with
2,337 additions
and
263 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
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,28 @@ | ||
from datetime import datetime, timedelta, timezone | ||
from apps.mappings.models import ImportLog | ||
|
||
|
||
def prepend_code_to_name(prepend_code_in_name: bool, value: str, code: str = None) -> str: | ||
""" | ||
Format the attribute name based on the use_code_in_naming flag | ||
""" | ||
if prepend_code_in_name and code: | ||
return "{}: {}".format(code, value) | ||
return value | ||
|
||
|
||
def is_job_sync_allowed(import_log: ImportLog = None) -> bool: | ||
""" | ||
Check if job sync is allowed | ||
""" | ||
time_difference = datetime.now(timezone.utc) - timedelta(minutes=30) | ||
time_difference = time_difference.replace(tzinfo=timezone.utc) | ||
|
||
if ( | ||
not import_log | ||
or import_log.last_successful_run_at is None | ||
or import_log.last_successful_run_at < time_difference | ||
): | ||
return True | ||
|
||
return False |
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
Oops, something went wrong.