Skip to content

Commit

Permalink
Merge branch 'wamtram2' into master
Browse files Browse the repository at this point in the history
  • Loading branch information
ehallein authored Dec 18, 2023
2 parents 2b6eb4d + ebd8cf1 commit c36d8f9
Show file tree
Hide file tree
Showing 59 changed files with 4,542 additions and 3,034 deletions.
10 changes: 5 additions & 5 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ LABEL org.opencontainers.image.source https://github.com/dbca-wa/wastd

RUN apt-get update -y \
&& apt-get upgrade -y \
&& apt-get install -y libmagic-dev gcc binutils gdal-bin proj-bin python3-dev libpq-dev gzip curl gnupg2
&& apt-get install -y memcached libmagic-dev gcc binutils gdal-bin proj-bin python3-dev libpq-dev gzip curl gnupg2

# Install the Microsoft ODBC driver for SQL Server.
# Reference: https://learn.microsoft.com/en-us/sql/connect/odbc/linux-mac/installing-the-microsoft-odbc-driver-for-sql-server?view=sql-server-ver16#debian18
Expand All @@ -31,16 +31,16 @@ RUN poetry config virtualenvs.create false \

# Install the project.
FROM python_libs_wastd
COPY gunicorn.py manage.py ./
COPY gunicorn.py manage.py run.sh ./
RUN chmod +x run.sh
COPY observations ./observations
COPY users ./users
COPY wastd ./wastd
COPY wamtram ./wamtram
COPY turtle_tags ./turtle_tags
COPY wamtram2 ./wamtram2
COPY marine_mammal_incidents ./marine_mammal_incidents
RUN python manage.py collectstatic --noinput

# Run the application as the www-data user.
USER www-data
EXPOSE 8080
CMD ["gunicorn", "wastd.wsgi", "--config", "gunicorn.py"]
ENTRYPOINT [ "sh","run.sh" ]
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
# Generated by Django 4.2.8 on 2023-12-14 03:55

from django.db import migrations, models
import django.db.models.deletion


class Migration(migrations.Migration):

dependencies = [
("contenttypes", "0002_remove_content_type_name"),
("observations", "0012_alter_encounter_encounter_type"),
]

operations = [
migrations.AlterField(
model_name="encounter",
name="polymorphic_ctype",
field=models.ForeignKey(
editable=False,
null=True,
on_delete=django.db.models.deletion.CASCADE,
related_name="polymorphic_%(app_label)s.%(class)s_set+",
to="contenttypes.contenttype",
),
),
migrations.AlterField(
model_name="observation",
name="polymorphic_ctype",
field=models.ForeignKey(
editable=False,
null=True,
on_delete=django.db.models.deletion.CASCADE,
related_name="polymorphic_%(app_label)s.%(class)s_set+",
to="contenttypes.contenttype",
),
),
]
22 changes: 11 additions & 11 deletions observations/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
from django.contrib.gis.db import models
from django.template import loader
from django.urls import reverse
from django.utils.encoding import force_text
from django.utils.encoding import force_str
from django.utils.safestring import mark_safe
from django_fsm import FSMField, transition
from django_fsm_log.decorators import fsm_log_by, fsm_log_description
Expand Down Expand Up @@ -814,7 +814,7 @@ def __str__(self):
def filepath(self):
"""The path to attached file."""
try:
fpath = force_text(self.attachment.file)
fpath = force_str(self.attachment.file)
except BaseException:
fpath = None
return fpath
Expand Down Expand Up @@ -1271,8 +1271,8 @@ def short_name(self):
"-".join(
[
self.when.astimezone(tz.tzlocal()).strftime("%Y-%m-%d %H:%M %Z"),
force_text(round(self.longitude, 4)).replace(".", "-"),
force_text(round(self.latitude, 4)).replace(".", "-"),
force_str(round(self.longitude, 4)).replace(".", "-"),
force_str(round(self.latitude, 4)).replace(".", "-"),
]
)
)
Expand Down Expand Up @@ -1686,8 +1686,8 @@ def short_name(self):
"""
nameparts = [
self.when.astimezone(tz.tzlocal()).strftime("%Y-%m-%d %H:%M %Z"),
force_text(round(self.longitude, 4)).replace(".", "-"),
force_text(round(self.latitude, 4)).replace(".", "-"),
force_str(round(self.longitude, 4)).replace(".", "-"),
force_str(round(self.latitude, 4)).replace(".", "-"),
self.health,
self.maturity,
self.sex,
Expand Down Expand Up @@ -1868,8 +1868,8 @@ def short_name(self):
"""
nameparts = [
self.when.astimezone(tz.tzlocal()).strftime("%Y-%m-%d %H:%M %Z"),
force_text(round(self.longitude, 4)).replace(".", "-"),
force_text(round(self.latitude, 4)).replace(".", "-"),
force_str(round(self.longitude, 4)).replace(".", "-"),
force_str(round(self.latitude, 4)).replace(".", "-"),
self.nest_age,
self.species,
]
Expand Down Expand Up @@ -2025,7 +2025,7 @@ def __str__(self):
def filepath(self):
"""The path to attached file."""
try:
fpath = force_text(self.attachment.file)
fpath = force_str(self.attachment.file)
except BaseException:
fpath = None
return fpath
Expand Down Expand Up @@ -3117,8 +3117,8 @@ def short_name(self):
"""
nameparts = [
self.when.astimezone(tz.tzlocal()).strftime("%Y-%m-%d %H:%M %Z"),
force_text(round(self.longitude, 4)).replace(".", "-"),
force_text(round(self.latitude, 4)).replace(".", "-"),
force_str(round(self.longitude, 4)).replace(".", "-"),
force_str(round(self.latitude, 4)).replace(".", "-"),
]
if self.name is not None:
nameparts.append(self.name)
Expand Down
6 changes: 5 additions & 1 deletion observations/odk.py
Original file line number Diff line number Diff line change
Expand Up @@ -428,8 +428,12 @@ def import_turtle_track_or_nest(form_id="turtle_track_or_nest", auth_headers=Non
outlier_obs = TurtleHatchlingEmergenceOutlierObservation(
encounter=encounter,


bearing_outlier_track_degrees=float(outlier['outlier_track_bearing_manual']) if outlier['outlier_track_bearing_manual'] else None,
r




outlier_group_size=int(outlier['outlier_group_size']) if outlier['outlier_group_size'] else None,
outlier_track_comment=outlier['outlier_track_comment'],
)
Expand Down
Loading

0 comments on commit c36d8f9

Please sign in to comment.