From d52f11c6f47794c7706c3e056e5ad25a4aa2c9b5 Mon Sep 17 00:00:00 2001 From: Anandashankar Anil Date: Wed, 18 Dec 2024 14:25:17 +0100 Subject: [PATCH 1/2] Add current steps to sample details --- LIMS2DB/classes.py | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/LIMS2DB/classes.py b/LIMS2DB/classes.py index 15c3f9f..5790556 100644 --- a/LIMS2DB/classes.py +++ b/LIMS2DB/classes.py @@ -8,7 +8,7 @@ Researcher, ReagentType, ) -from genologics_sql.queries import get_children_processes, get_processes_in_history +from genologics_sql.queries import get_children_processes, get_processes_in_history, get_currentsteps_protocol_for_sample, get_protocolstep_details from LIMS2DB.diff import diff_objects from requests import get as rget from sqlalchemy import text @@ -878,6 +878,17 @@ def get_samples(self): self.get_initial_qc(sample) self.get_library_preps(sample) + self.get_current_step_sample(sample.sampleid) + + def get_current_step_sample(self, sample): + """ Get the current steps a sample is in""" + sample_in_steps = get_currentsteps_protocol_for_sample(self.session, sample.sampleid) + if sample_in_steps: + current_steps = {} + for step in sample_in_steps: + step_details = get_protocolstep_details(self.session, step[0])[0] + current_steps[step_details[0]] = {"protocol_name": step_details[1], "is_qc_protocol": step_details[2]} + self.obj["samples"][sample.name]["current_step"] = current_steps def get_initial_qc(self, sample): self.obj["samples"][sample.name]["initial_qc"] = {} From 6b098c89ea92533ef1fcab051ccf4b52a796f035 Mon Sep 17 00:00:00 2001 From: Anandashankar Anil Date: Wed, 18 Dec 2024 14:27:14 +0100 Subject: [PATCH 2/2] Pass correct param --- LIMS2DB/classes.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/LIMS2DB/classes.py b/LIMS2DB/classes.py index 5790556..825c2c9 100644 --- a/LIMS2DB/classes.py +++ b/LIMS2DB/classes.py @@ -878,7 +878,7 @@ def get_samples(self): self.get_initial_qc(sample) self.get_library_preps(sample) - self.get_current_step_sample(sample.sampleid) + self.get_current_step_sample(sample) def get_current_step_sample(self, sample): """ Get the current steps a sample is in"""