Skip to content

Commit

Permalink
fix(mtd): make association to organism prior to user
Browse files Browse the repository at this point in the history
In the function `associate_actors` make the association to be with an organism if one is retrieved, and if that is impossible with a user. Therefore, if both an organism and a user can be retrieved for the actor of the metadata, the association is made with the organism rather than with the user.
  • Loading branch information
VincentCauchois committed Oct 31, 2024
1 parent 0572ad6 commit d7e3e7c
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions backend/geonature/core/gn_meta/mtd/mtd_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -287,13 +287,13 @@ def associate_actors(
id_nomenclature_actor_role=id_nomenclature_actor_role,
**{pk_name: pk_value},
)
if not id_organism:
if id_organism:
values["id_organism"] = id_organism
else:
id_user_from_email = DB.session.scalar(
select(User.id_role).filter_by(email=email_actor).where(User.groupe.is_(False))
)
values["id_role"] = id_user_from_email
else:
values["id_organism"] = id_organism
try:
statement = (
pg_insert(CorActor)
Expand Down

0 comments on commit d7e3e7c

Please sign in to comment.