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
6 changes: 3 additions & 3 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,12 +42,12 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
- Fixed deprecated `STATUS_CHOICES` usage in Django versions higher than 3.1.x (#263) [#267](https://github.com/BU-ISCIII/iskylims/pull/267)
- Fixed issue where services could not be searched by service type (#78) [#267](https://github.com/BU-ISCIII/iskylims/pull/267)
- Fixed issue [#338](https://github.com/BU-ISCIII/iskylims/issues/338): Removed unnecessary hidden input passing a large JSON object, now using session storage [#344](https://github.com/BU-ISCIII/iskylims/pull/344)
- Fixed email error handling for multiple notification types. [#346](https://github.com/BU-ISCIII/iskylims/pull/346)
- Fixed email error manage for multiple notification types. [#346](https://github.com/BU-ISCIII/iskylims/pull/346)
- Replaced all references to `Molecule Code ID` with `Extraction Code ID` for consistency.
- Improved message display in Handling Library Preparation.
- Improved message display in Manage Library Preparation.
- Fixed incomplete code execution when storing protocol values. (#349) [#352](https://github.com/BU-ISCIII/iskylims/pull/352)
- Increased maximum length for `prefix_protocol` to prevent data errors. (#350) [#352](https://github.com/BU-ISCIII/iskylims/pull/352)
- Corrected exception handling, replacing incorrect exception type with `AttributeError`. (#351) [#352](https://github.com/BU-ISCIII/iskylims/pull/352)
- Corrected exception manage, replacing incorrect exception type with `AttributeError`. (#351) [#352](https://github.com/BU-ISCIII/iskylims/pull/352)
- Fixed DataError - Value Too Long for prefix_protocol #350: Increased lenght for field prefix_protocol [#352](https://github.com/BU-ISCIII/iskylims/pull/352)
- Removed --no-cache from docker_install.sh as it only worked with deprecated docker-compose [#356](https://github.com/BU-ISCIII/iskylims/pull/356)
- Removed unused field sample_project_searchable that was leading to errors during migration [#356](https://github.com/BU-ISCIII/iskylims/pull/356)
Expand Down
2 changes: 1 addition & 1 deletion conf/requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ asn1crypto==1.5.1
bcrypt==4.2.0
biopython==1.84
cryptography==43.0.1
Django==4.2.15
Django==4.2.25
django-crispy-forms==2.3
crispy-bootstrap5==0.7
django-crontab==0.7.1
Expand Down
2 changes: 1 addition & 1 deletion core/core_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
# ########### Headings to confirm the sucessful recorded
HEADING_CONFIRM_MOLECULE_RECORDED = ["Extraction Code ID", "Used Protocol"]

# ## Heading values when showing pending samples at handling molecules
# ## Heading values when showing pending samples at manage molecules
HEADING_FOR_DEFINED_SAMPLES = [
"Sample defined date",
"Sample Code ID",
Expand Down
14 changes: 14 additions & 0 deletions django_utils/forms.py
Original file line number Diff line number Diff line change
Expand Up @@ -104,3 +104,17 @@ def __init__(self, *args, **kwargs):
),
),
)

def clean_username(self):
username = self.cleaned_data.get("username")
if self.instance and self.instance.pk and username:
if (
User.objects.exclude(pk=self.instance.pk)
.filter(username__exact=username)
.exists()
):
raise forms.ValidationError(
self.error_messages["duplicate_username"], code="duplicate_username"
)
return username
return super().clean_username()
27 changes: 20 additions & 7 deletions wetlab/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -93,19 +93,32 @@ def get_platform_name(self):
else:
return "Not defined"

def _get_run_processes(self):
return self.runprocess_set.order_by("-generated_at")

def _get_latest_run_process(self):
return self._get_run_processes().first()

def get_run_names(self):
return [
"%s" % (run_process.get_run_name())
for run_process in self._get_run_processes()
]

def get_run_name(self):
if self.run_process_id is not None:
return "%s" % (self.run_process_id.get_run_name())
else:
return "Not defined yet"
run_process = self._get_latest_run_process()
if run_process is not None:
return "%s" % (run_process.get_run_name())
return "Not defined yet"

def get_run_id(self):
if self.run_process_id is not None:
return "%s" % (self.run_process_id.get_run_id())
run_process = self._get_latest_run_process()
if run_process is not None:
return "%s" % (run_process.get_run_id())
return None

def get_run_obj(self):
return self.run_process_id
return self._get_latest_run_process()

def set_pool(self, pool_obj):
self.pool.add(pool_obj)
Expand Down
131 changes: 67 additions & 64 deletions wetlab/templates/wetlab/create_new_run.html
Original file line number Diff line number Diff line change
@@ -1,24 +1,23 @@
{% extends "core/base.html" %}
{% load static %}
{% load replace_spaces %}
{% block content %}
{% include 'core/jexcel_functionality.html' %}
{% include "wetlab/menu.html" %}
<section class="iskylims d-flex flex-column fill-height">
<div class="container-md">
{% include 'registration/login_inline.html' %}
{% if error_message %}
<div class="row my-2 justify-content-center">
<div class="col-md-8">
<div class="card border-danger mb-3">
<div class="card-header border-danger">
<h3>Unable to accept your request</h3>
</div>
<div class="card-body">
{% for error in error_message %}<p class="text-center">{{ error }}</p>{% endfor %}
</div>
<div class="row my-2">
<div class="col-sm-7 offset-3">
<div class="card border-danger mb-3">
<div class="card-header"><h3 class="text-center">Unable to process your request</h3> </div>
<div class="card-body">
<h4>{{error_message}}</h4>
</div>
</div>
</div>
</div>
</div>
{% endif %}
{% if info_message %}
<div class="row my-2 justify-content-center">
Expand Down Expand Up @@ -177,7 +176,7 @@ <h5 class="text-center my-3">Samples that will be included in the run</h5>
type="submit"
id="btnSubmit"
value="Submit" />
</form>

<script>
var data = [{% for values in display_sample_information.data %}
[{% for value in values %}'{{value}}',{% endfor %}],{% endfor %}
Expand All @@ -203,7 +202,23 @@ <h5 class="text-center my-3">Samples that will be included in the run</h5>
csvFileName:'sample_sheet',

});
$(document).ready(function () {
$("#storeDataNewRun").submit(function (e) {
//stop submitting the form to see the disabled button effect
// e.preventDefault();
//disable the submit button
var table_data = $('#spreadsheet').jexcel('getData')
var data_json = JSON.stringify(table_data)
$("<input />").attr("type", "hidden")
.attr("name", "s_sheet_data")
.attr("value", data_json)
.appendTo("#storeDataNewRun");
$("#btnSubmit").attr("disabled", true);
return true;
});
});
</script>
</form>
</div>
</div>
</div>
Expand Down Expand Up @@ -348,53 +363,56 @@ <h3 class="text-center">Fill the information to create the New Run</h3>
<div class="col">
<ul class="nav nav-tabs" id="myTab" role="tablist">
{% for key, values in display_pools_for_run.pool_data.platform.items %}
{% if forloop.first %}
<li class="nav-item" role="presentation">
<button class="nav-link active"
id="{{ key }}-tab"
data-bs-toggle="tab"
data-bs-target="#{{ key }}"
type="button"
role="tab"
aria-controls="{{ key }}"
aria-selected="true">Samples for {{ key }}</button>
</li>
{% else %}
<li class="nav-item" role="presentation">
<button class="nav-link active"
id="{{ key }}-tab"
data-bs-toggle="tab"
data-bs-target="#{{ key }}"
type="button"
role="tab"
aria-controls="{{ key }}"
aria-selected="false">Samples for {{ key }}</button>
</li>
{% endif %}
{% with key_slug=key|replace_spaces_with_underscores %}
{% if forloop.first %}
<li class="nav-item" role="presentation">
<button class="nav-link active"
id="{{ key_slug }}-tab"
data-bs-toggle="tab"
data-bs-target="#{{ key_slug }}"
type="button"
role="tab"
aria-controls="{{ key_slug }}"
aria-selected="true">Samples for {{ key }}</button>
</li>
{% else %}
<li class="nav-item" role="presentation">
<button class="nav-link"
id="{{ key_slug }}-tab"
data-bs-toggle="tab"
data-bs-target="#{{ key_slug }}"
type="button"
role="tab"
aria-controls="{{ key_slug }}"
aria-selected="false">Samples for {{ key }}</button>
</li>
{% endif %}
{% endwith %}
{% endfor %}
</ul>
<div class="tab-content bg-white border-tab p-2" id="nav-tabContent">
{% for key, values in display_pools_for_run.pool_data.platform.items %}
{% if forloop.first %}
<div class="tab-pane fade show active"
id="{{ key }}"
role="tabpanel"
aria-labelledby="{{ key }}-tab">
{% with key_slug=key|replace_spaces_with_underscores key_slug_lower=key|replace_spaces_with_underscores|lower %}
{% if forloop.first %}
<div class="tab-pane fade show active"
id="{{ key_slug }}"
role="tabpanel"
aria-labelledby="{{ key_slug }}-tab">
{% else %}
<div class="tab-pane fade"
id="{{ key }}"
id="{{ key_slug }}"
role="tabpanel"
aria-labelledby="{{ key }}-tab">
{% endif %}
aria-labelledby="{{ key_slug }}-tab">
{% endif %}
<div class="container">
<div class="row mt-4">
<div class="col">
<div class="card">
<div class="card-body">
<form method="post"
enctype="multipart/form-data"
name="createNewRun"
id="createNewRun">
name="createNewRun_{{ key_slug_lower }}"
id="createNewRun_{{ key_slug_lower }}">
{% csrf_token %}
<input type="hidden" name="action" value="createNewRun" />
<input type="hidden" name="platform" value="{{ key }}" />
Expand Down Expand Up @@ -474,7 +492,9 @@ <h3>Select the pools to be included in the new run</h3>
</div>
</div>
</div>
{% endfor %}
</div>
{% endwith %}
{% endfor %}
</div>
</div>
</div>
Expand All @@ -497,23 +517,6 @@ <h3>Not available Pools</h3>
{% endif %}
{% endif %}
</div>
</section>
<script>
</div>
$(document).ready(function () {
$("#storeDataNewRun").submit(function (e) {
//stop submitting the form to see the disabled button effect
// e.preventDefault();
//disable the submit button
var table_data = $('#spreadsheet').jexcel('getData')
var data_json = JSON.stringify(table_data)
$("<input />").attr("type", "hidden")
.attr("name", "s_sheet_data")
.attr("value", data_json)
.appendTo("#storeDataNewRun");
$("#btnSubmit").attr("disabled", true);
return true;
});
});
</script>
{% endblock %}
</section>
{% endblock %}
Loading