Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed #328, #299 and #346 #347

Merged
merged 12 commits into from
Mar 19, 2025
Merged
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
15 changes: 0 additions & 15 deletions .github/workflows/close-issues.yml

This file was deleted.

4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -38,13 +38,17 @@ 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)

#### Changed

- Updated installation script with variable modules for more flexibility [#269](https://github.com/BU-ISCIII/iskylims/pull/269)
- Updated installation script to remove commas in values of `rawtobunbarcode` table [#277](https://github.com/BU-ISCIII/iskylims/pull/277)
- Updated installation documentation and script, fixing small issues [#284](https://github.com/BU-ISCIII/iskylims/pull/284)
- Unify main and develop branches [#334](https://github.com/BU-ISCIII/iskylims/pull/334)
- Increased max upload memory size. (#328)
- Renamed method `get_delivery_date` to `get_delivered_date` for clarity.
- Improved query performance and excluded rejected/archived services from ongoing list. (#299)

#### Removed

5 changes: 3 additions & 2 deletions conf/first_install_tables.json
Original file line number Diff line number Diff line change
@@ -20184,7 +20184,7 @@
"state_value": "delivered",
"state_display": "Delivered",
"description": "Service wascompleted and results were sent to the user",
"show_in_stats": false
"show_in_stats": true
}
},
{
@@ -20203,7 +20203,8 @@
"fields": {
"state_value": "on_hold",
"state_display": "On hold",
"description": "Resolution is on hold, waiting for user provides more information"
"description": "Resolution is on hold, waiting for user provides more information",
"show_in_stats": true
}
}
,
2 changes: 1 addition & 1 deletion conf/template_settings.txt
Original file line number Diff line number Diff line change
@@ -191,7 +191,7 @@ CRONJOBS = [
CRONTAB_COMMAND_SUFFIX = "2>&1"

DEFAULT_AUTO_FIELD = "django.db.models.AutoField"
DATA_UPLOAD_MAX_MEMORY_SIZE = 7000000
DATA_UPLOAD_MAX_MEMORY_SIZE = 10000000

# Needed when using a proxy for https forwading
SECURE_PROXY_SSL_HEADER = ('HTTP_X_FORWARDED_PROTO', 'https')
2 changes: 1 addition & 1 deletion drylab/models.py
Original file line number Diff line number Diff line change
@@ -307,7 +307,7 @@ def get_creation_date(self, format=True):
else:
return self.service_created_date

def get_delivery_date(self, format=True):
def get_delivered_date(self, format=True):
if self.service_delivered_date:
if format:
return self.service_delivered_date.strftime("%Y-%m-%d")
12 changes: 5 additions & 7 deletions drylab/templates/drylab/add_delivery.html
Original file line number Diff line number Diff line change
@@ -9,16 +9,14 @@
<section class="iskylims d-flex flex-column fill-height">
<div class="container-md">
{% include 'registration/login_inline.html' %}
{% if ERROR %}
{% if error_message %}
<div class="row justify-content-center pb-2 pt-2">
<div class="col-md-8">
<div class="card">
<div class="card-header">
<h3> Result of your request</h3>
</div>
<div class="card border-danger mb-3">
<div class="card-header">ERROR</div>
<div class="card-body">
{% for message in ERROR %}
<p>{{message}}</p>
{% for values in error_message %}
<h4>{{values}}</h4>
{% endfor %}
</div>
</div>
12 changes: 5 additions & 7 deletions drylab/templates/drylab/add_in_progress.html
Original file line number Diff line number Diff line change
@@ -8,16 +8,14 @@
<section class="iskylims d-flex flex-column fill-height">
<div class="container-md">
{% include 'registration/login_inline.html' %}
{% if ERROR %}
{% if error_message %}
<div class="row justify-content-center pb-2 pt-2">
<div class="col-md-8">
<div class="card">
<div class="card-header">
<h3> Result of your request</h3>
</div>
<div class="card border-danger mb-3">
<div class="card-header">ERROR</div>
<div class="card-body">
{% for message in ERROR %}
<p>{{message}}</p>
{% for values in error_message %}
<h4>{{values}}</h4>
{% endfor %}
</div>
</div>
12 changes: 5 additions & 7 deletions drylab/templates/drylab/add_on_hold.html
Original file line number Diff line number Diff line change
@@ -8,16 +8,14 @@
<section class="iskylims d-flex flex-column fill-height">
<div class="container-md">
{% include 'registration/login_inline.html' %}
{% if ERROR %}
{% if error_message %}
<div class="row justify-content-center pb-2 pt-2">
<div class="col-md-8">
<div class="card">
<div class="card-header">
<h3> Result of your request</h3>
</div>
<div class="card border-danger mb-3">
<div class="card-header">ERROR</div>
<div class="card-body">
{% for message in ERROR %}
<p>{{message}}</p>
{% for values in error_message %}
<h4>{{values}}</h4>
{% endfor %}
</div>
</div>
20 changes: 10 additions & 10 deletions drylab/templates/drylab/add_resolution.html
Original file line number Diff line number Diff line change
@@ -6,19 +6,19 @@
<section class="iskylims d-flex flex-column fill-height">
<div class="container-md">
{% include 'registration/login_inline.html' %}
{% if ERROR %}
<div class="row justify-content-center pb-2 pt-2">
<div class="col-md-8">
<div class="card">
<div class="card-header">
<h3>Result of your request</h3>
</div>
<div class="card-body">
{% for message in ERROR %}<p>{{ message }}</p>{% endfor %}
</div>
{% if error_message %}
<div class="row justify-content-center pb-2 pt-2">
<div class="col-md-8">
<div class="card border-danger mb-3">
<div class="card-header">ERROR</div>
<div class="card-body">
{% for values in error_message %}
<h4>{{values}}</h4>
{% endfor %}
</div>
</div>
</div>
</div>
{% endif %}
<div class="row justify-content-center pb-2 pt-2">
<div class="col-md-8">
5 changes: 3 additions & 2 deletions drylab/utils/deliveries.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
# Generic imports
import datetime
from smtplib import SMTPException

import django.core.mail

@@ -133,6 +134,6 @@ def send_delivery_service_email(email_data):
to_users = [email_data["user_email"], email_data["user_email"], notification_user]
try:
django.core.mail.send_mail(subject, body_message, from_user, to_users)
except Exception:
pass
except (SMTPException, ConnectionRefusedError):
raise
return
12 changes: 6 additions & 6 deletions drylab/utils/resolutions.py
Original file line number Diff line number Diff line change
@@ -466,8 +466,8 @@ def send_resolution_creation_email(email_data):
]
try:
django.core.mail.send_mail(subject, body_message, from_user, to_users)
except SMTPException:
pass
except (SMTPException, ConnectionRefusedError):
raise
return


@@ -514,8 +514,8 @@ def send_resolution_in_progress_email(email_data):
to_users = [email_data["user_email"], notification_user]
try:
django.core.mail.send_mail(subject, body_message, from_user, to_users)
except SMTPException:
pass
except (SMTPException, ConnectionRefusedError):
raise
return


@@ -562,8 +562,8 @@ def send_resolution_on_hold_email(email_data):
to_users = [email_data["user_email"], notification_user]
try:
django.core.mail.send_mail(subject, body_message, from_user, to_users)
except SMTPException:
pass
except (SMTPException, ConnectionRefusedError):
raise
return


99 changes: 78 additions & 21 deletions drylab/views.py
Original file line number Diff line number Diff line change
@@ -3,12 +3,13 @@
import json
import os
from datetime import date, datetime
from smtplib import SMTPException

import django.contrib.auth.models
from django.conf import settings
from django.contrib.auth.decorators import login_required
from django.core.files.storage import FileSystemStorage
from django.db.models import Prefetch, Count
from django.db.models import Count, Prefetch
from django.http import HttpResponse
from django.shortcuts import redirect, render

@@ -47,25 +48,33 @@ def index(request):
s_info.append(r_service_obj.get_user_name())
service_list["recorded"].append(s_info)

if (
drylab.models.Service.objects.all()
.exclude(service_state__state_value__exact="delivered")
.exclude(service_approved_date=None)
.exists()
):
ongoing_services_objs = (
drylab.models.Service.objects.all()
.exclude(service_state__state_value__exact="delivered")
.exclude(service_approved_date=None)
.order_by("service_approved_date")
# Fetch the excluded states
excluded_states = ["delivered", "rejected", "archived"]

# Check if there are ongoing resolutions
if drylab.models.Resolution.objects.exclude(
resolution_state__state_value__in=excluded_states
).exists():
# Get resolutions excluding delivered, rejected, and archived
ongoing_resolutions = (
drylab.models.Resolution.objects.exclude(
resolution_state__state_value__in=excluded_states
)
.select_related(
"resolution_state", "resolution_service_id"
) # Optimize DB joins
.order_by("resolution_estimated_date") # Order by estimated delivery date
)

service_list["ongoing"] = []

for ongoing_services_obj in ongoing_services_objs:
s_info = []
s_info.append(ongoing_services_obj.get_identifier())
s_info.append(ongoing_services_obj.get_delivery_date())
for resolution in ongoing_resolutions:
s_info = [
resolution.get_identifier(), # Keep service identifier from resolution
resolution.get_resolution_estimated_date(), # Use estimated delivery date
]
service_list["ongoing"].append(s_info)

org_name = drylab.utils.common.get_configuration_from_database("ORGANIZATION_NAME")

return render(
@@ -784,10 +793,22 @@ def add_on_hold(request):
email_data["user_email"] = service_obj.get_user_email()
email_data["user_name"] = service_obj.get_user_name()
email_data["resolution_number"] = resolution_number
drylab.utils.resolutions.send_resolution_in_progress_email(email_data)

on_hold_resolution = {}
on_hold_resolution["resolution_number"] = resolution_number

try:
drylab.utils.resolutions.send_resolution_on_hold_email(email_data)
except (SMTPException, ConnectionRefusedError):
return render(
request,
"drylab/add_on_hold.html",
{
"on_hold_resolution": on_hold_resolution,
"error_message": ["Unable to send confirmation email."],
},
)

return render(
request,
"drylab/add_on_hold.html",
@@ -842,12 +863,23 @@ def add_resolution(request):
email_data["date"] = resolution_data_form["resolution_estimated_date"]
# include the email for the user who requested the service
email_data["service_owner_email"] = new_resolution.get_service_owner_email()
drylab.utils.resolutions.send_resolution_creation_email(email_data)

created_resolution = {}
created_resolution["resolution_number"] = resolution_data_form[
"resolution_number"
]
# Display pipeline parameters

try:
drylab.utils.resolutions.send_resolution_creation_email(email_data)
except (SMTPException, ConnectionRefusedError):
return render(
request,
"drylab/add_resolution.html",
{
"created_resolution": created_resolution,
"error_message": ["Unable to send confirmation email."],
},
)

return render(
request,
@@ -932,9 +964,22 @@ def add_in_progress(request):
email_data["user_email"] = service_obj.get_user_email()
email_data["user_name"] = service_obj.get_user_name()
email_data["resolution_number"] = resolution_number
drylab.utils.resolutions.send_resolution_in_progress_email(email_data)

in_progress_resolution = {}
in_progress_resolution["resolution_number"] = resolution_number

try:
drylab.utils.resolutions.send_resolution_in_progress_email(email_data)
except (SMTPException, ConnectionRefusedError):
return render(
request,
"drylab/add_in_progress.html",
{
"in_progress_resolution": in_progress_resolution,
"error_message": ["Unable to send confirmation email."],
},
)

return render(
request,
"drylab/add_in_progress.html",
@@ -1018,13 +1063,25 @@ def add_delivery(request):
email_data["user_name"] = request.user.username
email_data["resolution_number"] = delivery_recorded["resolution_number"]
email_data["service_owner_email"] = resolution_obj.get_service_owner_email()
drylab.utils.deliveries.send_delivery_service_email(email_data)

if drylab.utils.resolutions.check_allow_service_update(
resolution_obj, "delivered"
):
service_obj = resolution_obj.get_service_obj()
service_obj = service_obj.update_state("delivered")
service_obj.update_delivered_date(date.today())

try:
drylab.utils.deliveries.send_delivery_service_email(email_data)
except (SMTPException, ConnectionRefusedError):
return render(
request,
"drylab/add_delivery.html",
{
"delivery_recorded": delivery_recorded,
"error_message": ["Unable to send confirmation email."],
},
)
return render(
request,
"drylab/add_delivery.html",