Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Release : 2.15.3 #3355

Merged
merged 26 commits into from
Feb 14, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
223f5cc
update VERSION
jacquesfize Feb 3, 2025
ce9e83e
update changelog
jacquesfize Feb 3, 2025
24736c9
change install_ini
jacquesfize Feb 3, 2025
1c70a3d
update Makefile
jacquesfize Feb 3, 2025
c481e35
minor fixe on the documentation
jacquesfize Feb 3, 2025
ed800ad
fix(synthese): fix bdc status filter with blurring permissions
VincentCauchois Jan 30, 2025
e2a8d0c
fix(synthese): order by descending date_min and id_synthese
VincentCauchois Jan 30, 2025
e462c2b
update changelog
jacquesfize Feb 3, 2025
e2809e6
bump UH-AM 3.0.2
jacquesfize Feb 10, 2025
07f7820
fix(public access): fix #3353 + hack to disable auth/logout redirecti…
jacquesfize Feb 10, 2025
67238ad
fix (makefile): remove dupplicate target
jacquesfize Feb 10, 2025
00f83c3
fix(taxhub): taxhub button is now enable again in the left menu. set …
jacquesfize Feb 10, 2025
fdf9bce
fix(metadata): refresh form is now effective on the search bar
jacquesfize Feb 10, 2025
40557b5
feat(import): refact translation use in mapping steps
jacquesfize Feb 11, 2025
d027fe6
lint
jacquesfize Feb 11, 2025
34d2bd6
fix(synthese) :Fix area filter (#3372)
jacquesfize Feb 11, 2025
31b44ac
bump TaxHub to 2.1.2
jacquesfize Feb 13, 2025
31c6126
fix (taxhub): fix bad use of urljoin
jacquesfize Feb 13, 2025
71745ea
fix: fix entities counts in the final report
jacquesfize Feb 13, 2025
27d5a68
add black in dev requirements #3162
jacquesfize Feb 13, 2025
1b42747
fix(documentation): apply function name changes
jacquesfize Feb 13, 2025
2d049ee
feat(import): add loading in the mapping field section
jacquesfize Feb 14, 2025
420c492
fix makefile
jacquesfize Feb 14, 2025
716543e
fix logout error
jacquesfize Feb 14, 2025
5a27c76
feat(requirements): add missing update of UH-AM
jacquesfize Feb 14, 2025
9940818
update changelog
jacquesfize Feb 14, 2025
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: 8 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ PG_USER_PASSWD ?= gn_passwd

GEONATURE_APP_NAME ?= 'DEV'

WITH_SAMPLE_DATA ?= true
WITH_SAMPLE_DATA ?= false

MODULE_DASHBOARD_TAG ?= 1.5.0
MODULE_EXPORT_TAG ?= 1.7.2
Expand All @@ -38,7 +38,7 @@ GEONATURE_LOCAL_CONFIG_FILE = config/geonature_config.toml

GEONATURE_DEFAULT_SETTING_FILE = config/settings.ini.sample
GEONATURE_LOCAL_SETTING_FILE = config/settings.ini
GEONATURE_APP_SECRET_KEY ?= '8551a7a-64a4-4216-bda4-9a919fcc7a27'
GEONATURE_APP_SECRET_KEY ?= 'yoursecretkey'

SUPERGRANT_GROUP ?= "Grp_admin"

Expand Down Expand Up @@ -154,11 +154,15 @@ db_status:
autoupgrade:
source backend/venv/bin/activate && geonature db autoupgrade

compile_requirements:
source backend/venv/bin/activate && cd backend && piptools compile requirements.in
source backend/venv/bin/activate && cd backend && piptools compile requirements-dev.in

test_frontend:
cd frontend && source ~/.nvm/nvm.sh && nvm use && npm run cypress:run
. ${NVM_DIR}/nvm.sh; cd frontend; nvm use && npm run cypress:run

lint_frontend:
cd frontend && source ~/.nvm/nvm.sh && nvm use && npm run format
. ${NVM_DIR}/nvm.sh; cd frontend; nvm use; npm run format

lint_backend:
source backend/venv/bin/activate && black .
Expand Down
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
2.15.2
2.15.3
5 changes: 4 additions & 1 deletion backend/geonature/core/errors.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,10 @@ def handle_unauthenticated_request(e):
else:
base_url = current_app.config["URL_APPLICATION"]
login_path = "/#/login" # FIXME: move in config
query_string = urlencode({"next": request.url})
query_string = ""
if not request.url.endswith("/auth/logout"): # TODO : remove this hack
query_string = urlencode({"next": request.url})

return redirect(f"{base_url}{login_path}?{query_string}")


Expand Down
5 changes: 5 additions & 0 deletions backend/geonature/core/gn_commons/routes.py
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,11 @@ def list_modules():
"" if module.active_frontend else module.module_external_url
)
module_dict["module_url"] = module.module_path if module.active_frontend else ""

# Setup manually TAXHUB URL
if module_dict["module_code"] == "TAXHUB":
module_dict["module_external_url"] = f"{config['API_ENDPOINT']}/admin"

module_dict["module_objects"] = {}
# get cruved for each object
for obj_dict in module_dict["objects"]:
Expand Down
14 changes: 9 additions & 5 deletions backend/geonature/core/gn_synthese/utils/blurring.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ def build_blurred_precise_geom_queries(
columns.append(sa.literal(0).label("size_hierarchy"))
precise_geom_query = SyntheseQuery(
Synthese,
sa.select(*columns).where(sa.and_(*where_clauses)).order_by(Synthese.id_synthese.desc()),
sa.select(*columns).where(sa.and_(*where_clauses)).order_by(Synthese.date_min.desc()),
filters=dict(filters), # not to edit the actual filter object
)

Expand Down Expand Up @@ -100,14 +100,14 @@ def build_blurred_precise_geom_queries(
== Synthese.id_nomenclature_sensitivity
)
.where(sa.and_(*where_clauses))
.order_by(Synthese.id_synthese.desc()),
.order_by(Synthese.date_min.desc()),
filters=dict(filters),
query_joins=sa.join(
Synthese,
CorAreaSyntheseAlias,
CorAreaSyntheseAlias.id_synthese == Synthese.id_synthese,
),
geom_column=LAreas.geom_4326,
geom_column=LAreas.geom,
)
# Joins here are needed to retrieve the blurred geometry
blurred_geom_query.add_join(LAreasAlias, LAreasAlias.id_area, CorAreaSyntheseAlias.id_area)
Expand Down Expand Up @@ -182,8 +182,12 @@ def build_synthese_obs_query(observations, allowed_geom_cte, limit):
allowed_geom_cte, allowed_geom_cte.c.id_synthese == VSyntheseForWebApp.id_synthese
)
)
.order_by(VSyntheseForWebApp.id_synthese, allowed_geom_cte.c.priority)
.distinct(VSyntheseForWebApp.id_synthese)
.order_by(
VSyntheseForWebApp.date_min.desc(),
VSyntheseForWebApp.id_synthese.desc(),
allowed_geom_cte.c.priority,
)
.distinct(VSyntheseForWebApp.date_min, VSyntheseForWebApp.id_synthese)
.limit(limit)
)
return obs_query
47 changes: 42 additions & 5 deletions backend/geonature/core/gn_synthese/utils/query_select_sqla.py
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,14 @@ def __init__(
)
)

self.srid = DB.session.scalar(
select(
func.Find_SRID(
self.geom_column.table.schema, self.geom_column.table.name, self.geom_column.key
)
)
)

def add_join(self, right_table, right_column, left_column, join_type="right"):
if self.first:
if join_type == "right":
Expand Down Expand Up @@ -437,12 +445,18 @@ def filter_other_filters(self, user):
geo_filters = []
for feature in features:
geom_wkb = from_shape(shape(feature["geometry"]), srid=4326)
if self.srid != 4326:
geom_wkb = func.ST_Transform(
func.ST_GeogFromWKB(geom_wkb),
self.srid,
)
geom_wkb = func.ST_GeogFromWKB(geom_wkb)
# if the geom is a circle
if "radius" in feature["properties"]:
radius = feature["properties"]["radius"]
geo_filter = func.ST_DWithin(
func.ST_GeogFromWKB(self.geom_column),
func.ST_GeogFromWKB(geom_wkb),
geom_wkb,
radius,
)
else:
Expand Down Expand Up @@ -479,9 +493,31 @@ def filter_other_filters(self, user):
if colname.startswith("area"):
if self.geom_column.class_ != self.model:
l_areas_cte = LAreas.query.filter(LAreas.id_area.in_(value)).cte("area_filter")
self.query = self.query.where(
func.ST_Intersects(self.geom_column, l_areas_cte.c.geom)
)
if self.srid != 4326:
srid_l_areas = DB.session.scalar(
select(
func.Find_SRID(
LAreas.__table__.schema, LAreas.__table__.name, "geom"
)
)
)
if self.srid != srid_l_areas:
self.query = self.query.where(
func.ST_Intersects(
self.geom_column,
func.ST_Transform(l_areas_cte.c.geom, self.srid),
)
)

else:
self.query = self.query.where(
func.ST_Intersects(self.geom_column, l_areas_cte.c.geom)
)

else:
self.query = self.query.where(
func.ST_Intersects(self.geom_column, l_areas_cte.c.geom_4326)
)
else:
cor_area_synthese_alias = aliased(CorAreaSynthese)
self.add_join(
Expand Down Expand Up @@ -623,7 +659,8 @@ def build_bdc_status_filters(self, protection_status_value, red_list_filters):
func.count(distinct(bdc_status_by_type_cte.c.cd_type_statut))
== (len(protection_status_value) + len(red_list_filters))
)
bdc_status_cte = bdc_status_cte.cte(name="status")

bdc_status_cte = bdc_status_cte.cte()

# Jointure sur le taxon
# et vérification que l'ensemble des textes
Expand Down
32 changes: 23 additions & 9 deletions backend/geonature/core/imports/tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -93,15 +93,29 @@ def do_import_in_destination(self, import_id):
BibFields.name_field.in_(imprt.fieldmapping.keys()),
)
).all()
columns_to_count_unique_entities = [
transient_table.c[field.dest_column] for field in fields
]
n_valid_data = db.session.execute(
select(func.count(func.distinct(*columns_to_count_unique_entities)))
.select_from(transient_table)
.where(transient_table.c.id_import == imprt.id_import)
.where(transient_table.c[entity.validity_column] == True)
).scalar()

id_field = (
entity.unique_column.dest_field if entity.unique_column.dest_field in fields else None
)
data_fields_query = [transient_table.c[field.dest_field] for field in fields]

query = select(*data_fields_query).where(
transient_table.c.id_import == imprt.id_import,
transient_table.c[entity.validity_column] == True,
)

def count_select(query_cte):
count_ = "*"
# if multiple entities and the entity has a unique column we base the count on the unique column

if entity.unique_column and len(entities) > 1 and id_field:
count_ = func.distinct(query_cte.c[id_field])
return count_

valid_data_cte = query.cte()
n_valid_data = db.session.scalar(
select(func.count(count_select(valid_data_cte))).select_from(valid_data_cte)
)
count_entities += n_valid_data
imprt.statistics["import_count"] = count_entities

Expand Down
4 changes: 2 additions & 2 deletions backend/requirements-dependencies.in
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
pypnusershub>=3.0.1,<4
pypnusershub>=3.0.2,<4
pypnnomenclature>=1.6.4,<2
pypn_habref_api>=0.4.1,<1
utils-flask-sqlalchemy-geo>=0.3.2,<1
utils-flask-sqlalchemy>=0.4.1,<1
taxhub==2.1.1
taxhub==2.1.2
pypn-ref-geo>=1.5.3,<2
3 changes: 2 additions & 1 deletion backend/requirements-dev.in
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
-r requirements-common.in
-r requirements-submodules.in
-r requirements-submodules.in
black==24.10.0
14 changes: 14 additions & 0 deletions backend/requirements-dev.txt
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,8 @@ bcrypt==4.2.1
# via pypnusershub
billiard==4.2.1
# via celery
black==24.10.0
# via -r requirements-dev.in
blinker==1.9.0
# via
# flask
Expand All @@ -84,6 +86,7 @@ charset-normalizer==3.4.1
click==8.1.8
# via
# -r requirements-common.in
# black
# celery
# click-didyoumean
# click-plugins
Expand Down Expand Up @@ -252,6 +255,8 @@ marshmallow-sqlalchemy==1.1.1
# taxhub
# usershub
# utils-flask-sqlalchemy-geo
mypy-extensions==1.0.0
# via black
numpy==2.0.2
# via
# bokeh
Expand All @@ -261,6 +266,7 @@ numpy==2.0.2
packaging==24.2
# via
# -r requirements-common.in
# black
# bokeh
# geoalchemy2
# gunicorn
Expand All @@ -269,12 +275,16 @@ pandas==2.2.3
# via
# -r requirements-common.in
# bokeh
pathspec==0.12.1
# via black
pillow==9.5.0
# via
# -r requirements-common.in
# bokeh
# taxhub
# weasyprint
platformdirs==4.3.6
# via black
prompt-toolkit==3.0.48
# via click-repl
psycopg2==2.9.10
Expand Down Expand Up @@ -359,11 +369,14 @@ toml==0.10.2
# via
# -r requirements-common.in
# taxhub
tomli==2.2.1
# via black
tornado==6.4.2
# via bokeh
typing-extensions==4.12.2
# via
# alembic
# black
# kombu
tzdata==2024.2
# via
Expand Down Expand Up @@ -401,6 +414,7 @@ wtforms==3.1.2
# -r requirements-common.in
# flask-admin
# flask-wtf
# taxhub
# usershub
# wtforms-components
# wtforms-sqlalchemy
Expand Down
5 changes: 3 additions & 2 deletions backend/requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -255,7 +255,7 @@ pypn-ref-geo==1.5.4
# taxhub
pypnnomenclature==1.6.4
# via -r requirements-dependencies.in
pypnusershub==3.0.1
pypnusershub==3.0.2
# via
# -r requirements-dependencies.in
# taxhub
Expand Down Expand Up @@ -314,7 +314,7 @@ sqlalchemy==1.4.54
# utils-flask-sqlalchemy
# utils-flask-sqlalchemy-geo
# wtforms-sqlalchemy
taxhub==2.1.1
taxhub==2.1.2
# via
# -r requirements-dependencies.in
# pypnnomenclature
Expand Down Expand Up @@ -381,6 +381,7 @@ wtforms==3.1.2
# -r requirements-common.in
# flask-admin
# flask-wtf
# taxhub
# wtforms-sqlalchemy
wtforms-sqlalchemy==0.4.2
# via -r requirements-common.in
Expand Down
26 changes: 26 additions & 0 deletions docs/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,31 @@
# CHANGELOG

## 2.15.3 (2025-02-14)

**🚀 Nouveautés**

- [Synthese] Affichage du `cdNom`, `cdRef` et du `nomCite` dans la fiche d'observation (#3334 par @edelclaux).
- [Documentation] La compilation de documentation est effectuée à chaque merge dans la branche principale (`master`) (#3338 par @jacquesfize)
- [Import] Ajout d'une barre de progression dans l'import Occhab (#2928 par @Pierre-Narcisi)
- [TaxHub] Mise à jour de TaxHub en version 2.1.2
- [Authentification] Mise à jour UsersHub-autentification-module en 3.0.2.

**🐛 Corrections**

- [Import] Correction du nombre d'entités valides des données importées (#3336, #3355 par @jacquesfize)
- [Import] Suppression des variables de configurations inutiles dans la nouvelle version (#3341 par @jacquesfize)
- [Import] Correction la barre de progression pour l’import dans la synthèse (#2928 par @Pierre-Narcisi)
- [Authentification] Correction des valeurs dans defaut_config.toml.sample (#3339 par @jacquesfize)
- [Documentation] Réintégration de la documentation sur l'authentification avec un fournisseur d'identité externe (#3338 par @jacquesfize)
- [Développement] Correction des modèles SQLAlchemy pour pouvoir utiliser le mode debug (#3346 par @jacquesfize)
- [Synthèse] Correction de l'ordre d'affichage des observations sensibles (#3354 par @VincentCauchois et @Christophe-Ramet; #3249).
- [Synthèse] Correction de la recherche dans la Synthese avec un ou plusieurs filtre parmi "Listes rouges" (#3351 par @VincentCauchois et @Christophe-Ramet).
- [TaxHub] Correction de la synchonisation avec Occtax-mobile (https://github.com/PnX-SI/TaxHub/pull/599 par @amandine-sahl)
- [Synthèse] Correction de la recherche avec filtre par géométrie avec des SRIDs différents (#3372 par @jacquesfize)
- [Métadonnées] Correction du rafraichissement du formulaire de recherche (#3365 par @jacquesfize)
- [TaxHub] Ajout d'un bouton TaxHub dans le menu latéral (#3355 par @jacquesfize)
- [Authentification] Correction du lien de l'accès public (#3353 par @VincentCauchois)

## 2.15.2 (2025-01-16)

**🚀 Nouveautés**
Expand Down
Loading
Loading