Writer improvements.
This commit is contained in:
@@ -644,7 +644,7 @@ class BaseClass(Base):
|
||||
return output
|
||||
|
||||
@classmethod
|
||||
def clean_details_dict(cls, dictionary):
|
||||
def clean_details_for_render(cls, dictionary):
|
||||
output = {}
|
||||
for k, value in dictionary.items():
|
||||
match value:
|
||||
@@ -668,7 +668,6 @@ class BaseClass(Base):
|
||||
case _:
|
||||
pass
|
||||
output[k] = value
|
||||
|
||||
return output
|
||||
|
||||
|
||||
|
||||
@@ -1572,7 +1572,7 @@ class Procedure(BaseClass):
|
||||
for reagent in output.reagent:
|
||||
match reagent:
|
||||
case dict():
|
||||
reagent['reagentrole'] = next((reagentrole.name for reagentrole in self.kittype.reagentrole if reagentrole == reagent['reagentrole']), None)
|
||||
# reagent['reagentrole'] = next((reagentrole.name for reagentrole in self.kittype.reagentrole if reagentrole == reagent['reagentrole']), None)
|
||||
reagents.append(PydReagent(**reagent))
|
||||
case PydReagent():
|
||||
reagents.append(reagent)
|
||||
@@ -2067,10 +2067,12 @@ class ProcedureReagentAssociation(BaseClass):
|
||||
# NOTE: Figure out how to merge the misc_info if doing .update instead.
|
||||
relevant = {k: v for k, v in output.items() if k not in ['reagent']}
|
||||
output = output['reagent'].details_dict()
|
||||
|
||||
misc = output['misc_info']
|
||||
output.update(relevant)
|
||||
output['reagentrole'] = self.reagentrole
|
||||
output['misc_info'] = misc
|
||||
# output['results'] = [result.details_dict() for result in output['results']]
|
||||
logger.debug(f"Output: {pformat(output)}")
|
||||
return output
|
||||
|
||||
def delete(self, **kwargs):
|
||||
|
||||
@@ -438,7 +438,10 @@ class Run(BaseClass, LogMixin):
|
||||
if self._started_date:
|
||||
return self._started_date
|
||||
else:
|
||||
value = min([proc.started_date for proc in self.procedure])
|
||||
try:
|
||||
value = min([proc.started_date for proc in self.procedure])
|
||||
except ValueError:
|
||||
value = datetime.now()
|
||||
return value
|
||||
|
||||
@started_date.setter
|
||||
@@ -2191,6 +2194,7 @@ class ProcedureSampleAssociation(BaseClass):
|
||||
sample_id = Column(INTEGER, ForeignKey("_sample.id"), primary_key=True) #: id of associated equipment
|
||||
row = Column(INTEGER)
|
||||
column = Column(INTEGER)
|
||||
plate_rank = Column(INTEGER)
|
||||
|
||||
procedure = relationship(Procedure,
|
||||
back_populates="proceduresampleassociation") #: associated procedure
|
||||
|
||||
Reference in New Issue
Block a user