Skip to content

Commit

Permalink
Merge branch 'refs/heads/main' into performances-seen-unseen
Browse files Browse the repository at this point in the history
  • Loading branch information
niconoe committed Nov 8, 2024
2 parents 4066f08 + f33e155 commit de97705
Show file tree
Hide file tree
Showing 8 changed files with 840 additions and 709 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
# v1.7.7 (2024-11-07)

- Fixed a bg with the maps API (see https://github.com/riparias/gbif-alert/issues/283)

# v1.7.6 (2024-07-26)

- Another map performance improvement (missing index)
Expand Down
6 changes: 3 additions & 3 deletions INSTALL.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,14 +44,14 @@ properly configured.
### Prerequisites

- Make sure [Docker](https://docs.docker.com/get-docker/) is installed on your system
- Identify the latest release of GBIF Alert on GitHub at https://github.com/riparias/gbif-alert/tags (currently [v1.7.6](https://github.com/riparias/gbif-alert/releases/tag/v1.7.6))
- Identify the latest release of GBIF Alert on GitHub at https://github.com/riparias/gbif-alert/tags (currently [v1.7.7](https://github.com/riparias/gbif-alert/releases/tag/v1.7.7))

### Installation steps

- Create a new directory on your system, e.g. `invasive-fishes-nz` following the example above.
- Go to the `docker-compose.yml` file from the latest release of GBIF Alert on GitHub: at the moment https://github.com/riparias/gbif-alert/blob/v1.7.6/docker-compose.yml (note that the URL contains the version number).
- Go to the `docker-compose.yml` file from the latest release of GBIF Alert on GitHub: at the moment https://github.com/riparias/gbif-alert/blob/v1.7.7/docker-compose.yml (note that the URL contains the version number).
- Save the file in the directory you have just created.
- Go to the `local_settings_docker.template.py` file from the latest release of GBIF Alert on GitHub: at the moment https://github.com/riparias/gbif-alert/blob/v1.7.6/djangoproject/local_settings_docker.template.py.
- Go to the `local_settings_docker.template.py` file from the latest release of GBIF Alert on GitHub: at the moment https://github.com/riparias/gbif-alert/blob/v1.7.7/djangoproject/local_settings_docker.template.py.
- Save the file in the directory you have just created.
- Rename this file to `local_settings_docker.py`.
- Open a terminal, navigate to the `invasive-fishes-nz` directory and run the following command: `docker-compose up`.
Expand Down
15 changes: 15 additions & 0 deletions dashboard/tests/views/test_maps.py
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,21 @@ def setUpTestData(cls):
class MinMaxPerHexagonTests(MapsTestDataMixin, TestCase):
"""Tests covering the min_max_in_hexagon endpoint"""

def test_min_max_status_area_combinations(self):
"""Regression test for https://github.com/riparias/gbif-alert/issues/283"""
self.client.login(username="frusciante", password="12345")

response = self.client.get(
reverse("dashboard:internal-api:maps:mvt-min-max-per-hexagon"),
data={
"zoom": 8,
"status": "seen",
"areaIds[]": self.public_area_andenne.pk,
},
)

self.assertEqual(response.status_code, 200)

def test_min_max_per_hexagon(self):
# At zoom level 8, with the initial data: we should have two polygons, both at 1. So min=1 and max=1
response = self.client.get(
Expand Down
6 changes: 5 additions & 1 deletion dashboard/views/maps.py
Original file line number Diff line number Diff line change
Expand Up @@ -251,7 +251,11 @@ def observation_min_max_in_hex_grid_json(request: HttpRequest):
LEFT JOIN dashboard_species as species ON obs.species_id = species.id
{% if area_ids %}
,(SELECT mpoly FROM $areas_table_name WHERE $areas_table_name.id IN {{ area_ids | inclause }}) AS areas
LEFT JOIN (
SELECT mpoly
FROM $areas_table_name
WHERE $areas_table_name.id IN {{ area_ids | inclause }}
) AS areas ON ST_Within(obs.location, areas.mpoly)
{% endif %}
{% if status == 'unseen' %}
INNER JOIN $observationunseen_table_name
Expand Down
6 changes: 3 additions & 3 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ version: '3'

services:
nginx:
image: niconoe/gbif-alert-nginx:1.7.6
image: niconoe/gbif-alert-nginx:1.7.7
ports:
- "1337:80"
depends_on:
Expand All @@ -28,7 +28,7 @@ services:
expose:
- 6379
gbif-alert:
image : niconoe/gbif-alert:1.7.6
image : niconoe/gbif-alert:1.7.7
expose:
- 8000
depends_on:
Expand All @@ -44,7 +44,7 @@ services:
target: /app/djangoproject/local_settings_docker.py
read_only: true
rqworker:
image: niconoe/gbif-alert:1.7.6
image: niconoe/gbif-alert:1.7.7
entrypoint: poetry run python manage.py rqworker default
depends_on:
db:
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "gbif-alert",
"version": "1.7.6",
"version": "1.7.7",
"description": "[![Django CI](https://github.com/riparias/early-alert-webapp/actions/workflows/django_tests.yml/badge.svg)](https://github.com/riparias/early-warning-webapp/actions/workflows/django_tests.yml)",
"main": "index.js",
"scripts": {
Expand Down
Loading

0 comments on commit de97705

Please sign in to comment.