From 5d78ba1a865ddb47db3b1693f6ff3a50fd7a66da Mon Sep 17 00:00:00 2001 From: Anandashankar Anil Date: Wed, 2 Jul 2025 16:20:23 +0200 Subject: [PATCH 1/2] Fix bug with concatenation of processids to query in loop --- LIMS2DB/classes.py | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/LIMS2DB/classes.py b/LIMS2DB/classes.py index 99adbdf..31941ef 100644 --- a/LIMS2DB/classes.py +++ b/LIMS2DB/classes.py @@ -947,18 +947,16 @@ def get_library_preps(self, sample): # If only Aggregate QC step exists, use it even if it's a pool if len(agrlibvals) == 1: agrlibval = agrlibvals[0] - query += f"{agrlibval.processid}" try: - inp_artifact = self.session.query(Artifact).from_statement(text(query)).first() + inp_artifact = self.session.query(Artifact).from_statement(text(query+f"{agrlibval.processid}")).first() except NoResultFound: pass else: for agrlv in agrlibvals: # for small rna (and maybe others), there is more than one agrlibval, and I should not get the latest one, # but the latest one that ran at sample level, not a pool level. - query += f"{agrlv.processid}" try: - inp_artifact = self.session.query(Artifact).from_statement(text(query)).first() + inp_artifact = self.session.query(Artifact).from_statement(text(query+f"{agrlv.processid}")).first() # We want the QC results of individual sample, not library pool if ( From f7834ee4829ba9486da5529ba26b3a39d67c28b5 Mon Sep 17 00:00:00 2001 From: Anandashankar Anil Date: Wed, 2 Jul 2025 16:22:17 +0200 Subject: [PATCH 2/2] Ruff --- LIMS2DB/classes.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/LIMS2DB/classes.py b/LIMS2DB/classes.py index 31941ef..eff2c50 100644 --- a/LIMS2DB/classes.py +++ b/LIMS2DB/classes.py @@ -948,7 +948,7 @@ def get_library_preps(self, sample): if len(agrlibvals) == 1: agrlibval = agrlibvals[0] try: - inp_artifact = self.session.query(Artifact).from_statement(text(query+f"{agrlibval.processid}")).first() + inp_artifact = self.session.query(Artifact).from_statement(text(query + f"{agrlibval.processid}")).first() except NoResultFound: pass else: @@ -956,7 +956,7 @@ def get_library_preps(self, sample): # for small rna (and maybe others), there is more than one agrlibval, and I should not get the latest one, # but the latest one that ran at sample level, not a pool level. try: - inp_artifact = self.session.query(Artifact).from_statement(text(query+f"{agrlv.processid}")).first() + inp_artifact = self.session.query(Artifact).from_statement(text(query + f"{agrlv.processid}")).first() # We want the QC results of individual sample, not library pool if (