PnX-SI / GeoNature

Application de saisie et de synthèse des observations faune et flore
GNU General Public License v3.0
99 stars 101 forks source link

Synthèse - erreur sur filtre "Statut biogéographique" #2235

Open gildeluermoz opened 1 year ago

gildeluermoz commented 1 year ago

Version 2.9.2 mais aussi 2.10.1 de la demo

Description du bug Le filtre avancé statut biogéographique" dans la synthèse, GN (2.9.2) remonte une erreur.

Comment reproduire Choisir le filtre avancé "statut biogéographique" sur demo.geonature.fr/geonature et lancer la recherche

Logs

Traceback (most recent call last):
  File "/home/geonature/geonature/backend/venv/lib/python3.9/site-packages/flask/app.py", line 1949, in full_dispatch_request
    rv = self.dispatch_request()
  File "/home/geonature/geonature/backend/venv/lib/python3.9/site-packages/flask/app.py", line 1935, in dispatch_request
    return self.view_functions[rule.endpoint](**req.view_args)
  File "/home/geonature/geonature/backend/geonature/core/gn_permissions/decorators.py", line 82, in __check_cruved_scope
    return fn(*args, **kwargs)
  File "/home/geonature/geonature/backend/venv/lib/python3.9/site-packages/utils_flask_sqla/response.py", line 19, in _json_resp
    res = fn(*args, **kwargs)
  File "/home/geonature/geonature/backend/geonature/core/gn_synthese/routes.py", line 151, in get_observations_for_web
    synthese_query_class.filter_query_all_filters(info_role)
  File "/home/geonature/geonature/backend/geonature/core/gn_synthese/utils/query_select_sqla.py", line 371, in filter_query_all_filters
    self.filter_other_filters()
  File "/home/geonature/geonature/backend/geonature/core/gn_synthese/utils/query_select_sqla.py", line 340, in filter_other_filters
    col = getattr(self.model.__table__.columns, colname)
  File "/home/geonature/geonature/backend/venv/lib/python3.9/site-packages/sqlalchemy/util/_collections.py", line 212, in __getattr__
    raise AttributeError(key)
AttributeError: id_nomenclature_biogeo_status
[2022-12-15 15:46:50 +0100] [993832] [ERROR] Exception on /synthese/for_web [POST]
Traceback (most recent call last):
  File "/home/geonature/geonature/backend/venv/lib/python3.9/site-packages/sqlalchemy/util/_collections.py", line 210, in __getattr__
    return self._data[key]
KeyError: 'id_nomenclature_biogeo_status'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/geonature/geonature/backend/venv/lib/python3.9/site-packages/flask/app.py", line 1949, in full_dispatch_request
    rv = self.dispatch_request()
  File "/home/geonature/geonature/backend/venv/lib/python3.9/site-packages/flask/app.py", line 1935, in dispatch_request
    return self.view_functions[rule.endpoint](**req.view_args)
  File "/home/geonature/geonature/backend/geonature/core/gn_permissions/decorators.py", line 82, in __check_cruved_scope
    return fn(*args, **kwargs)
  File "/home/geonature/geonature/backend/venv/lib/python3.9/site-packages/utils_flask_sqla/response.py", line 19, in _json_resp
    res = fn(*args, **kwargs)
  File "/home/geonature/geonature/backend/geonature/core/gn_synthese/routes.py", line 151, in get_observations_for_web
    synthese_query_class.filter_query_all_filters(info_role)
  File "/home/geonature/geonature/backend/geonature/core/gn_synthese/utils/query_select_sqla.py", line 371, in filter_query_all_filters
    self.filter_other_filters()
  File "/home/geonature/geonature/backend/geonature/core/gn_synthese/utils/query_select_sqla.py", line 340, in filter_other_filters
    col = getattr(self.model.__table__.columns, colname)
  File "/home/geonature/geonature/backend/venv/lib/python3.9/site-packages/sqlalchemy/util/_collections.py", line 212, in __getattr__
    raise AttributeError(key)
AttributeError: id_nomenclature_biogeo_status
DonovanMaillard commented 1 year ago

Bonjour,

En effet, constaté également sur la 2.11 et la 2.12, erreur quand on veut filtrer par statut biogéographique :)

Un truc que je ne comprends pas, c'est qu'on appelle une nomenclature. Cette info devrait être récupérée au niveau de l'id_statut du taxref plutôt, non ?

bouttier commented 1 year ago

Bien que présente dans la table synthese, la nomenclature est manquante dans la vue v_synthese_for_web_app

bouttier commented 1 year ago

Il faudrait supprimer la vue v_synthese_for_web_app au profit de l’utilisation du modèle Synthese. Le boulot est pas énorme, il y a un rechercher-remplacer + 2 jointures à rajouter (bon, ça c’est la théorie).

camillemonchicourt commented 1 year ago

En attendant, ça ne vaut pas le coup d'ajouter le champs dans la vue ? 😇