Added ability to not import reagents on first import.
This commit is contained in:
@@ -25,6 +25,16 @@ logger = logging.getLogger(f"submissions.{__name__}")
|
||||
class LogMixin(Base):
|
||||
__abstract__ = True
|
||||
|
||||
def truncated_name(self):
|
||||
name = str(self)
|
||||
if len(name) > 64:
|
||||
name = name.replace("<", "").replace(">", "")
|
||||
if len(name) > 64:
|
||||
name = name.replace("agent", "")
|
||||
if len(name) > 64:
|
||||
name = f"...{name[-61:]}"
|
||||
return name
|
||||
|
||||
|
||||
class BaseClass(Base):
|
||||
"""
|
||||
|
||||
@@ -539,7 +539,7 @@ class IridaControl(Control):
|
||||
except AttributeError:
|
||||
consolidate = False
|
||||
report = Report()
|
||||
logger.debug(f"settings: {pformat(chart_settings)}")
|
||||
# logger.debug(f"settings: {pformat(chart_settings)}")
|
||||
controls = cls.query(subtype=chart_settings['sub_type'], start_date=chart_settings['start_date'],
|
||||
end_date=chart_settings['end_date'])
|
||||
# logger.debug(f"Controls found: {controls}")
|
||||
|
||||
@@ -427,9 +427,10 @@ class Reagent(BaseClass, LogMixin):
|
||||
|
||||
def __repr__(self):
|
||||
if self.name:
|
||||
return f"<Reagent({self.name}-{self.lot})>"
|
||||
name = f"<Reagent({self.name}-{self.lot})>"
|
||||
else:
|
||||
return f"<Reagent({self.role.name}-{self.lot})>"
|
||||
name = f"<Reagent({self.role.name}-{self.lot})>"
|
||||
return name
|
||||
|
||||
def to_sub_dict(self, extraction_kit: KitType = None, full_data: bool = False, **kwargs) -> dict:
|
||||
"""
|
||||
@@ -1347,7 +1348,7 @@ class SubmissionReagentAssociation(BaseClass):
|
||||
return PydReagent(**self.to_sub_dict(extraction_kit=extraction_kit))
|
||||
|
||||
|
||||
class Equipment(BaseClass):
|
||||
class Equipment(BaseClass, LogMixin):
|
||||
"""
|
||||
A concrete instance of equipment
|
||||
"""
|
||||
@@ -1851,7 +1852,7 @@ class TipRole(BaseClass):
|
||||
super().save()
|
||||
|
||||
|
||||
class Tips(BaseClass):
|
||||
class Tips(BaseClass, LogMixin):
|
||||
"""
|
||||
A concrete instance of tips.
|
||||
"""
|
||||
|
||||
@@ -174,7 +174,8 @@ class BasicSubmission(BaseClass, LogMixin):
|
||||
'platemap', 'export_map', 'equipment', 'tips', 'custom'],
|
||||
# NOTE: Fields not placed in ui form
|
||||
form_ignore=['reagents', 'ctx', 'id', 'cost', 'extraction_info', 'signed_by', 'comment', 'namer',
|
||||
'submission_object', "tips", 'contact_phone', 'custom', 'cost_centre'] + recover,
|
||||
'submission_object', "tips", 'contact_phone', 'custom', 'cost_centre', 'completed_date',
|
||||
'controls'] + recover,
|
||||
# NOTE: Fields not placed in ui form to be moved to pydantic
|
||||
form_recover=recover
|
||||
))
|
||||
|
||||
Reference in New Issue
Block a user