From 404a88d5c81021576028ea75986cc5f4f7084e1c Mon Sep 17 00:00:00 2001 From: Jarid Prince <109533655+idabblewith@users.noreply.github.com> Date: Fri, 6 Sep 2024 11:59:58 +0800 Subject: [PATCH] fix: update to show only bcs and run migrations --- Dockerfile | 3 +++ entrypoint.sh | 7 ++++++- users/views.py | 5 ++++- 3 files changed, 13 insertions(+), 2 deletions(-) diff --git a/Dockerfile b/Dockerfile index c1bb6a0..7f93a5a 100644 --- a/Dockerfile +++ b/Dockerfile @@ -46,6 +46,9 @@ ENV PATH="${PATH}:/usr/lib/prince/bin" # Delete non-commercial license of Prince RUN rm -f /usr/lib/prince/license/license.dat +# Create a symlink to the commercial license file +# Assumes that a valid Prince commercial license file is available in the backend/files directory +# Current license is set to expire on 31.05.2025 RUN ln -s /usr/src/app/backend/files/license.dat /usr/lib/prince/license/license.dat # ====================== DEV FILES AND DEPENDENCIES ====================== diff --git a/entrypoint.sh b/entrypoint.sh index 744f5b0..9bc3160 100644 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -18,8 +18,13 @@ # Output the license template to license.dat # echo "$LICENSE_TEMPLATE" > /usr/lib/prince/license/license.dat +echo "Creating license.dat symlink..." ln -s /usr/src/app/backend/files/license.dat /usr/lib/prince/license/license.dat - + +# Run Django migrations +echo "Running Django migrations..." +python manage.py makemigrations +python manage.py migrate # Launch backend (moved from Dockerfile to run after securely setting Prince license) echo "Launching gunicorn..." diff --git a/users/views.py b/users/views.py index 7a77961..2549fee 100644 --- a/users/views.py +++ b/users/views.py @@ -680,7 +680,10 @@ def get(self, req): user.unit = user_data.get("unit") user.location = user_data.get("location") user.position = user_data.get("title") - updated_users.append(user) + + # Filter users based on BCS division + if user.division == "Biodiversity and Conservation Science": + updated_users.append(user) total_users = len(updated_users) total_pages = ceil(total_users / page_size)