-
Notifications
You must be signed in to change notification settings - Fork 26
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
[IMPORT] Intégrer les champs d'import lors de l'installation d'un protocole #398
[IMPORT] Intégrer les champs d'import lors de l'installation d'un protocole #398
Conversation
…nX-SI#391) * Fix edit map mode * Reinit leafletdraw config
* VESION and requirements.in * Docs * Changelog 1.0.0 / complément * Update README.md * Update docs/changelog.md * Bump GeoNature * Add postgis ltree extension * Suppression données orpheline synthese * Use geonature 03b_populate_db.sh script * Changelog --------- Co-authored-by: Camille Monchicourt <camille.monchicourt@ecrins-parcnational.fr>
…tions/gn_module_monitoring into feat/import/install-protocol
Il faudrait rebaser la branche de destination sur DEVELOP, car là la PR semble ajouter des commits qui sont liés à d'autres évolutions récentes de DEVELOP. |
* VESION and requirements.in * Docs * Changelog 1.0.0 / complément * Update README.md * Update docs/changelog.md * Bump GeoNature * Add postgis ltree extension * Suppression données orpheline synthese * Use geonature 03b_populate_db.sh script * Changelog --------- Co-authored-by: Camille Monchicourt <camille.monchicourt@ecrins-parcnational.fr>
d3af099
to
4e1ffa7
Compare
4fb75fe
to
90863ed
Compare
generic_data = json_from_file(generic_data_path, result_default={}) | ||
|
||
entity_confs[entity_code] = { | ||
"specific_data": generic_data, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"specific_data": generic_data, | |
"specific_data": specific_data, |
try: | ||
module = get_simple_module("module_code", module_code) | ||
# test si le module existe | ||
# Vérifier si le module existe | ||
if module: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
si le module monitoring existe déjà dans t_modules, il faut le vérifier et procéder à l'installation de la couche import (et ignoré la maj). Par exemple, en vérifiant l'existence dans la table destination
if module: | |
destination_exists = DB.session.scalar( | |
exists(Destination).where(Destination.code == module_code).select() | |
) | |
if module and destination_exists: |
Booléen indiquant si la mise à jour a réussi. | ||
""" | ||
try: | ||
DB.session.rollback() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pourquoi un rollback ici ?
Si un module de monitoring existe déjà dans t_modules, il faut ignorer le groupe d'instruction faisant l'ajout en base L157 - cmd.py module = TMonitoringModules()
module.from_dict(module_data)
DB.session.add(module)
DB.session.commit() A remplacer par exemple par if not DB.session.scalar(
exists(TMonitoringModules).where(
TMonitoringModules.module_code == module_code
).select()
):
module = TMonitoringModules()
module.from_dict(module_data)
DB.session.add(module)
DB.session.commit() |
6667140
to
3e910fa
Compare
3e910fa
to
7ebeb32
Compare
elif ( | ||
"value" in field_data | ||
and isinstance(field_data["value"], dict) | ||
and "code_nomenclature_type" in field_data["value"] | ||
): | ||
mnemonique = field_data["value"]["code_nomenclature_type"] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Étrange ça ? La nomenclature peut être déclaré à des endroits différents selon le protocole ?
9e73f30
to
4c0d6be
Compare
Intégré dans #424 |
[IMPORT][MONITORING] IM_IMPORT_01.0 - Intégrer les champs d'import lors de l'installation d'un protocole Import V3 (view)
Intégration des champs d'import lors de l'installation d'un protocole
Ajout dans la table
bib_destinations
bib_destinations
.Récupération et insertion des entités
config.json
du module.bib_entities
.Gestion des champs spécifiques et génériques
bib_fields
etcor_entity_field
.Création de la table d'import
t_import_{protocole}
.gn_imports
.