Skip to content

Commit

Permalink
Merge pull request #2706 from PnX-SI/develop
Browse files Browse the repository at this point in the history
Develop > Master / 2.13.1
  • Loading branch information
camillemonchicourt authored Sep 15, 2023
2 parents 8ce2702 + 584af3f commit a978d6a
Show file tree
Hide file tree
Showing 25 changed files with 221 additions and 116 deletions.
4 changes: 2 additions & 2 deletions .github/ISSUE_TEMPLATE/rapport-de-bug.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ Version de GeoNature affectée par le bug.
**Description du bug**
Description du problème rencontré (message d’erreur, code HTTP de retour inattendu, …).

**Comportement attendue**
Description du comportement attendue en lieu et place du problème rencontré.
**Comportement attendu**
Description du comportement attendu en lieu et place du problème rencontré.

**Comment reproduire**
Étapes à suivre pour reproduire le problème (sur quelle page se rendre, sur quel bouton cliquer, avec quelles données présentes, …).
Expand Down
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
2.13.0
2.13.1
18 changes: 12 additions & 6 deletions backend/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ ENV PIP_ROOT_USER_ACTION=ignore
RUN --mount=type=cache,target=/root/.cache \
pip install --upgrade pip setuptools wheel


FROM build AS build-habref
WORKDIR /build/
COPY /backend/dependencies/Habref-api-module .
Expand Down Expand Up @@ -114,12 +113,12 @@ RUN --mount=type=cache,target=/root/.cache \
pip install --upgrade pip setuptools wheel

WORKDIR /dist
ENV GEONATURE_STATIC_PATH=/dist/static/
ENV GEONATURE_STATIC_FOLDER=/dist/static/
COPY /backend/static/ ./static/
COPY --from=node /dist/node_modules/ ./static/node_modules/
ENV GEONATURE_CUSTOM_STATIC_PATH=/dist/custom/
ENV GEONATURE_CUSTOM_STATIC_FOLDER=/dist/custom/
RUN mkdir custom
ENV GEONATURE_MEDIA_PATH=/dist/media/
ENV GEONATURE_MEDIA_FOLDER=/dist/media/
RUN mkdir -p media/attachments

WORKDIR /dist/geonature
Expand All @@ -140,13 +139,20 @@ COPY --from=build-utils-geo /build/dist/*.whl .
COPY --from=build-geonature /build/dist/*.whl .

COPY --chmod=755 /install/03b_populate_db.sh /populate_db.sh
COPY --chmod=755 /install/assets/docker_startup.sh /startup.sh
COPY --chmod=755 /install/assets/docker_entrypoint.sh /entrypoint.sh

ENV GEONATURE_CONFIG_FILE ""

EXPOSE 8000

CMD ["/startup.sh"]
ENTRYPOINT ["/entrypoint.sh"]
CMD [ "gunicorn", "geonature:create_app()", \
"--name=geonature", \
"--workers=2", \
"--threads=2", \
"--access-logfile=-", \
"--bind=0.0.0.0:8000" \
]


FROM wheels-light AS wheels
Expand Down
2 changes: 1 addition & 1 deletion backend/dependencies/TaxHub
2 changes: 1 addition & 1 deletion backend/dependencies/Utils-Flask-SQLAlchemy
6 changes: 3 additions & 3 deletions backend/geonature/core/gn_commons/routes.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,14 +59,14 @@ def list_modules():
"""
params = request.args
q = TModules.query.options(joinedload(TModules.objects))
exclude = current_app.config["DISABLED_MODULES"]
if "exclude" in params:
q = q.filter(TModules.module_code.notin_(params.getlist("exclude")))
exclude.extend(params.getlist("exclude"))
q = q.filter(TModules.module_code.notin_(exclude))
q = q.order_by(TModules.module_order.asc()).order_by(TModules.module_label.asc())
modules = q.all()
allowed_modules = []
for module in modules:
if module.module_code in current_app.config["DISABLED_MODULES"]:
continue
module_allowed = False
# HACK : on a besoin d'avoir le module GeoNature en front pour l'URL de la doc
if module.module_code == "GEONATURE":
Expand Down
19 changes: 16 additions & 3 deletions backend/geonature/core/gn_synthese/routes.py
Original file line number Diff line number Diff line change
Expand Up @@ -796,15 +796,18 @@ def get_autocomplete_taxons_synthese():
.join(Synthese, Synthese.cd_nom == VMTaxrefListForautocomplete.cd_nom)
)
search_name = search_name.replace(" ", "%")
q = q.filter(VMTaxrefListForautocomplete.unaccent_search_name.ilike("%" + search_name + "%"))
q = q.filter(
VMTaxrefListForautocomplete.unaccent_search_name.ilike(
func.unaccent("%" + search_name + "%")
)
)
regne = request.args.get("regne")
if regne:
q = q.filter(VMTaxrefListForautocomplete.regne == regne)

group2_inpn = request.args.get("group2_inpn")
if group2_inpn:
q = q.filter(VMTaxrefListForautocomplete.group2_inpn == group2_inpn)

q = q.order_by(desc(VMTaxrefListForautocomplete.cd_nom == VMTaxrefListForautocomplete.cd_ref))
limit = request.args.get("limit", 20)
data = q.order_by(desc("idx_trgm")).limit(20).all()
Expand Down Expand Up @@ -1106,11 +1109,21 @@ def create_report(permissions):
TReport.id_synthese == id_synthese,
TReport.report_type.has(BibReportsTypes.type == type_name),
)

user_pin = TReport.query.filter(
TReport.id_synthese == id_synthese,
TReport.report_type.has(BibReportsTypes.type == "pin"),
TReport.id_role == g.current_user.id_role,
)
# only allow one alert by id_synthese
if type_name in ["alert", "pin"]:
if type_name in ["alert"]:
alert_exists = report_query.one_or_none()
if alert_exists is not None:
raise Conflict("This type already exists for this id")
if type_name in ["pin"]:
pin_exist = user_pin.one_or_none()
if pin_exist is not None:
raise Conflict("This type already exists for this id")
new_entry = TReport(
id_synthese=id_synthese,
id_role=g.current_user.id_role,
Expand Down
8 changes: 4 additions & 4 deletions backend/requirements-dependencies.in
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
pypnusershub>=1.6.9,<2
pypnusershub>=1.6.10,<2
pypnnomenclature>=1.5.4,<2
pypn_habref_api>=0.3.2,<1
utils-flask-sqlalchemy-geo>=0.2.8,<1
utils-flask-sqlalchemy>=0.3.5,<1
taxhub>=1.12.0,<2
pypn-ref-geo>=1.3.0,<2
utils-flask-sqlalchemy>=0.3.6,<1
taxhub>=1.12.1,<2
pypn-ref-geo>=1.4.0,<2
32 changes: 17 additions & 15 deletions backend/requirements-dev.txt
Original file line number Diff line number Diff line change
Expand Up @@ -37,14 +37,14 @@
# via
# -r requirements-submodules.in
# pypn-ref-geo
alembic==1.11.1
alembic==1.12.0
# via
# flask-migrate
# pypn-ref-geo
# pypnusershub
amqp==5.1.1
# via kombu
async-timeout==4.0.2
async-timeout==4.0.3
# via redis
attrs==23.1.0
# via fiona
Expand All @@ -56,23 +56,23 @@ billiard==3.6.4.0
# via celery
blinker==1.6.2
# via flask-mail
boto3==1.28.2
boto3==1.28.47
# via taxhub
botocore==1.31.2
botocore==1.31.47
# via
# boto3
# s3transfer
cached-property==1.5.2
# via kombu
cairocffi==1.6.0
cairocffi==1.6.1
# via
# cairosvg
# weasyprint
cairosvg==2.7.0
cairosvg==2.7.1
# via weasyprint
celery[redis]==5.2.7
# via -r requirements-common.in
certifi==2023.5.7
certifi==2023.7.22
# via
# fiona
# requests
Expand All @@ -83,7 +83,7 @@ cffi==1.15.1
# weasyprint
charset-normalizer==3.2.0
# via requests
click==8.1.4
click==8.1.7
# via
# -r requirements-common.in
# celery
Expand All @@ -104,7 +104,7 @@ click-repl==0.3.0
# via celery
cligj==0.7.2
# via fiona
cryptography==41.0.2
cryptography==41.0.3
# via authlib
cssselect2==0.7.0
# via
Expand Down Expand Up @@ -156,7 +156,7 @@ flask-marshmallow==0.14.0
# pypn-habref-api
# pypnnomenclature
# pypnusershub
flask-migrate==4.0.4
flask-migrate==4.0.5
# via
# -r requirements-common.in
# pypn-habref-api
Expand Down Expand Up @@ -187,7 +187,7 @@ geojson==3.0.1
# via
# -r requirements-common.in
# utils-flask-sqlalchemy-geo
gunicorn==20.1.0
gunicorn==21.2.0
# via
# -r requirements-common.in
# taxhub
Expand All @@ -206,6 +206,7 @@ importlib-metadata==4.13.0 ; python_version < "3.10"
# celery
# click
# flask
# gunicorn
# kombu
# mako
# munch
Expand Down Expand Up @@ -264,6 +265,7 @@ packaging==23.1
# via
# -r requirements-common.in
# geoalchemy2
# gunicorn
# marshmallow
# marshmallow-sqlalchemy
pillow==9.5.0
Expand All @@ -274,7 +276,7 @@ pillow==9.5.0
# weasyprint
prompt-toolkit==3.0.39
# via click-repl
psycopg2==2.9.6
psycopg2==2.9.7
# via
# -r requirements-common.in
# pypn-habref-api
Expand All @@ -300,15 +302,15 @@ python-dotenv==0.21.1
# pypnnomenclature
# taxhub
# usershub
pytz==2023.3
pytz==2023.3.post1
# via celery
redis==4.6.0
redis==5.0.0
# via celery
requests==2.31.0
# via
# pypn-habref-api
# pypnusershub
s3transfer==0.6.1
s3transfer==0.6.2
# via boto3
shapely==1.8.5.post1
# via
Expand Down
26 changes: 13 additions & 13 deletions backend/requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,14 @@
#
# pip-compile --resolver=backtracking requirements.in
#
alembic==1.11.2
alembic==1.12.0
# via
# flask-migrate
# pypn-ref-geo
# pypnusershub
amqp==5.1.1
# via kombu
async-timeout==4.0.2
async-timeout==4.0.3
# via redis
attrs==23.1.0
# via fiona
Expand All @@ -23,9 +23,9 @@ billiard==3.6.4.0
# via celery
blinker==1.6.2
# via flask-mail
boto3==1.28.21
boto3==1.28.47
# via taxhub
botocore==1.31.21
botocore==1.31.47
# via
# boto3
# s3transfer
Expand All @@ -50,7 +50,7 @@ cffi==1.15.1
# weasyprint
charset-normalizer==3.2.0
# via requests
click==8.1.6
click==8.1.7
# via
# -r requirements-common.in
# celery
Expand Down Expand Up @@ -116,7 +116,7 @@ flask-marshmallow==0.14.0
# pypn-habref-api
# pypnnomenclature
# pypnusershub
flask-migrate==4.0.4
flask-migrate==4.0.5
# via
# -r requirements-common.in
# pypn-habref-api
Expand Down Expand Up @@ -237,13 +237,13 @@ pyphen==0.14.0
# via weasyprint
pypn-habref-api==0.3.2
# via -r requirements-dependencies.in
pypn-ref-geo==1.3.0
pypn-ref-geo==1.4.0
# via
# -r requirements-dependencies.in
# taxhub
pypnnomenclature==1.5.4
# via -r requirements-dependencies.in
pypnusershub==1.6.9
pypnusershub==1.6.10
# via
# -r requirements-dependencies.in
# pypnnomenclature
Expand All @@ -259,15 +259,15 @@ python-dotenv==0.21.1
# pypn-ref-geo
# pypnnomenclature
# taxhub
pytz==2023.3
pytz==2023.3.post1
# via celery
redis==4.6.0
redis==5.0.0
# via celery
requests==2.31.0
# via
# pypn-habref-api
# pypnusershub
s3transfer==0.6.1
s3transfer==0.6.2
# via boto3
shapely==1.8.5.post1
# via
Expand Down Expand Up @@ -295,7 +295,7 @@ sqlalchemy==1.3.24
# utils-flask-sqlalchemy
# utils-flask-sqlalchemy-geo
# wtforms-sqlalchemy
taxhub==1.12.0
taxhub==1.12.1
# via
# -r requirements-dependencies.in
# pypnnomenclature
Expand All @@ -317,7 +317,7 @@ urllib3==1.26.16
# botocore
# requests
# taxhub
utils-flask-sqlalchemy==0.3.5
utils-flask-sqlalchemy==0.3.6
# via
# -r requirements-dependencies.in
# pypn-habref-api
Expand Down
Loading

0 comments on commit a978d6a

Please sign in to comment.