Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion conf/first_install_tables.json
Original file line number Diff line number Diff line change
Expand Up @@ -20298,7 +20298,7 @@
"pk": 3,
"fields": {
"label": "sample_name",
"ontology": "GENEPIO:0001123"
"ontology": "NCIT:C70663"
}
},
{ "model": "core.ontologymap",
Expand Down
2 changes: 1 addition & 1 deletion core/admin.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ class MoleculePreparationAdmin(admin.ModelAdmin):
"extraction_type",
"protocol_used",
"molecule_extraction_date",
"molecule_used_for",
"sample_continues_on",
"reused_number",
)
list_filter = ("generated_at",)
Expand Down
4 changes: 2 additions & 2 deletions core/core_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@

# ## Heading values when showing pending samples at handling molecules
HEADING_FOR_DEFINED_SAMPLES = [
"Sample extraction date",
"Sample defined date",
"Sample Code ID",
"Sample",
"To be included",
Expand Down Expand Up @@ -75,7 +75,7 @@
HEADING_FOR_SELECTING_MOLECULE_USE = [
"Sample Name",
"Extraction Code ID",
"Sample continue on",
"Sample continues on",
]

# ################ PROTOCOL PARAMETER SETTINGS ##############################
Expand Down
12 changes: 6 additions & 6 deletions core/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -1493,7 +1493,7 @@ class MoleculeUsedFor(models.Model):
massive_use = models.BooleanField(default=False)

class Meta:
db_table = "core_molecule_used_for"
db_table = "core_sample_continues_on"

def __str__(self):
return "%s" % (self.used_for)
Expand Down Expand Up @@ -1557,7 +1557,7 @@ class MoleculePreparation(models.Model):
UserLotCommercialKits, on_delete=models.CASCADE, null=True, blank=True
)

molecule_used_for = models.ForeignKey(
sample_continues_on = models.ForeignKey(
MoleculeUsedFor, on_delete=models.CASCADE, null=True, blank=True
)

Expand All @@ -1582,10 +1582,10 @@ def get_info_for_display(self):
molecule_info.append(extraction_date)
molecule_info.append(self.extraction_type)
molecule_info.append(self.molecule_type.get_name())
if self.molecule_used_for is None:
if self.sample_continues_on is None:
molecule_info.append("Not defined yet")
else:
molecule_info.append(self.molecule_used_for.get_molecule_use_name())
molecule_info.append(self.sample_continues_on.get_molecule_use_name())
molecule_info.append(self.protocol_used.get_name())
molecule_info.append(self.reused_number)
return molecule_info
Expand Down Expand Up @@ -1629,10 +1629,10 @@ def get_user_lot_kit_obj(self):
return self.user_lot_kit_id

def set_molecule_use(self, use_for_molecule, app_name):
self.molecule_used_for_obj = MoleculeUsedFor.objects.filter(
self.sample_continues_on_obj = MoleculeUsedFor.objects.filter(
used_for__exact=use_for_molecule, apps_name__exact=app_name
).last()
self.used_for_massive_sequencing = self.molecule_used_for_obj.get_massive()
self.used_for_massive_sequencing = self.sample_continues_on_obj.get_massive()
self.save()
return self

Expand Down
9 changes: 5 additions & 4 deletions core/utils/samples.py
Original file line number Diff line number Diff line change
Expand Up @@ -706,7 +706,7 @@ def create_table_molecule_pending_use(sample_list, app_name):
use_type = {}
use_type["data"] = list(
core.models.MoleculePreparation.objects.filter(
molecule_used_for=None,
sample_continues_on=None,
sample__in=sample_list,
state__molecule_state_name="assigned_parameters",
).values_list("sample__sample_name", "molecule_code_id", "pk")
Expand Down Expand Up @@ -1532,9 +1532,10 @@ def get_selection_from_excel_data(data, heading, check_field, field_id):
excel_data = json.loads(data)
# Convert excel list-list to dictionary with field_names
excel_json_data = core.utils.common.jspreadsheet_to_dict(heading, excel_data)

for row in excel_json_data:
if check_field is not None:
if row[check_field] is True:
if row[check_field] is not False and row[check_field] != "":
selected.append(row[field_id])
selected_row.append(row)
else:
Expand Down Expand Up @@ -2085,7 +2086,7 @@ def set_molecule_use(molecule_use_data, app_name):
}
for molecule in molecule_use_data:
molecule_obj = get_molecule_obj_from_id(molecule["m_id"])
molecule_obj.set_molecule_use(molecule["Molecule use for"], app_name)
molecule_obj.set_molecule_use(molecule["Sample continues on"], app_name)
sample_obj = molecule_obj.get_sample_obj()
if molecule_obj.get_used_for_massive():
sample_obj.set_state("Library preparation")
Expand All @@ -2095,7 +2096,7 @@ def set_molecule_use(molecule_use_data, app_name):
[
molecule["Sample Name"],
molecule["Extraction Code ID"],
molecule["Molecule use for"],
molecule["Sample continues on"],
]
)
return molecule_update
Expand Down
Loading