Skip to content

Commit 8abc1dc

Browse files
committed
solved issue BU-ISCIII#319 incorrect state set for molecule after filling the extraction data
1 parent 0df6259 commit 8abc1dc

File tree

6 files changed

+37
-24
lines changed

6 files changed

+37
-24
lines changed

conf/first_install_tables.json

+14-3
Original file line numberDiff line numberDiff line change
@@ -324,21 +324,32 @@
324324
"model": "core.statesformolecule",
325325
"pk": 3,
326326
"fields": {
327-
"molecule_state_name": "Defined"
327+
"molecule_state_name": "defined",
328+
"molecule_state_display": "Defined"
328329
}
329330
},
330331
{
331332
"model": "core.statesformolecule",
332333
"pk": 4,
333334
"fields": {
334-
"molecule_state_name": "Assigned Protocol"
335+
"molecule_state_name": "assigned_parameters",
336+
"molecule_state_display": "Assigned Parameters"
335337
}
336338
},
337339
{
338340
"model": "core.statesformolecule",
339341
"pk": 5,
340342
"fields": {
341-
"molecule_state_name": "Completed"
343+
"molecule_state_name": "completed",
344+
"molecule_state_display": "Completed"
345+
}
346+
},
347+
{
348+
"model": "core.statesformolecule",
349+
"pk": 6,
350+
"fields": {
351+
"molecule_state_name": "sent_external",
352+
"molecule_state_display": "Sent to external service"
342353
}
343354
},
344355
{

core/core_config.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
]
2323
HEADING_FOR_MOLECULE_ADDING_PARAMETERS = [
2424
"Sample",
25-
"Molecule Code ID",
25+
"Extraction Code ID",
2626
"Lot Commercial Kit",
2727
]
2828

@@ -74,8 +74,8 @@
7474

7575
HEADING_FOR_SELECTING_MOLECULE_USE = [
7676
"Sample Name",
77-
"Molecule CodeID",
78-
"Molecule use for",
77+
"Extraction CodeID",
78+
"Sample continue on",
7979
]
8080

8181
# ################ PROTOCOL PARAMETER SETTINGS ##############################

core/models.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -372,6 +372,7 @@ def get_id(self):
372372

373373
class StatesForMolecule(models.Model):
374374
molecule_state_name = models.CharField(max_length=50)
375+
molecule_state_display = models.CharField(max_length=80, null=True, blank=True)
375376

376377
class Meta:
377378
db_table = "core_states_for_molecule"
@@ -1495,7 +1496,7 @@ def create_molecule(self, molecule_data):
14951496
protocol_used=protocol_used_obj,
14961497
sample=molecule_data["sample"],
14971498
molecule_type=molecule_used_obj,
1498-
state=StatesForMolecule.objects.get(molecule_state_name__exact="Defined"),
1499+
state=StatesForMolecule.objects.get(molecule_state_name__exact="defined"),
14991500
molecule_code_id=molecule_data["molecule_code_id"],
15001501
molecule_extraction_date=molecule_data["molecule_extraction_date"],
15011502
extraction_type=molecule_data["extraction_type"],

core/utils/samples.py

+5-5
Original file line numberDiff line numberDiff line change
@@ -565,7 +565,7 @@ def add_molecule_protocol_parameters(data, parameters):
565565
molecule_parameter_value
566566
)
567567

568-
molecule_obj.set_state("Completed")
568+
molecule_obj.set_state("assigned_parameters")
569569
# Update sample state
570570
sample_obj = molecule_obj.get_sample_obj()
571571
sample_obj.set_state("Pending for use")
@@ -701,10 +701,10 @@ def create_table_molecule_pending_use(sample_list, app_name):
701701
use_type = {}
702702
use_type["data"] = list(
703703
core.models.MoleculePreparation.objects.filter(
704-
molecule_used_for=None, sample__in=sample_list
705-
)
706-
.exclude(state__molecule_state_name="Completed")
707-
.values_list("sample__sample_name", "molecule_code_id", "pk")
704+
molecule_used_for=None,
705+
sample__in=sample_list,
706+
state__molecule_state_name="assigned_parameters",
707+
).values_list("sample__sample_name", "molecule_code_id", "pk")
708708
)
709709
if len(use_type["data"]) > 0:
710710
if core.models.MoleculeUsedFor.objects.filter(

wetlab/templates/wetlab/handling_molecules.html

+11-11
Original file line numberDiff line numberDiff line change
@@ -108,15 +108,15 @@ <h3>Information missing</h3>
108108
<div class="col-md">
109109
<div class="card ">
110110
<div class="card-header">
111-
<h3>Update molecules data with defined parameters</h3>
111+
<h3>Update sample extraction data with defined parameters</h3>
112112
</div>
113113
<div class="card-body">
114114
<form method="post"
115115
enctype="multipart/form-data"
116-
name="addMoleculeParameters"
117-
id="addMoleculeParameters">
116+
name="addExtractionParameters"
117+
id="addExtractionParameters">
118118
{% csrf_token %}
119-
<input type="hidden" name="action" value="addMoleculeParameters" />
119+
<input type="hidden" name="action" value="addExtractionParameters" />
120120
<input type="hidden" name="protocol_list" value="{{ protocol_list }}" />
121121
{% for prot, value_dict in molecule_parameters.items %}
122122
<input type="hidden"
@@ -147,13 +147,13 @@ <h5>Protocol: {{ prot }}</h5>
147147
<div class="col-sm-12">
148148
<div class="card ">
149149
<div class="card-header text-center">
150-
<h3>Molecules have been updated with required parameters.</h3>
150+
<h3>Samples have been updated with Extraction required parameters.</h3>
151151
</div>
152152
<div class="row my-3 justify-content-center">
153153
<div class="col-md-3">
154154
<input type="button"
155155
class="btn btn-outline-secondary"
156-
value="Return to handling molecules"
156+
value="Return to handling extraction samples"
157157
onclick="location.href ='/wetlab/handlingMolecules' ;" />
158158
</div>
159159
</div>
@@ -208,7 +208,7 @@ <h3>Molecules are updated with their use.</h3>
208208
type="button"
209209
role="tab"
210210
aria-controls="n_samples"
211-
aria-selected="true">New Samples</button>
211+
aria-selected="true">Recorded Samples</button>
212212
</li>
213213
<li class="nav-item" role="presentation">
214214
<button class="nav-link"
@@ -218,7 +218,7 @@ <h3>Molecules are updated with their use.</h3>
218218
type="button"
219219
role="tab"
220220
aria-controls="molecule"
221-
aria-selected="false">Pending molecules</button>
221+
aria-selected="false">Pending Extraction data</button>
222222
</li>
223223
<li class="nav-item" role="presentation">
224224
<button class="nav-link"
@@ -228,7 +228,7 @@ <h3>Molecules are updated with their use.</h3>
228228
type="button"
229229
role="tab"
230230
aria-controls="mol_use"
231-
aria-selected="false">Molecules use specification</button>
231+
aria-selected="false">Next action after extraction</button>
232232
</li>
233233
</ul>
234234
<div class="tab-content bg-white border-tab p-2" id="nav-tabContent">
@@ -669,13 +669,13 @@ <h4>Not molecule uses have been defined yet</h4>
669669
});
670670

671671

672-
$("#addMoleculeParameters").submit(function (e) {
672+
$("#addExtractionParameters").submit(function (e) {
673673
var table_data = {{ prot }}_data_table.getData()
674674
var data_json = JSON.stringify(table_data)
675675
$("<input />").attr("type", "hidden")
676676
.attr("name", "{{ prot }}")
677677
.attr("value", data_json)
678-
.appendTo("#addMoleculeParameters");
678+
.appendTo("#addExtractionParameters");
679679
$("#button-submit").attr("disabled", true);
680680
return true;
681681
});

wetlab/views.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -3303,7 +3303,7 @@ def handling_molecules(request):
33033303
},
33043304
)
33053305

3306-
elif request.method == "POST" and request.POST["action"] == "addMoleculeParameters":
3306+
elif request.method == "POST" and request.POST["action"] == "addExtractionParameters":
33073307
protocols = request.POST["protocol_list"].split(";")
33083308
for protocol in protocols:
33093309
heading = core.core_config.HEADING_FOR_MOLECULE_ADDING_PARAMETERS.copy()
@@ -3371,6 +3371,7 @@ def handling_molecules(request):
33713371
molecule_use_defined = core.utils.samples.check_if_molecule_use_defined(
33723372
__package__
33733373
)
3374+
33743375
return render(
33753376
request,
33763377
"wetlab/handling_molecules.html",

0 commit comments

Comments
 (0)