Skip to content
Open
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
12 changes: 6 additions & 6 deletions tvapi/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# # Things that can be cached
# Base Configurations
FROM python:3.10 as build
ENV PYTHONNUNBUFFERED 1
FROM python:3.13 AS build
ENV PYTHONUNBUFFERED=1
WORKDIR /django
# set up the cronlog
RUN mkdir /cronlogs
Expand All @@ -26,10 +26,10 @@ COPY . .
RUN python manage.py makemigrations
# Initalise the database
RUN python manage.py migrate --noinput
# make a superuser the Django database when all these aguments are passed in
ARG DJANGO_SUPERUSER_USERNAME=$DJANGO_SUPERUSER_USERNAME
ARG DJANGO_SUPERUSER_PASSWORD=$DJANGO_SUPERUSER_PASSWORD
ARG DJANGO_SUPERUSER_EMAIL=$DJANGO_SUPERUSER_EMAIL
# make a superuser in the Django database when all these aguments are passed in
ARG DJANGO_SUPERUSER_USERNAME=dbadmin
ARG DJANGO_SUPERUSER_EMAIL=""
ARG DJANGO_SUPERUSER_PASSWORD=""
RUN python manage.py createsuperuser --noinput
# collect the static files
RUN python manage.py collectstatic --clear --noinput
Expand Down
24 changes: 14 additions & 10 deletions tvapi/api/survey/find.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,8 +66,11 @@ def parse_ufm_name(ufm_dir: str) -> Tuple[str, int, str]:
return ufm_letter, ufm_number, ufm_label


def parse_action_name(action_dir: str) -> Tuple[Union[int, None], str]:
timestamp_str, action_type = action_dir.split('_', 1)
def parse_action_name(action_dir: str) -> Tuple[Union[int, None], Union[str, None]]:
if '_' in action_dir:
timestamp_str, action_type = action_dir.split('_', 1)
else:
timestamp_str, action_type = action_dir, None
if timestamp_str.lower().strip() == 'none':
timestamp = None
else:
Expand Down Expand Up @@ -145,15 +148,16 @@ def smurf(timestamp_min: int, timestamp_max: int, smurf_data_path: str, platform
for action_dir in os.listdir(full_path_ufm_dir):
full_path_action_dir = os.path.join(full_path_ufm_dir, action_dir)
timestamp_int, action_type = parse_action_name(action_dir)
if isinstance(timestamp_int, int):
if timestamp_int < timestamp_min or timestamp_int > timestamp_max:
# this data is outside the requested time range
continue
else:
# this is a special case where the timestamp is None
# add this file to the ignored folders database
if timestamp_int is None or action_type is None:
# This catches dirnames of the forms
# - none_{action}
# - {timestamp}
# Both are special cases we just want to add to ignored folders list.
log_excluded_dir(dir_type='smurf', dir_path=full_path_action_dir,
reason='Not able to parse timestamp, timestamp was None')
reason='Not able to parse timestamp or action_type')
continue
if timestamp_int < timestamp_min or timestamp_int > timestamp_max:
# this data is outside the requested time range
continue
scan_timestamp = time()
last_modified_max, data_files_by_type = get_results_files(parent_dir=full_path_action_dir)
Expand Down