Skip to content

Commit

Permalink
Merge branch 'master' into improve-order-flow-main
Browse files Browse the repository at this point in the history
  • Loading branch information
diitaz93 authored Dec 17, 2024
2 parents aeded4c + 1fc0655 commit 24989a8
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 7 deletions.
2 changes: 1 addition & 1 deletion .bumpversion.cfg
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[bumpversion]
current_version = 64.5.29
current_version = 64.5.30
commit = True
tag = True
tag_name = v{new_version}
Expand Down
2 changes: 1 addition & 1 deletion cg/__init__.py
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
__title__ = "cg"
__version__ = "64.5.29"
__version__ = "64.5.30"
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
from cg.exc import OrderError
from cg.models.orders.constants import OrderType
from cg.models.orders.order import OrderIn
from cg.models.orders.samples import SarsCov2Sample
from cg.models.orders.samples import MicrobialFastqSample, SarsCov2Sample
from cg.services.orders.submitters.order_submitter import ValidateOrderService
from cg.store.models import Customer
from cg.store.store import Store
Expand All @@ -15,18 +15,25 @@ def __init__(self, status_db: Store):
def validate_order(self, order: OrderIn) -> None:
if order.order_type == OrderType.SARS_COV_2:
self._validate_sample_names_are_available(
samples=order.samples, customer_id=order.customer
samples=order.samples, customer_id=order.customer, is_sars_cov_2=True
)
elif order.order_type == OrderType.MICROBIAL_FASTQ:
self._validate_sample_names_are_available(
samples=order.samples, customer_id=order.customer, is_sars_cov_2=False
)

def _validate_sample_names_are_available(
self, samples: list[SarsCov2Sample], customer_id: str
self,
samples: list[SarsCov2Sample] | list[MicrobialFastqSample],
customer_id: str,
is_sars_cov_2: bool,
) -> None:
"""Validate names of all samples are not already in use."""
customer: Customer = self.status_db.get_customer_by_internal_id(
customer_internal_id=customer_id
)
for sample in samples:
if sample.control:
if is_sars_cov_2 and sample.control:
continue
if self.status_db.get_sample_by_customer_and_name(
customer_entry_id=[customer.id], sample_name=sample.name
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ build-backend = "poetry.core.masonry.api"

[tool.poetry]
name = "cg"
version = "64.5.29"
version = "64.5.30"
description = "Clinical Genomics command center"
authors = ["Clinical Genomics <[email protected]>"]
readme = "README.md"
Expand Down

0 comments on commit 24989a8

Please sign in to comment.