-
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.
Add tag "existing-data" to ticket (#4148)(patch)
### Added - If a ticket contains already existing data, a tag "existing-data" is added
- Loading branch information
Showing
4 changed files
with
69 additions
and
1 deletion.
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 |
---|---|---|
@@ -0,0 +1,27 @@ | ||
from cg.models.orders.constants import OrderType | ||
from cg.services.orders.constants import ORDER_TYPE_WORKFLOW_MAP | ||
from cg.services.orders.validation.models.case import Case | ||
from cg.services.orders.validation.models.order import Order | ||
from cg.services.orders.validation.models.order_with_cases import OrderWithCases | ||
|
||
|
||
def contains_existing_data(order: OrderWithCases) -> bool: | ||
"""Check if the order contains any existing data""" | ||
|
||
for enumerated_case in order.enumerated_cases: | ||
case: Case = enumerated_case[1] | ||
if case.enumerated_existing_samples: | ||
return True | ||
return False | ||
|
||
|
||
def get_ticket_tags(order: Order, order_type: OrderType) -> list[str]: | ||
"""Generate ticket tags based on the order and order type""" | ||
|
||
tags: list[str] = [ORDER_TYPE_WORKFLOW_MAP[order_type]] | ||
|
||
if isinstance(order, OrderWithCases): | ||
if contains_existing_data(order): | ||
tags.append("existing-data") | ||
|
||
return tags |
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