From 93feadbb4eda87b6e94888ec2a61292dc336543c Mon Sep 17 00:00:00 2001 From: islean Date: Thu, 23 Jan 2025 10:57:38 +0100 Subject: [PATCH] Fix RNA uploads/delivery message draft --- cg/meta/upload/scout/uploadscoutapi.py | 9 ++++++--- cg/store/crud/read.py | 2 +- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/cg/meta/upload/scout/uploadscoutapi.py b/cg/meta/upload/scout/uploadscoutapi.py index f08a75e2f1..b6b99491eb 100644 --- a/cg/meta/upload/scout/uploadscoutapi.py +++ b/cg/meta/upload/scout/uploadscoutapi.py @@ -676,9 +676,12 @@ def get_config_builder(self, analysis, hk_version) -> ScoutConfigBuilder: return config_builders[analysis.workflow] def create_rna_dna_collections(self, rna_case: Case) -> list[RNADNACollection]: - return [self.create_rna_dna_collection(link.sample) for link in rna_case.links] + return [ + self.create_rna_dna_collection(rna_sample=link.sample, customer=rna_case.customer) + for link in rna_case.links + ] - def create_rna_dna_collection(self, rna_sample: Sample) -> RNADNACollection: + def create_rna_dna_collection(self, rna_sample: Sample, customer: Customer) -> RNADNACollection: """Creates a collection containing the given RNA sample id, its related DNA sample name, and a list of ids for the DNA cases connected to the DNA sample.""" if not rna_sample.subject_id: @@ -686,7 +689,7 @@ def create_rna_dna_collection(self, rna_sample: Sample) -> RNADNACollection: f"Failed to link RNA sample {rna_sample.internal_id} to DNA samples - subject_id field is empty." ) - collaborators: set[Customer] = rna_sample.customer.collaborators + collaborators: set[Customer] = customer.collaborators subject_id_samples: list[Sample] = ( self.status_db.get_samples_by_customer_ids_and_subject_id_and_is_tumour( customer_ids=[customer.id for customer in collaborators], diff --git a/cg/store/crud/read.py b/cg/store/crud/read.py index c062bb77ec..5d2c212178 100644 --- a/cg/store/crud/read.py +++ b/cg/store/crud/read.py @@ -1665,7 +1665,7 @@ def get_uploaded_related_dna_cases(self, rna_case: Case) -> list[Case]: related_dna_cases: list[Case] = [] for rna_sample in rna_case.samples: - collaborators: set[Customer] = rna_sample.customer.collaborators + collaborators: set[Customer] = rna_case.customer.collaborators related_dna_samples_query: Query = self._get_related_samples_query( sample=rna_sample,