25/12/2023 - 22h30

master
cherif 2023-12-25 22:40:23 +01:00
parent c46acf323f
commit c143f52a10
8 changed files with 5598 additions and 23 deletions

View File

@ -3,13 +3,13 @@
<component name="ChangeListManager">
<list default="true" id="c6d0259a-16e1-410d-91a1-830590ee2a08" name="Changes" comment="20/12/2023 - 18h">
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
<change beforePath="$PROJECT_DIR$/GlobalVariable.py" beforeDir="false" afterPath="$PROJECT_DIR$/GlobalVariable.py" afterDir="false" />
<change beforePath="$PROJECT_DIR$/Inscription_mgt.py" beforeDir="false" afterPath="$PROJECT_DIR$/Inscription_mgt.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$/agenda.py" beforeDir="false" afterPath="$PROJECT_DIR$/agenda.py" afterDir="false" />
<change beforePath="$PROJECT_DIR$/apprenant_mgt.py" beforeDir="false" afterPath="$PROJECT_DIR$/apprenant_mgt.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$/class_mgt.py" beforeDir="false" afterPath="$PROJECT_DIR$/class_mgt.py" afterDir="false" />
<change beforePath="$PROJECT_DIR$/main.py" beforeDir="false" afterPath="$PROJECT_DIR$/main.py" afterDir="false" />
<change beforePath="$PROJECT_DIR$/prj_common.py" beforeDir="false" afterPath="$PROJECT_DIR$/prj_common.py" afterDir="false" />
</list>
<option name="SHOW_DIALOG" value="false" />
<option name="HIGHLIGHT_CONFLICTS" value="true" />

File diff suppressed because it is too large Load Diff

View File

@ -3595,16 +3595,12 @@ def Delete_List_SessionFormation(diction):
if diction['token']:
mytoken = diction['token']
# Verifier la validité du token
retval = mycommon.check_partner_token_validity("", mytoken)
if retval is False:
return "Err_Connexion", " La session de connexion n'est pas valide"
partner_recid = mycommon.get_parnter_recid_from_token(mytoken)
if (partner_recid is False):
mycommon.myprint(str(inspect.stack()[0][3]) + " - Les informations d'identification sont incorrectes ")
return False, "Impossible de récupérer la liste des stagiaires, Les informations d'identification sont incorrectes "
local_status, my_partner = mycommon.Check_Connexion_And_Return_Partner_Data(diction)
if (local_status is not True):
return local_status, my_partner
partner_recid = my_partner['recid']
list_session_id = []
if ("list_session_id" in diction.keys()):

View File

@ -12,6 +12,8 @@ import json
from bson import ObjectId
import re
from datetime import datetime, date
import attached_file_mgt
import prj_common as mycommon
import secrets
import inspect
@ -474,7 +476,7 @@ def Delete_Given_Apprenant(diction):
"""
Verifier que l'apprenant n'as pas d'incripiotn en cours ou valide
Verifier que l'apprenant n'as pas d'inscription en cours ou valide
"""
is_apprenant_has_valide_inscription_count = MYSY_GV.dbname['inscription'].count_documents({'apprenant_id':str(diction['apprenant_id']),
'status': {'$in': ['0','1','2'], },
@ -485,10 +487,29 @@ def Delete_Given_Apprenant(diction):
str(inspect.stack()[0][3]) + " Impossible de supprimer l'apprenant, il a "+str(is_apprenant_has_valide_inscription_count)+" inscription(s) en cours ou déjà validée(s) ")
return False, " Impossible de supprimer l'apprenant, il a "+str(is_apprenant_has_valide_inscription_count)+" inscription(s) en cours ou déjà validée(s) "
delete_retval = MYSY_GV.dbname['apprenant'].delete_one(
{'_id': ObjectId(str(diction['apprenant_id'])),
'partner_owner_recid':str(my_partner['recid'])}
)
# Suppression des pièces jointes associées
local_diction = {'token':str(diction['token']), 'object_owner_id':str(diction['apprenant_id']), 'object_owner_collection':'apprenant'}
local_status, local_retval = attached_file_mgt.Delete_Entity_Stored_Downloaded_File(local_diction)
if( local_status is False ):
return local_status, local_retval
#Suppression des images de l'apprenant
delete_qry = {'related_collection':'apprenant', 'related_collection_recid':str(diction['apprenant_id'])}
ret_val = MYSY_GV.dbname['mysy_images'].delete_many(delete_qry )
# Suppression l'apprenant
delete_qry_apprenant = {'_id':ObjectId(str(diction['apprenant_id'])),'partner_owner_recid':str(my_partner['recid']),
'valide':'1',
'locked':'0'}
ret_val_apprenant = MYSY_GV.dbname['apprenant'].delete_many(delete_qry_apprenant)
# /!\ Dans le cas ou il aurait des inscriptions annulé, on va supprimer ces lignes car l'apprenant a été supprimé
qry_delete_canceled_inscription = {'apprenant_id':str(diction['apprenant_id']), 'status': '-1', 'partner_owner_recid':str(my_partner['recid'])}
ret_val_cancelled_inscription = MYSY_GV.dbname['inscription'].delete_many(qry_delete_canceled_inscription)
return True, " L'apprenant a été correctement supprimé "
@ -499,6 +520,129 @@ def Delete_Given_Apprenant(diction):
"""
Suppressoin des apprenant en mass.
Attention, on effectue controle global avant de supprimer
"""
def Delete_List_Apprenant(diction):
try:
diction = mycommon.strip_dictionary(diction)
"""
Verification des input acceptés
"""
field_list = ['token', 'list_apprenant_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', 'list_apprenant_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 liste ")
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
list_apprenant_id = []
if ("list_apprenant_id" in diction.keys()):
if diction['list_apprenant_id']:
list_apprenant_id = str(diction['list_apprenant_id']).replace(",", ";").split(";")
# Verifier que toutes les conditions sont reunion pour toute la liste d'apprenants
is_blocking_message = False
blocking_message = "Erreur : "
for apprenant_id in list_apprenant_id:
# Verifier que l'apprenant existe deja
is_apprenant_exist = MYSY_GV.dbname['apprenant'].count_documents({'_id':ObjectId(str(apprenant_id)),
'partner_owner_recid':str(my_partner['recid']),
'valide':'1',
'locked':'0'})
if( is_apprenant_exist <= 0 ):
mycommon.myprint(
str(inspect.stack()[0][3]) + " L'identifiant de l'apprenant n'est pas valide ")
is_blocking_message = True
blocking_message = blocking_message + " \n L'identifiant de l'apprenant "+str(apprenant_id)+" n'est pas valide "
apprenant_data = MYSY_GV.dbname['apprenant'].find_one({'_id': ObjectId(str(apprenant_id)),
'partner_owner_recid': str(
my_partner['recid']),
'valide': '1',
'locked': '0'})
"""
Verifier que l'apprenant n'as pas d'inscription en cours ou valide
"""
is_apprenant_has_valide_inscription_count = MYSY_GV.dbname['inscription'].count_documents({'apprenant_id':str(apprenant_id),
'status': {'$in': ['0','1','2'], },
'partner_owner_recid':str(my_partner['recid'])})
if( is_apprenant_has_valide_inscription_count > 0 ):
mycommon.myprint(
str(inspect.stack()[0][3]) + " L'apprenant avec l'adress email : "+str(apprenant_data['email'])+" a "+str(is_apprenant_has_valide_inscription_count)+" inscription(s) en cours ou déjà validée(s) ")
is_blocking_message = True
blocking_message = blocking_message + " \n L'apprenant avec l'adress email : "+str(apprenant_data['email'])+" a "+str(is_apprenant_has_valide_inscription_count)+" inscription(s) en cours ou déjà validée(s) "
if( is_blocking_message is True ):
return False, blocking_message
is_warning_message = False
warning_message = "Warning : "
for apprenant_id in list_apprenant_id:
local_diction = {"token":str(diction['token']), "apprenant_id":str(apprenant_id)}
apprenant_data = MYSY_GV.dbname['apprenant'].find_one({'_id': ObjectId(str(apprenant_id)),
'partner_owner_recid': str(
my_partner['recid']),
'valide': '1',
'locked': '0'})
local_status, local_retval = Delete_Given_Apprenant(local_diction)
if( local_status is False ):
is_warning_message = True
warning_message = "\n impossible de supprimer l'apprenant : "+str(apprenant_data['email'])+" "
if( is_warning_message is True ):
return True, " Les apprenants ont été supprimés avec les erreurs suivantes : \n "+str(warning_message)
return True, " Les apprenants ont correctement supprimés "
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 de l'apprenant "
"""
Récuperer la liste des apprenants d'un partenaire
"""
@ -716,7 +860,7 @@ def Apprenant_Inscrire_Session(diction):
'valide':'1',
})
if (is_apprenant_exist <= 0):
if (is_session_existe <= 0):
mycommon.myprint(
str(inspect.stack()[0][3]) + " L'identifiant de la session de formation n'est pas valide ")
return False, " L'identifiant de la session de formation n'est pas valide ",
@ -775,6 +919,150 @@ def Apprenant_Inscrire_Session(diction):
return False, " Impossible d'inscrire l'apprenant à la session de formation "
"""
Inscrire une liste d'apprenant à une session de formation
"""
def Apprenant_Inscrire_Session_List(diction):
try:
diction = mycommon.strip_dictionary(diction)
"""
Verification des input acceptés
"""
field_list = ['token', 'list_apprenant_id', 'session_id', 'type_apprenant' , 'modefinancement']
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', 'list_apprenant_id', 'session_id', 'type_apprenant' ]
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 liste ")
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 type d'apprenant est bien valide
type_apprenant = "0"
if( str(diction['type_apprenant']) not in MYSY_GV.INSCRIPTION_TYPE_APPRENANT ):
mycommon.myprint(
str(inspect.stack()[0][3]) + " Le type d'apprenant est invalide ")
return False, " Le type d'apprenant est invalide "
else:
type_apprenant = str(diction['type_apprenant'])
# Verifier que la session de formation existe et est valide
is_session_existe = MYSY_GV.dbname['session_formation'].count_documents(
{'_id': ObjectId(str(diction['session_id'])),
'partner_owner_recid': str(my_partner['recid']),
'valide': '1',
})
if (is_session_existe <= 0):
mycommon.myprint(
str(inspect.stack()[0][3]) + " L'identifiant de la session de formation n'est pas valide ")
return False, " L'identifiant de la session de formation n'est pas valide ",
list_apprenant_id = []
if ("list_apprenant_id" in diction.keys()):
if diction['list_apprenant_id']:
list_apprenant_id = str(diction['list_apprenant_id']).replace(",", ";").split(";")
is_blocking_message = False
blocking_message = "Erreur : "
for apprenant_id in list_apprenant_id :
# Verifier que l'apprenant existe
is_apprenant_exist = MYSY_GV.dbname['apprenant'].count_documents({'_id':ObjectId(str(apprenant_id)),
'partner_owner_recid':str(my_partner['recid']),
'valide':'1',
'locked':'0'})
if( is_apprenant_exist <= 0 ):
mycommon.myprint(
str(inspect.stack()[0][3]) + " L'identifiant de l'apprenant n'est pas valide ")
is_blocking_message = True
blocking_message = "\n L'identifiant de l'apprenant :"+str(apprenant_id)+" n'est pas valide "
# Recuperer les données de l'apprenant
apprenant_data = MYSY_GV.dbname['apprenant'].find_one({'_id': ObjectId(str(apprenant_id)),
'partner_owner_recid': str(my_partner['recid']),
'valide': '1',
'locked': '0'})
# Verifier que l'apprenant n'est pas inscrit à cette session
is_inscrit_session_count = MYSY_GV.dbname['inscription'].count_documents({'session_id':str(diction['session_id']),
'apprenant_id':str(apprenant_id)})
if( is_inscrit_session_count > 0 ):
is_blocking_message = True
blocking_message = "\n L'apprenant :" + str(apprenant_data['email']) + " est déjà inscrit à cette session "
if( is_blocking_message is True):
return False, blocking_message
is_warning_message = False
warning_message = "Warning : "
# field_list = ['token', '_id', 'session_id', 'type_apprenant' , 'modefinancement']
for apprenant_id in list_apprenant_id:
# Recuperer les données de l'apprenant
apprenant_data = MYSY_GV.dbname['apprenant'].find_one({'_id': ObjectId(str(apprenant_id)),
'partner_owner_recid': str(my_partner['recid']),
'valide': '1',
'locked': '0'})
local_diction = {}
local_diction['token'] = diction['token']
local_diction['_id'] = str(apprenant_id)
local_diction['session_id'] = diction['session_id']
local_diction['type_apprenant'] = diction['type_apprenant']
local_diction['modefinancement'] = diction['modefinancement']
local_status, local_retval =Apprenant_Inscrire_Session(local_diction)
if( local_status is False ):
is_warning_message = True
warning_message = "\n impossible d'inscrire l'apprenant : " + str(apprenant_data['email']) + " "
if (is_warning_message is True):
return True, " Les apprenants ont été inscrits avec les erreurs suivantes : \n " + str(warning_message)
return True, " Les apprenants ont correctement inscrits "
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 d'inscrire l'apprenant à la session de formation "
"""
Recuperation de la liste des inscriptions de cet apprenant
"""
@ -1555,3 +1843,91 @@ def Controle_Add_Apprenant_mass(saved_file=None, Folder=None, diction=None):
mycommon.myprint(
str(inspect.stack()[0][3]) + " -" + str(e) + " - ERRORRRR AT Line : " + str(exc_tb.tb_lineno))
return False, "Impossible de controler le fichier des apprenants "
"""
Mise à jour tuteurs d'un apprenant
"""
def Update_Apprenant_Tuteurs(diction):
try:
return_message = ""
field_list = ['token', '_id',
'tuteur1_nom', 'tuteur1_prenom', 'tuteur1_email', 'tuteur1_telephone', 'tuteur1_adresse',
'tuteur1_cp', 'tuteur1_ville', 'tuteur1_pays', 'tuteur1_include_com',
'tuteur2_nom', 'tuteur2_prenom', 'tuteur2_email', 'tuteur2_telephone', 'tuteur2_adresse',
'tuteur2_cp', 'tuteur2_ville', 'tuteur2_pays', 'tuteur2_include_com',
]
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é, Creation partenaire annulée")
return False, "Impossible de mettre à jour stagiaire. Toutes les informations fournies ne sont pas valables"
"""
Verification de la liste des champs obligatoires
"""
field_list_obligatoire = ['token', '_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 liste ")
return False, "Impossible de mettre à jour stagiaire, Toutes les informations necessaires n'ont pas été fournies"
query_key = {}
mytoken = ""
if ("token" in diction.keys()):
if diction['token']:
mytoken = str(diction['token']).strip()
# query_key['token'] = diction['token']
if( "tuteur1_email" in diction.keys() and diction['tuteur1_email']):
if( mycommon.isEmailValide ( str(diction['tuteur1_email'])) is False ):
mycommon.myprint(
str(inspect.stack()[0][3]) + " L'adresse email '"+str(diction['tuteur1_email'])+"' est invalide ")
return False, "L'adresse email '"+str(diction['tuteur1_email'])+"' est invalide"
if ("tuteur2_email" in diction.keys() and diction['tuteur2_email'] ):
if (mycommon.isEmailValide(str(diction['tuteur2_email'])) is False):
mycommon.myprint(
str(inspect.stack()[0][3]) + " L'adresse email '" + str(
diction['tuteur2_email']) + "' est invalide ")
return False, "L'adresse email '" + str(diction['tuteur2_email']) + "' est invalide"
local_status, my_partner = mycommon.Check_Connexion_And_Return_Partner_Data({'token': mytoken})
if (local_status is not True):
return local_status, my_partner
data_update = diction
my_id = str(diction['_id'])
del data_update['token']
del data_update['_id']
data_update['date_update'] = str(datetime.now())
data_update['update_by'] = str(my_partner['_id'])
result = MYSY_GV.dbname['apprenant'].find_one_and_update(
{'_id':ObjectId(str(my_id)),
'partner_owner_recid':str(my_partner['recid'])},
{"$set": data_update},
upsert=False,
return_document=ReturnDocument.AFTER
)
if (result is None or "_id" not in result.keys()):
mycommon.myprint(
" Impossible de mettre à jour le tuteur (2) ")
return False, " Impossible de mettre à jour le tuteur (2) "
return True, " Le tuteur a été correctement mis à jour "
except Exception as e:
exc_type, exc_obj, exc_tb = sys.exc_info()
mycommon.myprint(str(inspect.stack()[0][3]) + " -" + str(e) + " - ERRORRRR AT Line : " + str(exc_tb.tb_lineno))
return False, "Impossible de mettre à jour le tuteur "

View File

@ -518,3 +518,79 @@ def Delete_Stored_Downloaded_File(diction):
exc_type, exc_obj, exc_tb = sys.exc_info()
mycommon.myprint(str(inspect.stack()[0][3]) + " -" + str(e) + " - ERRORRRR AT Line : " + str(exc_tb.tb_lineno))
return False, " Impossible de supprimer le fichier"
"""
Suppression de toutes les pièces jointes d'une entité données (object_owner_id)
par exemple lorqu'on supprime un apprenant, il faudrait supprimer toutes
les pièces jointes associé à cette personne
"""
def Delete_Entity_Stored_Downloaded_File(diction):
try:
full_file_path = ""
diction = mycommon.strip_dictionary(diction)
"""
Verification des input acceptés
"""
field_list = ['token', 'object_owner_id', 'object_owner_collection']
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', 'object_owner_id', 'object_owner_collection']
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 liste ")
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']
# Verifier que le l'entité existe (ON NE verifie PAS le valide ou locked)
is_entity_valide = MYSY_GV.dbname[str(diction['object_owner_collection'])].count_documents({'_id':ObjectId(str(diction['object_owner_id']))})
if( is_entity_valide <= 0 ):
mycommon.myprint(
str(inspect.stack()[0][3]) + " L'identifiant de l'entité est invalide ")
return False, " L'identifiant de l'entité est invalide "
for val in MYSY_GV.dbname['download_files'].find({'object_owner_collection':str(diction['object_owner_collection']),
'object_owner_id':str(diction['object_owner_id'])}):
if( "full_path" in val.keys() ):
file_name_to_remove = val['full_path']
try:
os.unlink(file_name_to_remove)
except:
mycommon.myprint(
str(inspect.stack()[0][3]) + " WARNING : Impossible de supprimer physiquement le fichier "+str(file_name_to_remove)+" ")
"""
Suppression des données dans la collection
"""
delete_row = MYSY_GV.dbname['download_files'].delete_many({'object_owner_collection': str(diction['object_owner_collection']),
'object_owner_id': str(diction['object_owner_id'])})
return True, " ("+str(delete_row.deleted_count)+" document(s) supprimé(s) "
except Exception as e:
exc_type, exc_obj, exc_tb = sys.exc_info()
mycommon.myprint(str(inspect.stack()[0][3]) + " -" + str(e) + " - ERRORRRR AT Line : " + str(exc_tb.tb_lineno))
return False, " Impossible de supprimer les fichier"

View File

@ -2309,11 +2309,11 @@ def get_partner_class(diction):
filt_title = {}
if ("title" in diction.keys()):
filt_title = {'title': {'$regex': str(diction['title']), "$options": "i"}}
filt_title = {'title': str(diction['title'])}
filt_internal_url = {}
if ("internal_url" in diction.keys()):
filt_internal_url = {'internal_url': {'$regex': str(diction['internal_url']), "$options": "i"}}
filt_internal_url = {'internal_url': str(diction['internal_url'])}
#print(" filt_internal_url GRRRRRRRRRRRRRRRRRRRRrr "+str(filt_internal_url))
"""
@ -2325,6 +2325,7 @@ def get_partner_class(diction):
"""
val_tmp = 1
for retVal in coll_name.find( {"$and":[ {'valide':'1'},{'locked':'0'},
{'partner_owner_recid':user_recid} ,
filt_external_code, filt_title, filt_internal_url]},

40
main.py
View File

@ -6574,6 +6574,21 @@ def Apprenant_Inscrire_Session():
return jsonify(status=status, message=retval)
"""
API pour inscrire une liste d'apprenants à une session de formation
"""
@app.route('/myclass/api/Apprenant_Inscrire_Session_List/', methods=['POST','GET'])
@crossdomain(origin='*')
def Apprenant_Inscrire_Session_List():
# On recupere le corps (payload) de la requete
payload = mycommon.strip_dictionary (request.form.to_dict())
print(" ### Apprenant_Inscrire_Session_List payload = ",payload)
status, retval = apprenant_mgt.Apprenant_Inscrire_Session_List(payload)
return jsonify(status=status, message=retval)
"""
API Pour recuperer la liste des inscription et preinscription d'un apprenant
"""
@ -6643,7 +6658,6 @@ def Add_Apprenant_mass():
"""
API pour recuperer l'image d'un apprenant
"""
@ -6658,6 +6672,30 @@ def Get_Apprenant_Recorded_Image_from_front():
"""
API pour mettre à jour les tuteurs d'un apprenant
"""
@app.route('/myclass/api/Update_Apprenant_Tuteurs/', methods=['POST','GET'])
@crossdomain(origin='*')
def Update_Apprenant_Tuteurs():
# On recupere le corps (payload) de la requete
payload = mycommon.strip_dictionary (request.form.to_dict())
print(" ### Update_Apprenant_Tuteurs payload = ",payload)
status, retval = apprenant_mgt.Update_Apprenant_Tuteurs(payload)
return jsonify(status=status, message=retval)
"""
API de Suppression des apprenants en mass avec du controle de cohérence
"""
@app.route('/myclass/api/Delete_List_Apprenant/', methods=['POST','GET'])
@crossdomain(origin='*')
def Delete_List_Apprenant():
# On recupere le corps (payload) de la requete
payload = mycommon.strip_dictionary (request.form.to_dict())
print(" ### Delete_List_Apprenant payload = ",payload)
status, retval = apprenant_mgt.Delete_List_Apprenant(payload)
return jsonify(status=status, message=retval)

View File

@ -2013,14 +2013,14 @@ def DeleteClassImage_v2(diction=None):
query_delete = {"recid":image_recid, 'related_collection_recid': str(my_partner['recid']) }
print(" ### query_delete = ", query_delete)
#print(" ### query_delete = ", query_delete)
ret_val = coll_name.delete_one({"recid":image_recid,
'related_collection_recid': str(my_partner['recid']) },)
print(" ### detelete ret_val = ", ret_val)
#print(" ### detelete ret_val = ", ret_val)
print(" ### recordClassImage_v2 :L'image a été correctement supprimée ")
#print(" ### recordClassImage_v2 :L'image a été correctement supprimée ")
return True, "L'image a été correctement supprimée"