Removed Kittype.
This commit is contained in:
@@ -612,8 +612,8 @@ class BaseClass(Base):
|
||||
|
||||
relevant = {k: v for k, v in self.__class__.__dict__.items() if
|
||||
isinstance(v, InstrumentedAttribute) or isinstance(v, AssociationProxy)}
|
||||
output = OrderedDict()
|
||||
output['excluded'] = ["excluded", "misc_info", "_misc_info", "id"]
|
||||
# output = OrderedDict()
|
||||
output = dict(excluded = ["excluded", "misc_info", "_misc_info", "id"])
|
||||
for k, v in relevant.items():
|
||||
try:
|
||||
check = v.foreign_keys
|
||||
@@ -625,11 +625,16 @@ class BaseClass(Base):
|
||||
value = getattr(self, k)
|
||||
except AttributeError:
|
||||
continue
|
||||
# try:
|
||||
# logger.debug(f"Setting {k} to {value} for details dict.")
|
||||
# except AttributeError as e:
|
||||
# logger.error(f"Can't log {k} value due to {type(e)}")
|
||||
# continue
|
||||
output[k.strip("_")] = value
|
||||
if self._misc_info:
|
||||
for key, value in self._misc_info.items():
|
||||
# logger.debug(f"Misc info key {key}")
|
||||
output[key] = value
|
||||
|
||||
return output
|
||||
|
||||
@classmethod
|
||||
@@ -750,7 +755,7 @@ class ConfigItem(BaseClass):
|
||||
from .controls import *
|
||||
# NOTE: import order must go: orgs, kittype, run due to circular import issues
|
||||
from .organizations import *
|
||||
from .kits import *
|
||||
from .procedures import *
|
||||
from .submissions import *
|
||||
from .audit import AuditLog
|
||||
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -20,9 +20,7 @@ from pandas import DataFrame
|
||||
from sqlalchemy.ext.hybrid import hybrid_property
|
||||
|
||||
from frontend.widgets.functions import select_save_file
|
||||
from . import Base, BaseClass, Reagent, SubmissionType, KitType, ClientLab, Contact, LogMixin, Procedure, \
|
||||
kittype_procedure
|
||||
|
||||
from . import Base, BaseClass, Reagent, SubmissionType, ClientLab, Contact, LogMixin, Procedure
|
||||
from sqlalchemy import Column, String, TIMESTAMP, INTEGER, ForeignKey, JSON, FLOAT, case, func, Table, Sequence
|
||||
from sqlalchemy.orm import relationship, validates, Query
|
||||
from sqlalchemy.orm.attributes import flag_modified
|
||||
@@ -42,7 +40,7 @@ from jinja2 import Template
|
||||
from PIL import Image
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from backend.db.models.kits import ProcedureType, Procedure
|
||||
from backend.db.models.procedures import ProcedureType, Procedure
|
||||
|
||||
logger = logging.getLogger(f"submissions.{__name__}")
|
||||
|
||||
@@ -871,8 +869,8 @@ class Run(BaseClass, LogMixin):
|
||||
value (_type_): value of attribute
|
||||
"""
|
||||
match key:
|
||||
case "kittype":
|
||||
field_value = KitType.query(name=value)
|
||||
# case "kittype":
|
||||
# field_value = KitType.query(name=value)
|
||||
case "clientlab":
|
||||
field_value = ClientLab.query(name=value)
|
||||
case "contact":
|
||||
@@ -1241,25 +1239,12 @@ class Run(BaseClass, LogMixin):
|
||||
|
||||
def add_procedure(self, obj, proceduretype_name: str):
|
||||
from frontend.widgets.procedure_creation import ProcedureCreation
|
||||
procedure_type = next(
|
||||
procedure_type: ProcedureType = next(
|
||||
(proceduretype for proceduretype in self.allowed_procedures if proceduretype.name == proceduretype_name))
|
||||
logger.debug(f"Got ProcedureType: {procedure_type}")
|
||||
dlg = ProcedureCreation(parent=obj, procedure=procedure_type.construct_dummy_procedure(run=self))
|
||||
if dlg.exec():
|
||||
sql, _ = dlg.return_sql(new=True)
|
||||
# logger.debug(f"Output run samples:\n{pformat(sql.run.sample)}")
|
||||
# previous = [proc for proc in self.procedure if proc.proceduretype == procedure_type]
|
||||
# repeats = len([proc for proc in previous if proc.repeat])
|
||||
# if sql.repeat:
|
||||
# repeats += 1
|
||||
# if repeats > 0:
|
||||
# suffix = f"-{str(len(previous))}R{repeats}"
|
||||
# else:
|
||||
# suffix = f"-{str(len(previous)+1)}"
|
||||
# sql.name = f"{sql.repeat}{suffix}"
|
||||
# else:
|
||||
# suffix = f"-{str(len(previous)+1)}"
|
||||
# sql.name = f"{self.name}-{proceduretype_name}{suffix}"
|
||||
sql.save()
|
||||
obj.set_data()
|
||||
|
||||
|
||||
Reference in New Issue
Block a user