From a9fbed65316a5392e7cff395e04ced14d9c6d4b6 Mon Sep 17 00:00:00 2001 From: Tinashe <70011086+tinashechiraya@users.noreply.github.com> Date: Tue, 21 May 2024 18:06:55 +0200 Subject: [PATCH 1/3] patch: check username directly --- .../src/components/Observations/index.tsx | 7 ------- 1 file changed, 7 deletions(-) diff --git a/django_project/minisass_frontend/src/components/Observations/index.tsx b/django_project/minisass_frontend/src/components/Observations/index.tsx index 5eee7e05e..83fa1375a 100644 --- a/django_project/minisass_frontend/src/components/Observations/index.tsx +++ b/django_project/minisass_frontend/src/components/Observations/index.tsx @@ -99,13 +99,6 @@ const Observations: React.FC = (props) => { size="txtRalewayBold18Green800" > {( - props?.organisation.length > 35 || - props?.usernamejimtaylOne.length > 35 - ) ? ( - props?.username.length > 15 ? - `${props.username.substring(0, 15)}...` : - props.username - ) : ( props?.username.length > 23 ? `${props.username.substring(0, 20)}...` : props.username From 8574567c1c9e353227997fe45f1b31681ab0ebdb Mon Sep 17 00:00:00 2001 From: Tinashe <70011086+tinashechiraya@users.noreply.github.com> Date: Wed, 22 May 2024 09:14:37 +0200 Subject: [PATCH 2/3] patch: log errors of silent fail --- .../management/commands/clean_up_db.py | 21 ++++++++++++------- 1 file changed, 13 insertions(+), 8 deletions(-) diff --git a/django_project/minisass/management/commands/clean_up_db.py b/django_project/minisass/management/commands/clean_up_db.py index 79702a726..2483345ef 100644 --- a/django_project/minisass/management/commands/clean_up_db.py +++ b/django_project/minisass/management/commands/clean_up_db.py @@ -15,6 +15,7 @@ from django.contrib.sites.models import Site from django.db.models import F, Count, Q from django.db.models.functions import TruncDate +import logging class Command(BaseCommand): @@ -118,11 +119,15 @@ def send_notification_email(self, user): 'user': user, 'login_url': login_url, }) - send_mail( - subject, - message, - settings.CONTACT_US_RECEPIENT_EMAIL, - [user.email], - fail_silently=False, - html_message=message, - ) + try: + send_mail( + subject, + message, + settings.CONTACT_US_RECEPIENT_EMAIL, + [user.email], + fail_silently=False, # Log the error instead of failing silently + html_message=message, + ) + except Exception as e: + logger = logging.getLogger(__name__) + logger.error(f"Failed to send notification email to {user.email}: {e}") From 98b19ba0b3c3635ec01f655c1c68cc04fea8baf3 Mon Sep 17 00:00:00 2001 From: Tinashe <70011086+tinashechiraya@users.noreply.github.com> Date: Wed, 22 May 2024 10:34:03 +0200 Subject: [PATCH 3/3] patch: enable test and debug issues --- deployment/docker/entrypoint.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/deployment/docker/entrypoint.sh b/deployment/docker/entrypoint.sh index 30053e63e..27fa2b8e0 100755 --- a/deployment/docker/entrypoint.sh +++ b/deployment/docker/entrypoint.sh @@ -62,8 +62,8 @@ psql -d "${DJANGO_DB}" -p 5432 -U "${POSTGRES_USER}" -h "${DATABASE_HOST}" -c "U # echo 'Running tests.' # Drop test DB if exists -# psql -d "${DJANGO_DB}" -p 5432 -U "${POSTGRES_USER}" -h "${DATABASE_HOST}" -c "DROP DATABASE IF EXISTS test_${DJANGO_DB};" -# python manage.py test +psql -d "${DJANGO_DB}" -p 5432 -U "${POSTGRES_USER}" -h "${DATABASE_HOST}" -c "DROP DATABASE IF EXISTS test_${DJANGO_DB};" +python manage.py test psql -d "${DJANGO_DB}" -p 5432 -U "${POSTGRES_USER}" -h "${DATABASE_HOST}" -f /home/web/django_project/webmapping/sql/observation.sql