parent
9f18c092ad
commit
921790753a
|
|
@ -4,89 +4,12 @@
|
|||
<option name="autoReloadType" value="SELECTIVE" />
|
||||
</component>
|
||||
<component name="ChangeListManager">
|
||||
<list default="true" id="c6d0259a-16e1-410d-91a1-830590ee2a08" name="Changes" comment="03/02/2026">
|
||||
<change afterPath="$PROJECT_DIR$/activite_pedagogique.py" afterDir="false" />
|
||||
<change afterPath="$PROJECT_DIR$/pole_activite_pedagogique.py" afterDir="false" />
|
||||
<change afterPath="$PROJECT_DIR$/tache_pedagogique.py" afterDir="false" />
|
||||
<list default="true" id="c6d0259a-16e1-410d-91a1-830590ee2a08" name="Changes" comment="09/02/2026">
|
||||
<change afterPath="$PROJECT_DIR$/competence_pedagogique.py" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/Activite.py" beforeDir="false" afterPath="$PROJECT_DIR$/Activite.py" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/Collection_Historique.py" beforeDir="false" afterPath="$PROJECT_DIR$/Collection_Historique.py" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/Contact.py" beforeDir="false" afterPath="$PROJECT_DIR$/Contact.py" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/Dashbord_queries/common_tdb_qries.py" beforeDir="false" afterPath="$PROJECT_DIR$/Dashbord_queries/common_tdb_qries.py" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/Dev_api_functions.py" beforeDir="false" afterPath="$PROJECT_DIR$/Dev_api_functions.py" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/E_Sign_Document.py" beforeDir="false" afterPath="$PROJECT_DIR$/E_Sign_Document.py" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/Ela_Spacy.py" beforeDir="false" afterPath="$PROJECT_DIR$/Ela_Spacy.py" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/Inscription_mgt.py" beforeDir="false" afterPath="$PROJECT_DIR$/Inscription_mgt.py" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/Job_Cron.py" beforeDir="false" afterPath="$PROJECT_DIR$/Job_Cron.py" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/Job_Cron_Common.py" beforeDir="false" afterPath="$PROJECT_DIR$/Job_Cron_Common.py" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/Log/log_file.log" beforeDir="false" afterPath="$PROJECT_DIR$/Log/log_file.log" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/Session_Formation.py" beforeDir="false" afterPath="$PROJECT_DIR$/Session_Formation.py" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/Session_Formation_Sequence.py" beforeDir="false" afterPath="$PROJECT_DIR$/Session_Formation_Sequence.py" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/agenda.py" beforeDir="false" afterPath="$PROJECT_DIR$/agenda.py" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/appel_offre.py" beforeDir="false" afterPath="$PROJECT_DIR$/appel_offre.py" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/apprenant_mgt.py" beforeDir="false" afterPath="$PROJECT_DIR$/apprenant_mgt.py" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/articles_avis.py" beforeDir="false" afterPath="$PROJECT_DIR$/articles_avis.py" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/attached_file_mgt.py" beforeDir="false" afterPath="$PROJECT_DIR$/attached_file_mgt.py" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/attestation_formation.py" beforeDir="false" afterPath="$PROJECT_DIR$/attestation_formation.py" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/base_class_calcul_note.py" beforeDir="false" afterPath="$PROJECT_DIR$/base_class_calcul_note.py" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/base_config_modele_journee.py" beforeDir="false" afterPath="$PROJECT_DIR$/base_config_modele_journee.py" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/base_document_automatic_setup.py" beforeDir="false" afterPath="$PROJECT_DIR$/base_document_automatic_setup.py" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/base_partner_catalog_config.py" beforeDir="false" afterPath="$PROJECT_DIR$/base_partner_catalog_config.py" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/base_partner_session_step.py" beforeDir="false" afterPath="$PROJECT_DIR$/base_partner_session_step.py" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/base_specific_fields.py" beforeDir="false" afterPath="$PROJECT_DIR$/base_specific_fields.py" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/business_prices.py" beforeDir="false" afterPath="$PROJECT_DIR$/business_prices.py" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/class_mgt.py" beforeDir="false" afterPath="$PROJECT_DIR$/class_mgt.py" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/competence.py" beforeDir="false" afterPath="$PROJECT_DIR$/competence.py" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/crm_opportunite.py" beforeDir="false" afterPath="$PROJECT_DIR$/crm_opportunite.py" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/domaine_formation_mgt.py" beforeDir="false" afterPath="$PROJECT_DIR$/domaine_formation_mgt.py" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/ela_factures_mgt.py" beforeDir="false" afterPath="$PROJECT_DIR$/ela_factures_mgt.py" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/ela_user_account.py" beforeDir="false" afterPath="$PROJECT_DIR$/ela_user_account.py" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/email_inscription_mgt.py" beforeDir="false" afterPath="$PROJECT_DIR$/email_inscription_mgt.py" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/email_mgt.py" beforeDir="false" afterPath="$PROJECT_DIR$/email_mgt.py" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/email_queu/email_queu_mgt.py" beforeDir="false" afterPath="$PROJECT_DIR$/email_queu/email_queu_mgt.py" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/emargement.py" beforeDir="false" afterPath="$PROJECT_DIR$/emargement.py" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/ent_alert_messages.py" beforeDir="false" afterPath="$PROJECT_DIR$/ent_alert_messages.py" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/ent_student_common.py" beforeDir="false" afterPath="$PROJECT_DIR$/ent_student_common.py" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/equipe_team_mgt.py" beforeDir="false" afterPath="$PROJECT_DIR$/equipe_team_mgt.py" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/financial_caracteristique_mgt.py" beforeDir="false" afterPath="$PROJECT_DIR$/financial_caracteristique_mgt.py" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/formulaire_mgt.py" beforeDir="false" afterPath="$PROJECT_DIR$/formulaire_mgt.py" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/groupe_client_mgt.py" beforeDir="false" afterPath="$PROJECT_DIR$/groupe_client_mgt.py" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/groupe_inscrit_mgt.py" beforeDir="false" afterPath="$PROJECT_DIR$/groupe_inscrit_mgt.py" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/internal_email_mgt.py" beforeDir="false" afterPath="$PROJECT_DIR$/internal_email_mgt.py" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/invoice_paiement_mgt.py" beforeDir="false" afterPath="$PROJECT_DIR$/invoice_paiement_mgt.py" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/jury_mgt.py" beforeDir="false" afterPath="$PROJECT_DIR$/jury_mgt.py" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/lms_chamilo/mysy_lms.py" beforeDir="false" afterPath="$PROJECT_DIR$/lms_chamilo/mysy_lms.py" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/main.py" beforeDir="false" afterPath="$PROJECT_DIR$/main.py" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/metier_formation_mgt.py" beforeDir="false" afterPath="$PROJECT_DIR$/metier_formation_mgt.py" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/model_planning_sequence_mgt.py" beforeDir="false" afterPath="$PROJECT_DIR$/model_planning_sequence_mgt.py" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/module_editique.py" beforeDir="false" afterPath="$PROJECT_DIR$/module_editique.py" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/note_evaluation_mgt.py" beforeDir="false" afterPath="$PROJECT_DIR$/note_evaluation_mgt.py" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/notes_apprenant_mgt.py" beforeDir="false" afterPath="$PROJECT_DIR$/notes_apprenant_mgt.py" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/paiement_condition.py" beforeDir="false" afterPath="$PROJECT_DIR$/paiement_condition.py" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/partner_base_setup.py" beforeDir="false" afterPath="$PROJECT_DIR$/partner_base_setup.py" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/partner_client.py" beforeDir="false" afterPath="$PROJECT_DIR$/partner_client.py" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/partner_document_mgt.py" beforeDir="false" afterPath="$PROJECT_DIR$/partner_document_mgt.py" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/partner_invoice.py" beforeDir="false" afterPath="$PROJECT_DIR$/partner_invoice.py" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/partner_order.py" beforeDir="false" afterPath="$PROJECT_DIR$/partner_order.py" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/partner_produit_service_mgt.py" beforeDir="false" afterPath="$PROJECT_DIR$/partner_produit_service_mgt.py" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/partners.py" beforeDir="false" afterPath="$PROJECT_DIR$/partners.py" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/prj_common.py" beforeDir="false" afterPath="$PROJECT_DIR$/prj_common.py" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/purchase_prices.py" beforeDir="false" afterPath="$PROJECT_DIR$/purchase_prices.py" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/reference_pedagogique_mgt.py" beforeDir="false" afterPath="$PROJECT_DIR$/reference_pedagogique_mgt.py" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/ressources_humaines.py" beforeDir="false" afterPath="$PROJECT_DIR$/ressources_humaines.py" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/ressources_materiels.py" beforeDir="false" afterPath="$PROJECT_DIR$/ressources_materiels.py" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/site_formation.py" beforeDir="false" afterPath="$PROJECT_DIR$/site_formation.py" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/stage_mgt.py" beforeDir="false" afterPath="$PROJECT_DIR$/stage_mgt.py" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/strype_payement.py" beforeDir="false" afterPath="$PROJECT_DIR$/strype_payement.py" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/suivi_pedagogique_mgt.py" beforeDir="false" afterPath="$PROJECT_DIR$/suivi_pedagogique_mgt.py" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/survey_mgt.py" beforeDir="false" afterPath="$PROJECT_DIR$/survey_mgt.py" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/tools_cherif/mysy_openai_file.py" beforeDir="false" afterPath="$PROJECT_DIR$/tools_cherif/mysy_openai_file.py" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/tools_cherif/tools_cherif.py" beforeDir="false" afterPath="$PROJECT_DIR$/tools_cherif/tools_cherif.py" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/unite_enseignement_mgt.py" beforeDir="false" afterPath="$PROJECT_DIR$/unite_enseignement_mgt.py" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/user_access_right.py" beforeDir="false" afterPath="$PROJECT_DIR$/user_access_right.py" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/user_message_mgt.py" beforeDir="false" afterPath="$PROJECT_DIR$/user_message_mgt.py" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/user_session.py" beforeDir="false" afterPath="$PROJECT_DIR$/user_session.py" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/wrapper.py" beforeDir="false" afterPath="$PROJECT_DIR$/wrapper.py" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/pole_activite_pedagogique.py" beforeDir="false" afterPath="$PROJECT_DIR$/pole_activite_pedagogique.py" afterDir="false" />
|
||||
</list>
|
||||
<option name="SHOW_DIALOG" value="false" />
|
||||
<option name="HIGHLIGHT_CONFLICTS" value="true" />
|
||||
|
|
@ -530,7 +453,7 @@
|
|||
<option name="project" value="LOCAL" />
|
||||
<updated>1747251650255</updated>
|
||||
</task>
|
||||
<option name="localTasksCounter" value="528" />
|
||||
<option name="localTasksCounter" value="529" />
|
||||
<servers />
|
||||
</component>
|
||||
<component name="Vcs.Log.Tabs.Properties">
|
||||
|
|
@ -572,7 +495,6 @@
|
|||
</option>
|
||||
</component>
|
||||
<component name="VcsManagerConfiguration">
|
||||
<MESSAGE value="20/10/2025 - 14h" />
|
||||
<MESSAGE value="20/10/2025 - 14hsd" />
|
||||
<MESSAGE value="21/10/2025 - 22h" />
|
||||
<MESSAGE value="wds" />
|
||||
|
|
@ -597,6 +519,7 @@
|
|||
<MESSAGE value="30/01/2026 - 18h" />
|
||||
<MESSAGE value="02/02/2026 - 18h" />
|
||||
<MESSAGE value="03/02/2026" />
|
||||
<option name="LAST_COMMIT_MESSAGE" value="03/02/2026" />
|
||||
<MESSAGE value="09/02/2026" />
|
||||
<option name="LAST_COMMIT_MESSAGE" value="09/02/2026" />
|
||||
</component>
|
||||
</project>
|
||||
3593
Log/log_file.log
3593
Log/log_file.log
File diff suppressed because one or more lines are too long
|
|
@ -0,0 +1,748 @@
|
|||
"""
|
||||
Ce document permet de gerer les compétences_pedagogiques
|
||||
|
||||
• Code,
|
||||
• Description
|
||||
• contexte_professionnel
|
||||
• Connaissances associées
|
||||
• Critères d’évaluation
|
||||
• Autonomie
|
||||
• Divers
|
||||
• Tab_Activite
|
||||
• Les attributs pédagogiques
|
||||
o Moyens é & Ressources
|
||||
o Prérequis
|
||||
o Complexité
|
||||
o Situations_apprentissage
|
||||
|
||||
|
||||
"""
|
||||
from operator import itemgetter
|
||||
|
||||
import bson
|
||||
import pymongo
|
||||
from pymongo import MongoClient
|
||||
import json
|
||||
from bson import ObjectId
|
||||
import re
|
||||
from datetime import datetime
|
||||
import prj_common as mycommon
|
||||
import secrets
|
||||
import inspect
|
||||
import sys, os
|
||||
import csv
|
||||
import pandas as pd
|
||||
from pymongo import ReturnDocument
|
||||
import GlobalVariable as MYSY_GV
|
||||
from math import isnan
|
||||
import GlobalVariable as MYSY_GV
|
||||
import ela_index_bdd_classes as eibdd
|
||||
import email_mgt as email
|
||||
import jinja2
|
||||
from flask import send_file
|
||||
from xhtml2pdf import pisa
|
||||
from email.message import EmailMessage
|
||||
from email.mime.text import MIMEText
|
||||
from email import encoders
|
||||
import smtplib
|
||||
from email.mime.multipart import MIMEMultipart
|
||||
from email.mime.text import MIMEText
|
||||
from email.mime.base import MIMEBase
|
||||
from email import encoders
|
||||
|
||||
"""
|
||||
Fonction d'ajout d'une compétence pedagogique
|
||||
"""
|
||||
def Add_competence_pedagogique(diction):
|
||||
try:
|
||||
diction = mycommon.strip_dictionary(diction)
|
||||
|
||||
"""
|
||||
Verification des input acceptés
|
||||
"""
|
||||
field_list = ['token', 'description', 'commentaire', 'code',
|
||||
'connaissance', 'critere_evaluation', 'prerequis', 'contexte_professionnel',
|
||||
'moyen_ressource', 'resultat', 'niveau_autonomie', 'situation_apprentissage', 'prerequis',
|
||||
'aide', 'contraintes', 'divers', ]
|
||||
|
||||
incom_keys = diction.keys()
|
||||
for val in incom_keys:
|
||||
if val not in field_list and val.startswith('my_') is False:
|
||||
mycommon.myprint(str(
|
||||
inspect.stack()[0][3]) + " Le champ '" + val + "' n'est pas autorisé")
|
||||
return False, " Les informations fournies sont incorrectes"
|
||||
|
||||
"""
|
||||
Verification des champs obligatoires
|
||||
"""
|
||||
field_list_obligatoire = ['token', 'code' ]
|
||||
|
||||
for val in field_list_obligatoire:
|
||||
if val not in diction:
|
||||
mycommon.myprint(
|
||||
str(inspect.stack()[0][3]) + " - La valeur '" + val + "' n'est pas presente dans la liste des arguments ")
|
||||
return False, " Les informations fournies sont incorrectes"
|
||||
|
||||
"""
|
||||
Verification de l'identité et autorisation de l'entité qui
|
||||
appelle cette API
|
||||
"""
|
||||
token = ""
|
||||
if ("token" in diction.keys()):
|
||||
if diction['token']:
|
||||
token = diction['token']
|
||||
|
||||
|
||||
|
||||
|
||||
local_status, my_partner = mycommon.Check_Connexion_And_Return_Partner_Data(diction)
|
||||
if (local_status is not True):
|
||||
return local_status, my_partner
|
||||
|
||||
"""
|
||||
Verifier que ce code de l'activité n'est pas déjà utilisé
|
||||
"""
|
||||
is_competence_pedagogique_code_used = MYSY_GV.dbname['competence_pedagogique'].count_documents({'code':str(diction['code']),
|
||||
'valide':'1',
|
||||
'partner_owner_recid':str(my_partner['recid'])})
|
||||
|
||||
if( is_competence_pedagogique_code_used != 0 ):
|
||||
mycommon.myprint(
|
||||
str(inspect.stack()[0][
|
||||
3]) + " Le code "+str(diction['code'])+" est déjà utilisé ")
|
||||
return False, " Le code "+str(diction['code'])+" est déjà utilisé "
|
||||
|
||||
|
||||
mydata = {}
|
||||
|
||||
mydata = diction
|
||||
del mydata['token']
|
||||
|
||||
# Initialisation des champs non envoyés à vide
|
||||
for val in field_list:
|
||||
if val not in diction.keys():
|
||||
mydata[str(val)] = ""
|
||||
|
||||
mydata['creation_date'] = str(datetime.now())
|
||||
mydata['creation_by'] = str(my_partner['_id'])
|
||||
mydata['partner_owner_recid'] = str(my_partner['recid'])
|
||||
mydata['valide'] = "1"
|
||||
mydata['locked'] = "0"
|
||||
mydata['tab_activite_pedagogique'] = []
|
||||
|
||||
|
||||
inserted_id = MYSY_GV.dbname['competence_pedagogique'].insert_one(mydata).inserted_id
|
||||
|
||||
if (not inserted_id):
|
||||
mycommon.myprint(" Impossible de créer la compétence pédagogique (2) ")
|
||||
return False, " Impossible de créer la compétence pédagogique (2) "
|
||||
|
||||
return True, " la compétence pédagogique a été correctement ajoutée "
|
||||
|
||||
|
||||
except Exception as e:
|
||||
exc_type, exc_obj, exc_tb = sys.exc_info()
|
||||
mycommon.myprint(str(inspect.stack()[0][3]) + " -" + str(e) + " - Line : " + str(exc_tb.tb_lineno))
|
||||
return False, " Impossible de créer la compétence pédagogique "
|
||||
|
||||
|
||||
"""
|
||||
Fonction de mise à jour d'une compétence pédagogique
|
||||
"""
|
||||
def Update_competence_pedagogique(diction):
|
||||
try:
|
||||
diction = mycommon.strip_dictionary(diction)
|
||||
|
||||
"""
|
||||
Verification des input acceptés
|
||||
"""
|
||||
field_list = ['token', 'description', 'competence_pedagogique_id', 'commentaire', 'code',
|
||||
'connaissance', 'critere_evaluation', 'prerequis', 'contexte_professionnel',
|
||||
'moyen_ressource', 'resultat', 'niveau_autonomie', 'situation_apprentissage', 'prerequis',
|
||||
'aide', 'contraintes', 'divers'
|
||||
]
|
||||
|
||||
incom_keys = diction.keys()
|
||||
for val in incom_keys:
|
||||
if val not in field_list and val.startswith('my_') is False:
|
||||
mycommon.myprint(str(
|
||||
inspect.stack()[0][3]) + " Le champ '" + val + "' n'est pas autorisé")
|
||||
return False, " Les informations fournies sont incorrectes"
|
||||
|
||||
"""
|
||||
Verification des champs obligatoires
|
||||
"""
|
||||
field_list_obligatoire = ['token', 'competence_pedagogique_id', 'code']
|
||||
|
||||
for val in field_list_obligatoire:
|
||||
if val not in diction:
|
||||
mycommon.myprint(
|
||||
str(inspect.stack()[0][3]) + " - La valeur '" + val + "' n'est pas presente dans la liste des arguments ")
|
||||
return False, " Les informations fournies sont incorrectes"
|
||||
|
||||
"""
|
||||
Verification de l'identité et autorisation de l'entité qui
|
||||
appelle cette API
|
||||
"""
|
||||
token = ""
|
||||
if ("token" in diction.keys()):
|
||||
if diction['token']:
|
||||
token = diction['token']
|
||||
|
||||
|
||||
|
||||
local_status, my_partner = mycommon.Check_Connexion_And_Return_Partner_Data(diction)
|
||||
if (local_status is not True):
|
||||
return local_status, my_partner
|
||||
|
||||
"""
|
||||
Verifier que le code de compétence n'est pas utilisé par une autre compétence autre que celle ci
|
||||
"""
|
||||
|
||||
is_competence_code_used = MYSY_GV.dbname['competence_pedagogique'].count_documents({'code': str(diction['code']),
|
||||
'valide': '1',
|
||||
'_id':{'$ne':ObjectId(str(diction['competence_pedagogique_id']))},
|
||||
'partner_owner_recid': str(
|
||||
my_partner['recid'])})
|
||||
|
||||
if (is_competence_code_used != 0):
|
||||
mycommon.myprint(
|
||||
str(inspect.stack()[0][
|
||||
3]) + " Le code " + str(diction['code']) + " est déjà utilisé ")
|
||||
return False, " Le code " + str(diction['code']) + " est déjà utilisé "
|
||||
|
||||
|
||||
# Verifier que la compétence existe et est valide
|
||||
is_valide_competence_pedagogique_id = MYSY_GV.dbname['competence_pedagogique'].count_documents({'_id':ObjectId(str(diction['competence_pedagogique_id'])),
|
||||
'valide':'1',
|
||||
'locked':'0',
|
||||
'partner_owner_recid':str(my_partner['recid'])})
|
||||
|
||||
|
||||
if( is_valide_competence_pedagogique_id != 1):
|
||||
mycommon.myprint(
|
||||
str(inspect.stack()[0][3]) + " L'identifiant de la compétence est invalide ")
|
||||
return False, " L'identifiant de la compétence est invalide "
|
||||
|
||||
|
||||
mydata = {}
|
||||
mydata = diction
|
||||
del mydata['token']
|
||||
|
||||
|
||||
mydata['update_date'] = str(datetime.now())
|
||||
mydata['update_by'] = str(my_partner['_id'])
|
||||
|
||||
result = MYSY_GV.dbname['competence_pedagogique'].find_one_and_update(
|
||||
{'_id':ObjectId(str(diction['competence_pedagogique_id'])),
|
||||
'partner_owner_recid':str(my_partner['recid'])},
|
||||
{"$set": mydata},
|
||||
upsert=False,
|
||||
return_document=ReturnDocument.AFTER
|
||||
)
|
||||
if ("_id" not in result.keys()):
|
||||
mycommon.myprint(
|
||||
" Impossible de mettre à jour la compétence pédagogique (2) ")
|
||||
return False, " Impossible de mettre à jour la compétence pédagogique (2) "
|
||||
|
||||
|
||||
|
||||
return True, " La compétence pédagogique a été correctement mise à jour "
|
||||
|
||||
|
||||
except Exception as e:
|
||||
exc_type, exc_obj, exc_tb = sys.exc_info()
|
||||
mycommon.myprint(str(inspect.stack()[0][3]) + " -" + str(e) + " - Line : " + str(exc_tb.tb_lineno))
|
||||
return False, " Impossible de mettre à jour la compétence pédagogique "
|
||||
|
||||
|
||||
"""
|
||||
Recuperer la liste des compétence pedagogique d'un partenaire, sans filtres
|
||||
"""
|
||||
def Get_competence_pedagogique_no_filter(diction):
|
||||
try:
|
||||
diction = mycommon.strip_dictionary(diction)
|
||||
|
||||
"""
|
||||
Verification des input acceptés
|
||||
"""
|
||||
field_list = ['token' ]
|
||||
|
||||
incom_keys = diction.keys()
|
||||
for val in incom_keys:
|
||||
if val not in field_list and val.startswith('my_') is False:
|
||||
mycommon.myprint(str(
|
||||
inspect.stack()[0][3]) + " Le champ '" + val + "' n'est pas autorisé")
|
||||
return False, " Les informations fournies sont incorrectes"
|
||||
|
||||
"""
|
||||
Verification des champs obligatoires
|
||||
"""
|
||||
field_list_obligatoire = ['token',]
|
||||
|
||||
for val in field_list_obligatoire:
|
||||
if val not in diction:
|
||||
mycommon.myprint(
|
||||
str(inspect.stack()[0][3]) + " - La valeur '" + val + "' n'est pas presente dans la liste des arguments ")
|
||||
return False, " Les informations fournies sont incorrectes"
|
||||
|
||||
"""
|
||||
Verification de l'identité et autorisation de l'entité qui
|
||||
appelle cette API
|
||||
"""
|
||||
token = ""
|
||||
if ("token" in diction.keys()):
|
||||
if diction['token']:
|
||||
token = diction['token']
|
||||
|
||||
local_status, my_partner = mycommon.Check_Connexion_And_Return_Partner_Data(diction)
|
||||
if (local_status is not True):
|
||||
return local_status, my_partner
|
||||
|
||||
|
||||
RetObject = []
|
||||
val_tmp = 0
|
||||
|
||||
qry = {"partner_owner_recid":str(my_partner['recid']), 'valide':'1', 'locked':'0'}
|
||||
|
||||
for New_retVal in MYSY_GV.dbname['competence_pedagogique'].find(qry).sort([("_id", pymongo.DESCENDING), ]):
|
||||
user = New_retVal
|
||||
|
||||
|
||||
if( "code" not in user.keys() ):
|
||||
user["code"] = "--"
|
||||
|
||||
|
||||
user['id'] = str(val_tmp)
|
||||
val_tmp = val_tmp + 1
|
||||
|
||||
RetObject.append(mycommon.JSONEncoder().encode(user))
|
||||
|
||||
return True, RetObject
|
||||
|
||||
except Exception as e:
|
||||
exc_type, exc_obj, exc_tb = sys.exc_info()
|
||||
mycommon.myprint(str(inspect.stack()[0][3]) + " -" + str(e) + " - Line : " + str(exc_tb.tb_lineno))
|
||||
return False, " Impossible de récupérer la liste des compétences pédagogiques "
|
||||
|
||||
|
||||
|
||||
"""
|
||||
Recuperer les données d'une compétence pedagogique donnée
|
||||
"""
|
||||
def Get_Given_competence_pedagogique(diction):
|
||||
try:
|
||||
diction = mycommon.strip_dictionary(diction)
|
||||
|
||||
"""
|
||||
Verification des input acceptés
|
||||
"""
|
||||
field_list = ['token', '_id' ]
|
||||
|
||||
incom_keys = diction.keys()
|
||||
for val in incom_keys:
|
||||
if val not in field_list and val.startswith('my_') is False:
|
||||
mycommon.myprint(str(
|
||||
inspect.stack()[0][3]) + " Le champ '" + val + "' n'est pas autorisé")
|
||||
return False, " Les informations fournies sont incorrectes"
|
||||
|
||||
"""
|
||||
Verification des champs obligatoires
|
||||
"""
|
||||
field_list_obligatoire = ['token',]
|
||||
|
||||
for val in field_list_obligatoire:
|
||||
if val not in diction:
|
||||
mycommon.myprint(
|
||||
str(inspect.stack()[0][3]) + " - La valeur '" + val + "' n'est pas presente dans la liste des arguments ")
|
||||
return False, " Les informations fournies sont incorrectes"
|
||||
|
||||
"""
|
||||
Verification de l'identité et autorisation de l'entité qui
|
||||
appelle cette API
|
||||
"""
|
||||
token = ""
|
||||
if ("token" in diction.keys()):
|
||||
if diction['token']:
|
||||
token = diction['token']
|
||||
|
||||
local_status, my_partner = mycommon.Check_Connexion_And_Return_Partner_Data(diction)
|
||||
if (local_status is not True):
|
||||
return local_status, my_partner
|
||||
|
||||
|
||||
RetObject = []
|
||||
val_tmp = 0
|
||||
|
||||
qry = {"partner_owner_recid":str(my_partner['recid']), 'valide':'1', 'locked':'0', '_id':ObjectId(str(diction['_id']))}
|
||||
|
||||
for New_retVal in MYSY_GV.dbname['competence_pedagogique'].find(qry):
|
||||
user = New_retVal
|
||||
|
||||
if( "code" not in user.keys() ):
|
||||
user["code"] = "--"
|
||||
|
||||
tab_activite_pedagogique_with_code = []
|
||||
if ("tab_activite_pedagogique" in New_retVal.keys()):
|
||||
for activite_pedago in New_retVal['tab_activite_pedagogique']:
|
||||
activite_pedago_data = MYSY_GV.dbname['activite_pedagogique'].find_one(
|
||||
{'_id': ObjectId(str(activite_pedago['_id'])), 'valide': '1'},
|
||||
{'_id': 1, 'code': 1, 'description': 1, })
|
||||
|
||||
if ("rang" in activite_pedago.keys()):
|
||||
activite_pedago_data['rang'] = str(activite_pedago['rang'])
|
||||
else:
|
||||
activite_pedago_data['rang'] = "99"
|
||||
|
||||
tab_activite_pedagogique_with_code.append(activite_pedago_data)
|
||||
|
||||
print("tab_activite_pedagogique_with_code = ", tab_activite_pedagogique_with_code)
|
||||
ss = sorted(tab_activite_pedagogique_with_code, key=itemgetter('rang'))
|
||||
|
||||
user['tab_activite_pedagogique_with_code'] = tab_activite_pedagogique_with_code
|
||||
|
||||
user['id'] = str(val_tmp)
|
||||
val_tmp = val_tmp + 1
|
||||
|
||||
RetObject.append(mycommon.JSONEncoder().encode(user))
|
||||
|
||||
|
||||
return True, RetObject
|
||||
|
||||
except Exception as e:
|
||||
exc_type, exc_obj, exc_tb = sys.exc_info()
|
||||
mycommon.myprint(str(inspect.stack()[0][3]) + " -" + str(e) + " - Line : " + str(exc_tb.tb_lineno))
|
||||
return False, " Impossible de récupérer la liste des compétences pédagogiques "
|
||||
|
||||
|
||||
|
||||
"""
|
||||
Suppression d'une compétence pedagogique
|
||||
"""
|
||||
def Delete_Given_competence_pedagogique(diction):
|
||||
try:
|
||||
diction = mycommon.strip_dictionary(diction)
|
||||
|
||||
"""
|
||||
Verification des input acceptés
|
||||
"""
|
||||
field_list = ['token', 'competence_pedagogique_id', ]
|
||||
|
||||
incom_keys = diction.keys()
|
||||
for val in incom_keys:
|
||||
if val not in field_list and val.startswith('my_') is False:
|
||||
mycommon.myprint(str(
|
||||
inspect.stack()[0][3]) + " Le champ '" + val + "' n'est pas autorisé")
|
||||
return False, " Les informations fournies sont incorrectes"
|
||||
|
||||
"""
|
||||
Verification des champs obligatoires
|
||||
"""
|
||||
field_list_obligatoire = ['token', 'competence_pedagogique_id', ]
|
||||
|
||||
for val in field_list_obligatoire:
|
||||
if val not in diction:
|
||||
mycommon.myprint(
|
||||
str(inspect.stack()[0][3]) + " - La valeur '" + val + "' n'est pas presente dans la liste des arguments ")
|
||||
return False, " Les informations fournies sont incorrectes"
|
||||
|
||||
"""
|
||||
Verification de l'identité et autorisation de l'entité qui
|
||||
appelle cette API
|
||||
"""
|
||||
token = ""
|
||||
if ("token" in diction.keys()):
|
||||
if diction['token']:
|
||||
token = diction['token']
|
||||
|
||||
local_status, my_partner = mycommon.Check_Connexion_And_Return_Partner_Data(diction)
|
||||
if (local_status is not True):
|
||||
return local_status, my_partner
|
||||
|
||||
|
||||
qry = {'_id':ObjectId(str(diction['competence_pedagogique_id'])), 'partner_owner_recid':str(my_partner['recid'])}
|
||||
|
||||
ret_del_competence = MYSY_GV.dbname['competence_pedagogique'].delete_many(qry)
|
||||
|
||||
return True, "la compétence pédagogique a été correctement supprimée"
|
||||
|
||||
|
||||
except Exception as e:
|
||||
exc_type, exc_obj, exc_tb = sys.exc_info()
|
||||
mycommon.myprint(str(inspect.stack()[0][3]) + " -" + str(e) + " - Line : " + str(exc_tb.tb_lineno))
|
||||
return False, " Impossible de supprimer la compétence pédagogique "
|
||||
|
||||
|
||||
"""
|
||||
Ajouter une liste de activité pédagogique à une compétence
|
||||
"""
|
||||
def Add_Update_tab_Activite_To_competence_pedagogique(diction):
|
||||
try:
|
||||
diction = mycommon.strip_dictionary(diction)
|
||||
|
||||
"""
|
||||
Verification des input acceptés
|
||||
"""
|
||||
field_list = ['token', 'competence_id', 'activite_pedagogique_id', 'rang', ]
|
||||
|
||||
incom_keys = diction.keys()
|
||||
for val in incom_keys:
|
||||
if val not in field_list and val.startswith('my_') is False:
|
||||
mycommon.myprint(str(
|
||||
inspect.stack()[0][3]) + " Le champ '" + val + "' n'est pas autorisé")
|
||||
return False, " Les informations fournies sont incorrectes"
|
||||
|
||||
"""
|
||||
Verification des champs obligatoires
|
||||
"""
|
||||
field_list_obligatoire = ['token', 'competence_id', 'activite_pedagogique_id', 'rang',]
|
||||
|
||||
for val in field_list_obligatoire:
|
||||
if val not in diction:
|
||||
mycommon.myprint(
|
||||
str(inspect.stack()[0][3]) + " - La valeur '" + val + "' n'est pas presente dans la liste des arguments ")
|
||||
return False, " Les informations fournies sont incorrectes"
|
||||
|
||||
"""
|
||||
Verification de l'identité et autorisation de l'entité qui
|
||||
appelle cette API
|
||||
"""
|
||||
token = ""
|
||||
if ("token" in diction.keys()):
|
||||
if diction['token']:
|
||||
token = diction['token']
|
||||
|
||||
local_status, my_partner = mycommon.Check_Connexion_And_Return_Partner_Data(diction)
|
||||
if (local_status is not True):
|
||||
return local_status, my_partner
|
||||
|
||||
|
||||
|
||||
if ("rang" in diction.keys()):
|
||||
local_status, local_note_max = mycommon.IsInt(str(diction['rang']).strip())
|
||||
if (local_status is False):
|
||||
mycommon.myprint(
|
||||
" Le rang doit être un nombre entier ")
|
||||
return False, " Le rang doit être un nombre entier"
|
||||
|
||||
|
||||
|
||||
"""
|
||||
Verifier la validité de l'activité
|
||||
"""
|
||||
is_valide_activite = MYSY_GV.dbname['competence_pedagogique'].count_documents({'_id':ObjectId(diction['competence_id']),
|
||||
'valide':'1',
|
||||
'locked':'0',
|
||||
'partner_owner_recid':str(my_partner['recid'])})
|
||||
|
||||
if( is_valide_activite != 1):
|
||||
mycommon.myprint(
|
||||
str(inspect.stack()[0][
|
||||
3]) + " L'identifiant de la compétence est invalide ")
|
||||
return False, " L'identifiant de la compétence est invalide "
|
||||
|
||||
is_valide_activite = MYSY_GV.dbname['activite_pedagogique'].count_documents(
|
||||
{'_id': ObjectId(str(diction['activite_pedagogique_id'])),
|
||||
'valide': '1',
|
||||
'locked': '0',
|
||||
'partner_owner_recid': str(my_partner['recid'])})
|
||||
|
||||
if (is_valide_activite != 1):
|
||||
mycommon.myprint(
|
||||
str(inspect.stack()[0][
|
||||
3]) + " L'identifiant de l'activité " + str(diction['activite_pedagogique_id']) + " est invalide ")
|
||||
return False, " L'identifiant de l'activité " + str(diction['activite_pedagogique_id']) + " est invalide "
|
||||
|
||||
tab_tache_pedagogique = []
|
||||
tab_tache_pedagogique.append(str(diction['activite_pedagogique_id']))
|
||||
|
||||
|
||||
for activite_id in tab_tache_pedagogique:
|
||||
|
||||
"""
|
||||
Si la tache existe dans tab_tache_pedagogique, alors on fait un update,
|
||||
si non on fait une insertion
|
||||
"""
|
||||
is_tache_existe_in_activite = MYSY_GV.dbname['competence_pedagogique'].count_documents({'_id': ObjectId(str(diction['competence_id'])),
|
||||
'valide': '1',
|
||||
'partner_owner_recid': str(my_partner['recid']),
|
||||
'tab_activite_pedagogique._id': ObjectId(str(activite_id))
|
||||
})
|
||||
|
||||
if( is_tache_existe_in_activite == 1):
|
||||
print(" OUII existe, donc update")
|
||||
update = MYSY_GV.dbname['competence_pedagogique'].update_one({'_id': ObjectId(str(diction['competence_id'])),
|
||||
'valide': '1',
|
||||
'locked':'0',
|
||||
'partner_owner_recid': str(my_partner['recid']),
|
||||
'tab_activite_pedagogique._id': ObjectId(str(activite_id))
|
||||
},
|
||||
{'$set':
|
||||
{
|
||||
'tab_activite_pedagogique.$[xxx].rang': str( diction['rang']),
|
||||
'tab_activite_pedagogique.$[xxx].update_date': str( datetime.now()),
|
||||
'tab_activite_pedagogique.$[xxx].update_by': str(my_partner['_id']),
|
||||
}
|
||||
},
|
||||
upsert=False,
|
||||
array_filters=[
|
||||
{"xxx._id": ObjectId(str(activite_id))},
|
||||
]
|
||||
)
|
||||
|
||||
elif( is_tache_existe_in_activite == 0):
|
||||
print(" NOOO existe, donc insert")
|
||||
new_data = {}
|
||||
new_data['_id'] = ObjectId(str(activite_id))
|
||||
new_data['rang'] = str(diction['rang'])
|
||||
|
||||
new_data['valide'] = "1"
|
||||
new_data['creation_by'] = str(my_partner['_id'])
|
||||
new_data['creation_date'] = str(datetime.now())
|
||||
new_data['locked'] = "0"
|
||||
|
||||
|
||||
|
||||
insert = MYSY_GV.dbname['competence_pedagogique'].update_one({'_id': ObjectId(str(diction['competence_id'])),
|
||||
'valide': '1',
|
||||
'locked': '0',
|
||||
'partner_owner_recid': str(my_partner['recid']),
|
||||
},
|
||||
|
||||
{
|
||||
'$push': {
|
||||
"tab_activite_pedagogique": {
|
||||
'$each': [new_data]
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
)
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
return True, " La mise à jour a été correctement faite "
|
||||
|
||||
|
||||
except Exception as e:
|
||||
exc_type, exc_obj, exc_tb = sys.exc_info()
|
||||
mycommon.myprint(str(inspect.stack()[0][3]) + " -" + str(e) + " - Line : " + str(exc_tb.tb_lineno))
|
||||
return False, " Impossible de faire la mise à jour "
|
||||
|
||||
|
||||
|
||||
"""
|
||||
Supprimer une activite pédagogique d'une compétence pédagogique
|
||||
"""
|
||||
def Delete_Activite_From_competence_pedagogique(diction):
|
||||
try:
|
||||
diction = mycommon.strip_dictionary(diction)
|
||||
|
||||
"""
|
||||
Verification des input acceptés
|
||||
"""
|
||||
field_list = ['token', 'competence_id', 'activite_pedagogique_id', ]
|
||||
|
||||
incom_keys = diction.keys()
|
||||
for val in incom_keys:
|
||||
if val not in field_list and val.startswith('my_') is False:
|
||||
mycommon.myprint(str(
|
||||
inspect.stack()[0][3]) + " Le champ '" + val + "' n'est pas autorisé")
|
||||
return False, " Les informations fournies sont incorrectes"
|
||||
|
||||
"""
|
||||
Verification des champs obligatoires
|
||||
"""
|
||||
field_list_obligatoire = ['token', 'competence_id', 'activite_pedagogique_id', ]
|
||||
|
||||
for val in field_list_obligatoire:
|
||||
if val not in diction:
|
||||
mycommon.myprint(
|
||||
str(inspect.stack()[0][3]) + " - La valeur '" + val + "' n'est pas presente dans la liste des arguments ")
|
||||
return False, " Les informations fournies sont incorrectes"
|
||||
|
||||
"""
|
||||
Verification de l'identité et autorisation de l'entité qui
|
||||
appelle cette API
|
||||
"""
|
||||
token = ""
|
||||
if ("token" in diction.keys()):
|
||||
if diction['token']:
|
||||
token = diction['token']
|
||||
|
||||
local_status, my_partner = mycommon.Check_Connexion_And_Return_Partner_Data(diction)
|
||||
if (local_status is not True):
|
||||
return local_status, my_partner
|
||||
|
||||
|
||||
|
||||
"""
|
||||
Verifier la validité de l'activité
|
||||
"""
|
||||
is_valide_activite = MYSY_GV.dbname['competence_pedagogique'].count_documents({'_id':ObjectId(diction['competence_id']),
|
||||
'valide':'1',
|
||||
'locked':'0',
|
||||
'partner_owner_recid':str(my_partner['recid'])})
|
||||
|
||||
if( is_valide_activite != 1):
|
||||
mycommon.myprint(
|
||||
str(inspect.stack()[0][
|
||||
3]) + " L'identifiant de la compétence est invalide ")
|
||||
return False, " L'identifiant de la compétence est invalide "
|
||||
|
||||
|
||||
is_valide_tache = MYSY_GV.dbname['activite_pedagogique'].count_documents({'_id':ObjectId(str(diction['activite_pedagogique_id'])),
|
||||
'valide':'1',
|
||||
'locked':'0',
|
||||
'partner_owner_recid':str(my_partner['recid'])})
|
||||
|
||||
if( is_valide_tache != 1):
|
||||
mycommon.myprint(
|
||||
str(inspect.stack()[0][
|
||||
3]) + " L'identifiant de l'activité "+str(diction['activite_pedagogique_id'])+" est invalide ")
|
||||
return False, " L'identifiant de l'activité "+str(diction['activite_pedagogique_id'])+" est invalide "
|
||||
|
||||
|
||||
tab_tache_pedagogique = []
|
||||
tab_tache_pedagogique.append(str(diction['activite_pedagogique_id']))
|
||||
|
||||
|
||||
for activite_id in tab_tache_pedagogique:
|
||||
|
||||
"""
|
||||
Si la tache existe dans tab_tache_pedagogique, alors on fait un update,
|
||||
si non on fait une insertion
|
||||
"""
|
||||
|
||||
print({'_id': ObjectId(str(diction['competence_id'])),
|
||||
'valide': '1',
|
||||
'partner_owner_recid': str(my_partner['recid']),
|
||||
'tab_activite_pedagogique._id': ObjectId(str(activite_id))
|
||||
})
|
||||
is_tache_existe_in_activite = MYSY_GV.dbname['competence_pedagogique'].count_documents({'_id': ObjectId(str(diction['competence_id'])),
|
||||
'valide': '1',
|
||||
'partner_owner_recid': str(my_partner['recid']),
|
||||
'tab_activite_pedagogique._id': ObjectId(str(activite_id))
|
||||
})
|
||||
|
||||
if( is_tache_existe_in_activite == 1):
|
||||
print(" OUII existe, donc update")
|
||||
update = MYSY_GV.dbname['competence_pedagogique'].update_one({'_id': ObjectId(str(diction['competence_id'])),
|
||||
'valide': '1',
|
||||
'partner_owner_recid': str(my_partner['recid']),
|
||||
'tab_activite_pedagogique._id': ObjectId(str(activite_id))
|
||||
},
|
||||
{'$pull': {"tab_activite_pedagogique": {"_id": ObjectId(str(activite_id)) }}},
|
||||
|
||||
)
|
||||
|
||||
return True, " L'activité a été correctement supprimée "
|
||||
|
||||
|
||||
except Exception as e:
|
||||
exc_type, exc_obj, exc_tb = sys.exc_info()
|
||||
mycommon.myprint(str(inspect.stack()[0][3]) + " -" + str(e) + " - Line : " + str(exc_tb.tb_lineno))
|
||||
return False, " Impossible de supprimer l'activité "
|
||||
127
main.py
127
main.py
|
|
@ -110,6 +110,8 @@ import session_admission_fi as session_admission_fi
|
|||
import activite_pedagogique as activite_pedagogique
|
||||
import tache_pedagogique as tache_pedagogique
|
||||
import pole_activite_pedagogique as pole_activite_pedagogique
|
||||
import competence_pedagogique as competence_pedagogique
|
||||
|
||||
|
||||
import base_document_automatic_setup as base_document_automatic_setup
|
||||
|
||||
|
|
@ -16029,6 +16031,131 @@ def Delete_Activite_From_Pole_pedagogique():
|
|||
|
||||
|
||||
|
||||
"""
|
||||
Cette API permet Ajouter une compétence au couple ( pole d'activité / Activité)
|
||||
"""
|
||||
@app.route('/myclass/api/Add_Update_Competence_To_Pole_pedagogique_And_Activite/', methods=['POST','GET'])
|
||||
@crossdomain(origin='*')
|
||||
def Add_Update_Competence_To_Pole_pedagogique_And_Activite():
|
||||
# On recupere le corps (payload) de la requete
|
||||
payload = mycommon.strip_dictionary (request.form.to_dict())
|
||||
print(" ### Add_Update_Competence_To_Pole_pedagogique_And_Activite payload = ",payload)
|
||||
status, retval = pole_activite_pedagogique.Add_Update_Competence_To_Pole_pedagogique_And_Activite(payload)
|
||||
return jsonify(status=status, message=retval)
|
||||
|
||||
|
||||
|
||||
"""
|
||||
Cette API permet supprimer une compétence au couple ( pole d'activité / Activité)
|
||||
"""
|
||||
@app.route('/myclass/api/Delete_Competence_Activite_From_Pole_pedagogique_And_Activite/', methods=['POST','GET'])
|
||||
@crossdomain(origin='*')
|
||||
def Delete_Competence_Activite_From_Pole_pedagogique_And_Activite():
|
||||
# On recupere le corps (payload) de la requete
|
||||
payload = mycommon.strip_dictionary (request.form.to_dict())
|
||||
print(" ### Delete_Competence_Activite_From_Pole_pedagogique_And_Activite payload = ",payload)
|
||||
status, retval = pole_activite_pedagogique.Delete_Competence_Activite_From_Pole_pedagogique_And_Activite(payload)
|
||||
return jsonify(status=status, message=retval)
|
||||
|
||||
|
||||
|
||||
"""
|
||||
Cette API permet d'ajouter une compétence pedagogique
|
||||
"""
|
||||
@app.route('/myclass/api/Add_competence_pedagogique/', methods=['POST','GET'])
|
||||
@crossdomain(origin='*')
|
||||
def Add_competence_pedagogique():
|
||||
# On recupere le corps (payload) de la requete
|
||||
payload = mycommon.strip_dictionary (request.form.to_dict())
|
||||
print(" ### Add_competence_pedagogique payload = ",payload)
|
||||
status, retval = competence_pedagogique.Add_competence_pedagogique(payload)
|
||||
return jsonify(status=status, message=retval)
|
||||
|
||||
|
||||
|
||||
"""
|
||||
Cette API permet de mettre à jour d'une compétence pédagogique
|
||||
"""
|
||||
@app.route('/myclass/api/Update_competence_pedagogique/', methods=['POST','GET'])
|
||||
@crossdomain(origin='*')
|
||||
def Update_competence_pedagogique():
|
||||
# On recupere le corps (payload) de la requete
|
||||
payload = mycommon.strip_dictionary (request.form.to_dict())
|
||||
print(" ### Update_competence_pedagogique payload = ",payload)
|
||||
status, retval = competence_pedagogique.Update_competence_pedagogique(payload)
|
||||
return jsonify(status=status, message=retval)
|
||||
|
||||
|
||||
|
||||
"""
|
||||
Cette API pour Recuperer la liste des compétence pedagogique d'un partenaire, sans filtres
|
||||
"""
|
||||
@app.route('/myclass/api/Get_competence_pedagogique_no_filter/', methods=['POST','GET'])
|
||||
@crossdomain(origin='*')
|
||||
def Get_competence_pedagogique_no_filter():
|
||||
# On recupere le corps (payload) de la requete
|
||||
payload = mycommon.strip_dictionary (request.form.to_dict())
|
||||
print(" ### Get_competence_pedagogique_no_filter payload = ",payload)
|
||||
status, retval = competence_pedagogique.Get_competence_pedagogique_no_filter(payload)
|
||||
return jsonify(status=status, message=retval)
|
||||
|
||||
|
||||
|
||||
"""
|
||||
Cette API pour Recuperer les données d'une compétence pedagogique donnée
|
||||
"""
|
||||
@app.route('/myclass/api/Get_Given_competence_pedagogique/', methods=['POST','GET'])
|
||||
@crossdomain(origin='*')
|
||||
def Get_Given_competence_pedagogique():
|
||||
# On recupere le corps (payload) de la requete
|
||||
payload = mycommon.strip_dictionary (request.form.to_dict())
|
||||
print(" ### Get_Given_competence_pedagogique payload = ",payload)
|
||||
status, retval = competence_pedagogique.Get_Given_competence_pedagogique(payload)
|
||||
return jsonify(status=status, message=retval)
|
||||
|
||||
|
||||
|
||||
"""
|
||||
Cette API pour Suppression d'une compétence pedagogique
|
||||
"""
|
||||
@app.route('/myclass/api/Delete_Given_competence_pedagogique/', methods=['POST','GET'])
|
||||
@crossdomain(origin='*')
|
||||
def Delete_Given_competence_pedagogique():
|
||||
# On recupere le corps (payload) de la requete
|
||||
payload = mycommon.strip_dictionary (request.form.to_dict())
|
||||
print(" ### Delete_Given_competence_pedagogique payload = ",payload)
|
||||
status, retval = competence_pedagogique.Delete_Given_competence_pedagogique(payload)
|
||||
return jsonify(status=status, message=retval)
|
||||
|
||||
|
||||
|
||||
"""
|
||||
Cette API pour Ajouter une liste de activité pédagogique à une compétence
|
||||
"""
|
||||
@app.route('/myclass/api/Add_Update_tab_Activite_To_competence_pedagogique/', methods=['POST','GET'])
|
||||
@crossdomain(origin='*')
|
||||
def Add_Update_tab_Activite_To_competence_pedagogique():
|
||||
# On recupere le corps (payload) de la requete
|
||||
payload = mycommon.strip_dictionary (request.form.to_dict())
|
||||
print(" ### Add_Update_tab_Activite_To_competence_pedagogique payload = ",payload)
|
||||
status, retval = competence_pedagogique.Add_Update_tab_Activite_To_competence_pedagogique(payload)
|
||||
return jsonify(status=status, message=retval)
|
||||
|
||||
|
||||
|
||||
"""
|
||||
Cette API pour Supprimer une activité pédagogique d'une compétence pédagogique
|
||||
"""
|
||||
@app.route('/myclass/api/Delete_Activite_From_competence_pedagogique/', methods=['POST','GET'])
|
||||
@crossdomain(origin='*')
|
||||
def Delete_Activite_From_competence_pedagogique():
|
||||
# On recupere le corps (payload) de la requete
|
||||
payload = mycommon.strip_dictionary (request.form.to_dict())
|
||||
print(" ### Delete_Activite_From_competence_pedagogique payload = ",payload)
|
||||
status, retval = competence_pedagogique.Delete_Activite_From_competence_pedagogique(payload)
|
||||
return jsonify(status=status, message=retval)
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -394,6 +394,41 @@ def Get_Given_pole_activite_pedagogique(diction):
|
|||
user['tab_activite_pedagogique_with_code'] = tab_activite_pedagogique_with_code
|
||||
|
||||
|
||||
"""
|
||||
Recuperer les compétences associée en prenant en compte le couple :
|
||||
(competence_id / activite_pedagogique_id )
|
||||
"""
|
||||
tab_competence_activite_pedagogique_with_code = []
|
||||
cpt_local_competence = 0
|
||||
if( "tab_competence_activite_pedagogique" in New_retVal.keys() ):
|
||||
for competence_activite_pedagogique_data in New_retVal['tab_competence_activite_pedagogique'] :
|
||||
if( "competence_id" in competence_activite_pedagogique_data.keys() and
|
||||
"activite_pedagogique_id" in competence_activite_pedagogique_data.keys() ):
|
||||
local_competence_data = MYSY_GV.dbname['competence_pedagogique'].find_one({'_id':ObjectId(str(competence_activite_pedagogique_data['competence_id'])),
|
||||
'partner_owner_recid':str(my_partner['recid'])})
|
||||
|
||||
local_activite_data = MYSY_GV.dbname['activite_pedagogique'].find_one(
|
||||
{'_id': ObjectId(str(competence_activite_pedagogique_data['activite_pedagogique_id'])),
|
||||
'partner_owner_recid': str(my_partner['recid'])})
|
||||
|
||||
local_node = {}
|
||||
local_node['id'] = str(cpt_local_competence)
|
||||
cpt_local_competence = cpt_local_competence + 1
|
||||
|
||||
local_node['activite_pedagogique_id'] = str(local_activite_data['_id'])
|
||||
local_node['activite_pedagogique_code'] = str(local_activite_data['code'])
|
||||
local_node['activite_pedagogique_description'] = str(local_activite_data['description'])
|
||||
|
||||
local_node['competence_id'] = str(local_competence_data['_id'])
|
||||
local_node['competence_code'] = str(local_competence_data['code'])
|
||||
local_node['competence_description'] = str(local_competence_data['description'])
|
||||
|
||||
local_node['creation_date'] = str(competence_activite_pedagogique_data['creation_date'])
|
||||
|
||||
tab_competence_activite_pedagogique_with_code.append(local_node)
|
||||
|
||||
user['tab_competence_activite_pedagogique_with_code'] = tab_competence_activite_pedagogique_with_code
|
||||
|
||||
user['id'] = str(val_tmp)
|
||||
val_tmp = val_tmp + 1
|
||||
|
||||
|
|
@ -544,8 +579,8 @@ def Add_Update_tab_Activite_To_Pole_pedagogique(diction):
|
|||
if( is_valide_activite != 1):
|
||||
mycommon.myprint(
|
||||
str(inspect.stack()[0][
|
||||
3]) + " L'identifiant de l'activité "+str(diction['tache_pedagogique_id'])+" est invalide ")
|
||||
return False, " L'identifiant de l'actvité "+str(diction['tache_pedagogique_id'])+" est invalide "
|
||||
3]) + " L'identifiant de l'activité "+str(diction['activite_pedagogique_id'])+" est invalide ")
|
||||
return False, " L'identifiant de l'activité "+str(diction['activite_pedagogique_id'])+" est invalide "
|
||||
|
||||
|
||||
tab_tache_pedagogique = []
|
||||
|
|
@ -749,3 +784,323 @@ def Delete_Activite_From_Pole_pedagogique(diction):
|
|||
exc_type, exc_obj, exc_tb = sys.exc_info()
|
||||
mycommon.myprint(str(inspect.stack()[0][3]) + " -" + str(e) + " - Line : " + str(exc_tb.tb_lineno))
|
||||
return False, " Impossible de supprimer l'activité du pôle "
|
||||
|
||||
|
||||
"""
|
||||
Ajouter une compétence au couple ( pole d'activité / Activité)
|
||||
"""
|
||||
def Add_Update_Competence_To_Pole_pedagogique_And_Activite(diction):
|
||||
try:
|
||||
diction = mycommon.strip_dictionary(diction)
|
||||
|
||||
"""
|
||||
Verification des input acceptés
|
||||
"""
|
||||
field_list = ['token', 'pole_activite_id', 'activite_pedagogique_id', 'competence_id', ]
|
||||
|
||||
incom_keys = diction.keys()
|
||||
for val in incom_keys:
|
||||
if val not in field_list and val.startswith('my_') is False:
|
||||
mycommon.myprint(str(
|
||||
inspect.stack()[0][3]) + " Le champ '" + val + "' n'est pas autorisé")
|
||||
return False, " Les informations fournies sont incorrectes"
|
||||
|
||||
"""
|
||||
Verification des champs obligatoires
|
||||
"""
|
||||
field_list_obligatoire = ['token', 'pole_activite_id', 'activite_pedagogique_id', 'competence_id', ]
|
||||
|
||||
for val in field_list_obligatoire:
|
||||
if val not in diction:
|
||||
mycommon.myprint(
|
||||
str(inspect.stack()[0][3]) + " - La valeur '" + val + "' n'est pas presente dans la liste des arguments ")
|
||||
return False, " Les informations fournies sont incorrectes"
|
||||
|
||||
"""
|
||||
Verification de l'identité et autorisation de l'entité qui
|
||||
appelle cette API
|
||||
"""
|
||||
token = ""
|
||||
if ("token" in diction.keys()):
|
||||
if diction['token']:
|
||||
token = diction['token']
|
||||
|
||||
local_status, my_partner = mycommon.Check_Connexion_And_Return_Partner_Data(diction)
|
||||
if (local_status is not True):
|
||||
return local_status, my_partner
|
||||
|
||||
|
||||
|
||||
if ("rang" in diction.keys()):
|
||||
local_status, local_note_max = mycommon.IsInt(str(diction['rang']).strip())
|
||||
if (local_status is False):
|
||||
mycommon.myprint(
|
||||
" Le rang doit être un nombre entier ")
|
||||
return False, " Le rang doit être un nombre entier"
|
||||
|
||||
|
||||
|
||||
"""
|
||||
Verifier la validité de la compétence
|
||||
"""
|
||||
is_valide_competence = MYSY_GV.dbname['competence_pedagogique'].count_documents({'_id':ObjectId(diction['competence_id']),
|
||||
'valide': '1',
|
||||
'locked': '0',
|
||||
'partner_owner_recid': str(
|
||||
my_partner['recid'])
|
||||
})
|
||||
|
||||
if (is_valide_competence != 1):
|
||||
mycommon.myprint(
|
||||
str(inspect.stack()[0][
|
||||
3]) + " L'identifiant de la compétence est invalide ")
|
||||
return False, " L'identifiant de la compétence est invalide "
|
||||
|
||||
|
||||
"""
|
||||
Verifier la validité du pole d'activité
|
||||
"""
|
||||
is_valide_pole_activite = MYSY_GV.dbname['pole_activite_pedagogique'].count_documents({'_id':ObjectId(diction['pole_activite_id']),
|
||||
'valide':'1',
|
||||
'locked':'0',
|
||||
'partner_owner_recid':str(my_partner['recid'])})
|
||||
|
||||
if( is_valide_pole_activite != 1):
|
||||
mycommon.myprint(
|
||||
str(inspect.stack()[0][
|
||||
3]) + " L'identifiant du pôle d'activité est invalide ")
|
||||
return False, " L'identifiant du pôle d'activité est invalide "
|
||||
|
||||
|
||||
is_valide_activite = MYSY_GV.dbname['activite_pedagogique'].count_documents({'_id':ObjectId(str(diction['activite_pedagogique_id'])),
|
||||
'valide':'1',
|
||||
'locked':'0',
|
||||
'partner_owner_recid':str(my_partner['recid'])})
|
||||
|
||||
if( is_valide_activite != 1):
|
||||
mycommon.myprint(
|
||||
str(inspect.stack()[0][
|
||||
3]) + " L'identifiant de l'activité "+str(diction['activite_pedagogique_id'])+" est invalide ")
|
||||
return False, " L'identifiant de l'activité "+str(diction['activite_pedagogique_id'])+" est invalide "
|
||||
|
||||
|
||||
tab_tache_pedagogique = []
|
||||
tab_tache_pedagogique.append(str(diction['competence_id']))
|
||||
|
||||
|
||||
for competence_id in tab_tache_pedagogique:
|
||||
|
||||
"""
|
||||
Si la tache existe dans tab_tache_pedagogique, alors on fait un update,
|
||||
si non on fait une insertion
|
||||
"""
|
||||
is_activite_existe_in_pole_activite = MYSY_GV.dbname['pole_activite_pedagogique'].count_documents({'_id': ObjectId(str(diction['pole_activite_id'])),
|
||||
'valide': '1',
|
||||
'partner_owner_recid': str(my_partner['recid']),
|
||||
'tab_competence_activite_pedagogique.competence_id': str(competence_id),
|
||||
'tab_competence_activite_pedagogique.activite_pedagogique_id': str(
|
||||
diction['activite_pedagogique_id'])
|
||||
})
|
||||
|
||||
if( is_activite_existe_in_pole_activite == 1):
|
||||
print(" OUII existe, donc update")
|
||||
update = MYSY_GV.dbname['pole_activite_pedagogique'].update_one({'_id': ObjectId(str(diction['pole_activite_id'])),
|
||||
'valide': '1',
|
||||
'partner_owner_recid': str(my_partner['recid']),
|
||||
'tab_competence_activite_pedagogique.competence_id': str(competence_id),
|
||||
'tab_activite_pedagogique.activite_pedagogique_id': str(
|
||||
diction['activite_pedagogique_id'])
|
||||
},
|
||||
{'$set':
|
||||
{
|
||||
'tab_competence_activite_pedagogique.$[xxx].update_date': str( datetime.now()),
|
||||
'tab_competence_activite_pedagogique.$[xxx].update_by': str(my_partner['_id']),
|
||||
}
|
||||
},
|
||||
upsert=False,
|
||||
array_filters=[ {'$and': [{"xxx.competence_id": str(competence_id)},
|
||||
{"xxx.activite_pedagogique_id": str(diction['activite_pedagogique_id'])}]}
|
||||
|
||||
]
|
||||
)
|
||||
|
||||
elif( is_activite_existe_in_pole_activite == 0):
|
||||
print(" NOOO existe, donc insert")
|
||||
new_data = {}
|
||||
new_data['competence_id'] = str(competence_id)
|
||||
new_data['activite_pedagogique_id'] = str(diction['activite_pedagogique_id'])
|
||||
new_data['valide'] = "1"
|
||||
new_data['creation_by'] = str(my_partner['_id'])
|
||||
new_data['creation_date'] = str(datetime.now())
|
||||
new_data['locked'] = "0"
|
||||
|
||||
|
||||
|
||||
insert = MYSY_GV.dbname['pole_activite_pedagogique'].update_one({'_id': ObjectId(str(diction['pole_activite_id'])),
|
||||
'valide': '1',
|
||||
'locked': '0',
|
||||
'partner_owner_recid': str(my_partner['recid']),
|
||||
},
|
||||
|
||||
{
|
||||
'$push': {
|
||||
"tab_competence_activite_pedagogique": {
|
||||
'$each': [new_data]
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
)
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
return True, " La mise à jour a été correctement faite "
|
||||
|
||||
|
||||
except Exception as e:
|
||||
exc_type, exc_obj, exc_tb = sys.exc_info()
|
||||
mycommon.myprint(str(inspect.stack()[0][3]) + " -" + str(e) + " - Line : " + str(exc_tb.tb_lineno))
|
||||
return False, " Impossible de faire la mise à jour "
|
||||
|
||||
|
||||
|
||||
"""
|
||||
Supprimer une compétence au couple ( pole d'activité / Activité)
|
||||
"""
|
||||
def Delete_Competence_Activite_From_Pole_pedagogique_And_Activite(diction):
|
||||
try:
|
||||
diction = mycommon.strip_dictionary(diction)
|
||||
|
||||
"""
|
||||
Verification des input acceptés
|
||||
"""
|
||||
field_list = ['token', 'pole_activite_id', 'activite_pedagogique_id', 'competence_id']
|
||||
|
||||
incom_keys = diction.keys()
|
||||
for val in incom_keys:
|
||||
if val not in field_list and val.startswith('my_') is False:
|
||||
mycommon.myprint(str(
|
||||
inspect.stack()[0][3]) + " Le champ '" + val + "' n'est pas autorisé")
|
||||
return False, " Les informations fournies sont incorrectes"
|
||||
|
||||
"""
|
||||
Verification des champs obligatoires
|
||||
"""
|
||||
field_list_obligatoire = ['token', 'pole_activite_id', 'activite_pedagogique_id', 'competence_id']
|
||||
|
||||
for val in field_list_obligatoire:
|
||||
if val not in diction:
|
||||
mycommon.myprint(
|
||||
str(inspect.stack()[0][3]) + " - La valeur '" + val + "' n'est pas presente dans la liste des arguments ")
|
||||
return False, " Les informations fournies sont incorrectes"
|
||||
|
||||
"""
|
||||
Verification de l'identité et autorisation de l'entité qui
|
||||
appelle cette API
|
||||
"""
|
||||
token = ""
|
||||
if ("token" in diction.keys()):
|
||||
if diction['token']:
|
||||
token = diction['token']
|
||||
|
||||
local_status, my_partner = mycommon.Check_Connexion_And_Return_Partner_Data(diction)
|
||||
if (local_status is not True):
|
||||
return local_status, my_partner
|
||||
|
||||
"""
|
||||
Verifier la validité de la compétence
|
||||
"""
|
||||
is_valide_competence = MYSY_GV.dbname['competence_pedagogique'].count_documents(
|
||||
{'_id': ObjectId(diction['competence_id']),
|
||||
'valide': '1',
|
||||
'locked': '0',
|
||||
'partner_owner_recid': str(
|
||||
my_partner['recid'])
|
||||
})
|
||||
|
||||
if (is_valide_competence != 1):
|
||||
mycommon.myprint(
|
||||
str(inspect.stack()[0][
|
||||
3]) + " L'identifiant de la compétence est invalide ")
|
||||
return False, " L'identifiant de la compétence est invalide "
|
||||
|
||||
|
||||
|
||||
"""
|
||||
Verifier la validité du pole d'activité
|
||||
"""
|
||||
is_valide_pole_activite = MYSY_GV.dbname['pole_activite_pedagogique'].count_documents({'_id':ObjectId(diction['pole_activite_id']),
|
||||
'valide':'1',
|
||||
'locked':'0',
|
||||
'partner_owner_recid':str(my_partner['recid'])})
|
||||
|
||||
if( is_valide_pole_activite != 1):
|
||||
mycommon.myprint(
|
||||
str(inspect.stack()[0][
|
||||
3]) + " L'identifiant du pôle d'activité est invalide ")
|
||||
return False, " L'identifiant du pôle d'activité est invalide "
|
||||
|
||||
|
||||
is_valide_activite = MYSY_GV.dbname['activite_pedagogique'].count_documents({'_id':ObjectId(str(diction['activite_pedagogique_id'])),
|
||||
'valide':'1',
|
||||
'locked':'0',
|
||||
'partner_owner_recid':str(my_partner['recid'])})
|
||||
|
||||
if( is_valide_activite != 1):
|
||||
mycommon.myprint(
|
||||
str(inspect.stack()[0][
|
||||
3]) + " L'identifiant de l'activité "+str(diction['tache_pedagogique_id'])+" est invalide ")
|
||||
return False, " L'identifiant de l'actvité "+str(diction['tache_pedagogique_id'])+" est invalide "
|
||||
|
||||
|
||||
tab_tache_pedagogique = []
|
||||
tab_tache_pedagogique.append(str(diction['competence_id']))
|
||||
|
||||
|
||||
for competence_id in tab_tache_pedagogique:
|
||||
|
||||
"""
|
||||
Si la tache existe dans tab_tache_pedagogique, alors on fait un update,
|
||||
si non on fait une insertion
|
||||
"""
|
||||
|
||||
|
||||
is_activite_existe_in_pole_activite = MYSY_GV.dbname['pole_activite_pedagogique'].count_documents({'_id': ObjectId(str(diction['pole_activite_id'])),
|
||||
'valide': '1',
|
||||
'partner_owner_recid': str(my_partner['recid']),
|
||||
'tab_competence_activite_pedagogique.competence_id': str(competence_id),
|
||||
'tab_competence_activite_pedagogique.activite_pedagogique_id': str(
|
||||
diction['activite_pedagogique_id'])
|
||||
})
|
||||
|
||||
if( is_activite_existe_in_pole_activite == 1):
|
||||
print(" OUII existe, donc update")
|
||||
print({'$pull': {"tab_competence_activite_pedagogique": [ {'$and': [ {"competence_id": str(competence_id) } ,
|
||||
{"activite_pedagogique_id": str(diction['activite_pedagogique_id'])
|
||||
} ] } ] } },)
|
||||
update = MYSY_GV.dbname['pole_activite_pedagogique'].update_one({'_id': ObjectId(str(diction['pole_activite_id'])),
|
||||
'valide': '1',
|
||||
'partner_owner_recid': str(my_partner['recid']),
|
||||
'tab_competence_activite_pedagogique.competence_id': str(competence_id),
|
||||
'tab_competence_activite_pedagogique.activite_pedagogique_id': str(diction['activite_pedagogique_id'])
|
||||
},
|
||||
{'$pull': {"tab_competence_activite_pedagogique": {"competence_id": str(competence_id),
|
||||
"activite_pedagogique_id": str(diction['activite_pedagogique_id']) }
|
||||
} },
|
||||
|
||||
|
||||
)
|
||||
|
||||
|
||||
|
||||
return True, " La compétence a été correctement supprimée "
|
||||
|
||||
|
||||
except Exception as e:
|
||||
exc_type, exc_obj, exc_tb = sys.exc_info()
|
||||
mycommon.myprint(str(inspect.stack()[0][3]) + " -" + str(e) + " - Line : " + str(exc_tb.tb_lineno))
|
||||
return False, " Impossible de supprimer la compétence "
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue