19/05/2026 - 20h30

Signed-off-by: Cherif <cbalde@mysy-training.com>
master_Elyos_FI
Cherif 2026-05-19 20:12:45 +02:00
parent baf7d42372
commit 7ec5259193
13 changed files with 18609 additions and 102 deletions

View File

@ -4,14 +4,19 @@
<option name="autoReloadType" value="SELECTIVE" />
</component>
<component name="ChangeListManager">
<list default="true" id="c6d0259a-16e1-410d-91a1-830590ee2a08" name="Changes" comment="15/05/2026 - 17h30">
<list default="true" id="c6d0259a-16e1-410d-91a1-830590ee2a08" name="Changes" comment="16/05/2026 - 13h30">
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
<change beforePath="$PROJECT_DIR$/Diplome_mgt.py" beforeDir="false" afterPath="$PROJECT_DIR$/Diplome_mgt.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$/Session_Formation_Sequence.py" beforeDir="false" afterPath="$PROJECT_DIR$/Session_Formation_Sequence.py" afterDir="false" />
<change beforePath="$PROJECT_DIR$/bloc_competence.py" beforeDir="false" afterPath="$PROJECT_DIR$/bloc_competence.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$/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$/partner_invoice.py" beforeDir="false" afterPath="$PROJECT_DIR$/partner_invoice.py" afterDir="false" />
<change beforePath="$PROJECT_DIR$/prj_common.py" beforeDir="false" afterPath="$PROJECT_DIR$/prj_common.py" afterDir="false" />
<change beforePath="$PROJECT_DIR$/unite_enseignement_mgt.py" beforeDir="false" afterPath="$PROJECT_DIR$/unite_enseignement_mgt.py" afterDir="false" />
</list>
<option name="SHOW_DIALOG" value="false" />
@ -456,7 +461,7 @@
<option name="project" value="LOCAL" />
<updated>1747251650255</updated>
</task>
<option name="localTasksCounter" value="582" />
<option name="localTasksCounter" value="583" />
<servers />
</component>
<component name="Vcs.Log.Tabs.Properties">
@ -498,7 +503,6 @@
</option>
</component>
<component name="VcsManagerConfiguration">
<MESSAGE value="04/04/26 - 20h" />
<MESSAGE value="07/04/2026 - 14h" />
<MESSAGE value="10/04/2026 - 18h" />
<MESSAGE value="17/04/2026 -19h" />
@ -523,6 +527,7 @@
<MESSAGE value="qsd" />
<MESSAGE value="13/05/26 - 17h" />
<MESSAGE value="15/05/2026 - 17h30" />
<option name="LAST_COMMIT_MESSAGE" value="15/05/2026 - 17h30" />
<MESSAGE value="16/05/2026 - 13h30" />
<option name="LAST_COMMIT_MESSAGE" value="16/05/2026 - 13h30" />
</component>
</project>

View File

@ -13051,6 +13051,8 @@ def Sent_Convention_Stagiaire_By_Email(tab_files, Folder, diction):
smtpserver.login(MYSY_GV.O365_SMTP_COUNT_user, MYSY_GV.O365_SMTP_COUNT_password)
val = smtpserver.send_message(msg)
smtpserver.close()
print(" Email envoyé " + str(val))

File diff suppressed because one or more lines are too long

View File

@ -18052,7 +18052,7 @@ def Add_Update_UE_To_Session(diction):
"""
Verification des input acceptés
"""
field_list = ['token', 'session_id', 'ue_id', 'formateur_id' ]
field_list = ['token', 'session_id', 'ue_id', 'formateur_id', 'diplome_id' ]
incom_keys = diction.keys()
for val in incom_keys:
@ -18129,6 +18129,20 @@ def Add_Update_UE_To_Session(diction):
str(inspect.stack()[0][3]) + " L'identifiant du formateur est invalide ")
return False, " L'identifiant du formateur est invalide "
"""
Verifier la validité du diplome
"""
local_diplome_id = ""
if ("diplome_id" in diction.keys() and diction['diplome_id']):
local_diplome_id = diction['diplome_id']
is_valide_diplome = MYSY_GV.dbname['diplome'].count_documents(
{'_id': ObjectId(diction['diplome_id']),
'partner_owner_recid': str(my_partner['recid'])})
if (is_valide_diplome != 1):
mycommon.myprint(
str(inspect.stack()[0][3]) + " L'identifiant du diplome est invalide ")
return False, " L'identifiant du diplome est invalide "
@ -18182,6 +18196,7 @@ def Add_Update_UE_To_Session(diction):
is_ue_id_existe_class = MYSY_GV.dbname['session_formation'].count_documents(
{'list_unite_enseignement._id': str(diction['ue_id']),
'list_unite_enseignement.diplome_id': str(local_diplome_id),
'_id': ObjectId(str(diction['session_id'])),
'partner_owner_recid': my_partner[
'recid'],
@ -18193,10 +18208,16 @@ def Add_Update_UE_To_Session(diction):
'partner_owner_recid': str(
my_partner['recid']),
'valide': '1',
'list_unite_enseignement._id': str(
diction['ue_id'])},
'list_unite_enseignement': {
'$elemMatch': {
'_id': str(diction['ue_id']),
'diplome_id': str(local_diplome_id)
}
}
},
{'$set':
{
'list_unite_enseignement.$[xxx].diplome_id': local_diplome_id,
'list_unite_enseignement.$[xxx].formateur_id': local_formateur_id,
'list_unite_enseignement.$[xxx].date_update': str(now),
'list_unite_enseignement.$[xxx].update_by': str(
@ -18205,7 +18226,11 @@ def Add_Update_UE_To_Session(diction):
},
upsert=False,
array_filters=[
{"xxx._id": str(diction['ue_id'])}
{
'xxx._id': str(diction['ue_id']),
'xxx.diplome_id': str(local_diplome_id)
}
]
)
@ -18234,6 +18259,7 @@ def Add_Update_UE_To_Session(diction):
new_data['update_by'] = str(my_partner['_id'])
new_data['locked'] = "0"
new_data['formateur_id'] = local_formateur_id
new_data['diplome_id'] = local_diplome_id
new_data['_id'] = str(diction['ue_id'])
insert = MYSY_GV.dbname['session_formation'].update_one({'_id': ObjectId(str(diction['session_id'])),
@ -18288,7 +18314,7 @@ def Delete_UE_From_Session(diction):
"""
Verification des input acceptés
"""
field_list = ['token', 'session_id', 'ue_id', ]
field_list = ['token', 'session_id', 'ue_id', 'diplome_id']
incom_keys = diction.keys()
for val in incom_keys:
@ -18388,18 +18414,42 @@ def Delete_UE_From_Session(diction):
mycommon.myprint(
" WARNING : Impossible de logguer l'historique pour l'évènement : " + str(history_event_dict))
if( "diplome_id" in diction.keys() and diction['diplome_id']):
delete = MYSY_GV.dbname['session_formation'].update_one({'_id': ObjectId(str(diction['session_id'])),
'partner_owner_recid': str(
my_partner['recid']),
'valide': '1',
'list_unite_enseignement._id': str(diction['ue_id']),
'list_unite_enseignement.diplome_id': str(diction['diplome_id'])
delete = MYSY_GV.dbname['session_formation'].update_one({'_id': ObjectId(str(diction['session_id'])),
'partner_owner_recid': str(
my_partner['recid']),
'valide': '1',
'list_unite_enseignement._id': str(diction['ue_id'])},
},
{'$pull': {'list_unite_enseignement': {
"_id": str(diction['ue_id'])}}}
)
{
'$pull': {
'list_unite_enseignement': {
'_id': str(diction['ue_id']),
'diplome_id': str(diction['diplome_id'])
}
}
}
)
else:
delete = MYSY_GV.dbname['session_formation'].update_one({'_id': ObjectId(str(diction['session_id'])),
'partner_owner_recid': str(
my_partner['recid']),
'valide': '1',
'list_unite_enseignement._id': str(
diction['ue_id']),
},
{'$pull': {'list_unite_enseignement': {
"_id": str(diction['ue_id']),
}
}}
)
return True, " L'UE a été correctement supprimée de la promotion / session "
@ -18422,7 +18472,7 @@ def Get_List_UE_Given_SessionFormation(diction):
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, "Toutes les informations fournies ne sont pas valables"
return False, "Toutes les informations fournies ne sont pas valables", False
"""
Verification de la liste des champs obligatoires
@ -18432,7 +18482,7 @@ def Get_List_UE_Given_SessionFormation(diction):
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, "Toutes les informations necessaires n'ont pas été fournies"
return False, "Toutes les informations necessaires n'ont pas été fournies", False
# Recuperation du recid du partner
mydata = {}
@ -18443,11 +18493,13 @@ def Get_List_UE_Given_SessionFormation(diction):
local_status, my_partner = mycommon.Check_Connexion_And_Return_Partner_Data(diction)
if (local_status is not True):
return local_status, my_partner
return local_status, my_partner, False
RetObject = []
val_tmp = 0
RetObject_tab_diplome = []
session_data = MYSY_GV.dbname['session_formation'].find_one({'_id': ObjectId(str(diction['session_id'])),
'partner_owner_recid': str(my_partner['recid']),
'valide': '1',
@ -18493,19 +18545,37 @@ def Get_List_UE_Given_SessionFormation(diction):
user['formateur_id'] = str(local_formateur_id)
user['formateur_prenom_nom'] = str(local_formateur_prenom_nom)
# Gestion des diplomes
diplome_id = ""
diplome_code = ""
if( "diplome_id" in local_ue.keys() and local_ue['diplome_id']):
local_diplome_id = local_ue['diplome_id']
local_diplome_data = MYSY_GV.dbname['diplome'].find_one(
{'_id': ObjectId(local_ue['diplome_id']),
'partner_owner_recid': str(my_partner['recid'])})
if( local_diplome_data and "code" in local_diplome_data.keys()):
diplome_id = local_ue['diplome_id']
diplome_code = local_diplome_data['code']
diplome_node = {}
diplome_node['_id'] = local_ue['diplome_id']
diplome_node['code'] = local_diplome_data['code']
RetObject_tab_diplome.append(mycommon.JSONEncoder().encode(diplome_node))
user['diplome_id'] = str(diplome_id)
user['diplome_code'] = str(diplome_code)
val_tmp = val_tmp + 1
RetObject.append(mycommon.JSONEncoder().encode(user))
return True, RetObject
return True, RetObject, RetObject_tab_diplome
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 recuperer la list des UE de la promotion / session "
return False, " Impossible de recuperer la list des UE de la promotion / session ", False
"""
Cette fonction retourne la configuration
"""

View File

@ -1850,6 +1850,10 @@ def Duplique_Session_Sequence(diction):
"""
Cette fonction permet de recuperer le nombre de sequence de formation
d'une session
16/05/2026 important :
on va verifier la validité des UE pour la session / propo, ainsi que les ressources.
Pour eviter des bug javascript, si un donneés n'est pas valide, on vide '_id'
"""
def Get_Session_Sequence_List(diction):
try:
@ -1922,6 +1926,7 @@ def Get_Session_Sequence_List(diction):
"""
Recuperer la couleur du groupe
"""
grp_apprenant_id = ""
if( "grp_apprenant_id" in user.keys() and user['grp_apprenant_id']):
groupe_data = MYSY_GV.dbname['groupe_inscription'].find_one({'_id':ObjectId(str(user['grp_apprenant_id'])),
'valide':'1',
@ -1935,13 +1940,19 @@ def Get_Session_Sequence_List(diction):
if (groupe_data and "code" in groupe_data.keys() and groupe_data['code']):
grp_apprenant_code = groupe_data['code']
if( groupe_data and '_id' in groupe_data.keys()):
grp_apprenant_id = str(groupe_data['_id'])
user['grp_apprenant_color'] = grp_apprenant_color
user['grp_apprenant_code'] = grp_apprenant_code
user['grp_apprenant_id'] = grp_apprenant_id
liste_groupe_code = ""
"""
Recuperer la couleur du groupe
"""
tab_grp_apprenant_ids = []
if ("tab_grp_apprenant_ids" in user.keys() and user['tab_grp_apprenant_ids']):
for local_grp_apprenant in user['tab_grp_apprenant_ids'] :
groupe_data = MYSY_GV.dbname['groupe_inscription'].find_one(
@ -1958,30 +1969,55 @@ def Get_Session_Sequence_List(diction):
liste_groupe_code = str(groupe_data['code'])+", "+str(liste_groupe_code)
grp_apprenant_code = groupe_data['code']
if (groupe_data and '_id' in groupe_data.keys()):
tab_grp_apprenant_ids.append(str(groupe_data['_id']))
user['grp_apprenant_color'] = grp_apprenant_color
user['grp_apprenant_code'] = grp_apprenant_code
user['liste_groupe_code'] = liste_groupe_code
if ("mode_animation" not in user.keys()):
user['mode_animation'] = "0"
ue_titre = ""
ue_code = ""
eu_id = ""
if ("ue_id" not in user.keys()):
user['ue_id'] = ""
elif ( "ue_id" in user.keys() and user['ue_id']):
eu_id_data = MYSY_GV.dbname['unite_enseignement'].find_one({'_id':ObjectId(str(user['ue_id'])),
'partner_owner_recid':str(my_partner['recid'])})
if(eu_id_data and "titre" in eu_id_data.keys() ):
ue_titre = eu_id_data['titre']
"""
16/05/2026 - Verifier que cette UE est toujours rattachée à la session concernée
Important : ca permet de gerer les eventuelle suppression d'UE dans d'une session
"""
is_valide_UE_in_Session_count = MYSY_GV.dbname['session_formation'].count_documents({'list_unite_enseignement._id':str(user['ue_id']),
'_id':ObjectId(str(user['ue_id']))})
if(is_valide_UE_in_Session_count > 0 ):
eu_id_data = MYSY_GV.dbname['unite_enseignement'].find_one({'_id':ObjectId(str(user['ue_id'])),
'partner_owner_recid':str(my_partner['recid'])})
if(eu_id_data and "titre" in eu_id_data.keys() ):
ue_titre = eu_id_data['titre']
if (eu_id_data and "code" in eu_id_data.keys()):
ue_code = eu_id_data['code']
if (eu_id_data and "eu_id" in eu_id_data.keys()):
eu_id = str(eu_id_data['_id'])
else:
ue_titre = ""
ue_code = ""
eu_id = ""
if (eu_id_data and "code" in eu_id_data.keys()):
ue_code = eu_id_data['code']
user['ue_code'] = ue_code
user['ue_titre'] = ue_titre
user['ue_id'] = eu_id
if ("unite_enseignement_planif_id" not in user.keys()):
user['unite_enseignement_planif_id'] = ""
@ -2043,8 +2079,10 @@ def Get_Session_Sequence_List(diction):
user['tab_ressource_humaine'] = tab_ressource_humaine
user['tab_ressource_materiel'] = tab_ressource_materiel
RetObject.append(mycommon.JSONEncoder().encode(user))
return True, RetObject, nb_sequence
except Exception as e:
@ -2176,6 +2214,15 @@ def Get_Given_Session_Sequence(diction):
if ("unite_enseignement_planif_id" not in user.keys()):
user['unite_enseignement_planif_id'] = ""
if ("confirmed" not in user.keys()):
user['confirmed'] = "0"
if ("confirmed_date" not in user.keys()):
user['confirmed_date'] = ""
if ("confirmed_by" not in user.keys()):
user['confirmed_by'] = ""
RetObject.append(mycommon.JSONEncoder().encode(user))
@ -2337,6 +2384,83 @@ def Delete_Given_Session_Sequence_Mass(diction):
"""
Validation en masse des sequence
"""
def Confirme_Valide_Given_Session_Sequence_Mass(diction):
try:
diction = mycommon.strip_dictionary(diction)
"""
Verification des input acceptés
"""
field_list = ['token', 'tab_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', 'tab_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
tab_id = ""
tab_id_ObjectID = []
if ("tab_id" in diction.keys()):
if diction['tab_id']:
tab_id = str(diction['tab_id']).split(",")
for tmp in tab_id :
if( tmp ):
tab_id_ObjectID.append(ObjectId(str(tmp)))
now = str(datetime.now())
update_data = {}
update_data['update_date'] = str(now)
update_data['update_by'] = str(my_partner['_id'])
update_data['confirmed'] = "1"
update_data['confirmed_date'] = str(now)
update_data['confirmed_by'] = str(my_partner['_id'])
result = MYSY_GV.dbname['session_formation_sequence'].update_many(
{'_id':{'$in':tab_id_ObjectID}, 'partner_owner_recid':str(my_partner['recid'])},
{'$set': update_data}
)
return True, str(result.modified_count)+" séquence(s) confirmée(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 confirmer les séquences"
"""
Affectation d'une ressource (humaine ou materielle) a une sequence
"""

View File

@ -990,7 +990,7 @@ def Add_Update_tab_UE_And_Competence_To_Bloc_Competence(diction):
if (local_status is not True):
return local_status, my_partner
local_diplome_id = ""
if( "diplome_id" in diction.keys() and diction['diplome_id']):
is_valide_diplome_id = MYSY_GV.dbname['diplome'].count_documents({'_id':ObjectId(str(diction['diplome_id'])),
'partner_owner_recid':str(my_partner['recid'])})
@ -1001,6 +1001,8 @@ def Add_Update_tab_UE_And_Competence_To_Bloc_Competence(diction):
3]) + " Le diplome est invalide ")
return False, " Le diplome est invalide"
local_diplome_id = str(diction['diplome_id'])
"""
Traitement d'un association avec compétence
@ -1057,7 +1059,7 @@ def Add_Update_tab_UE_And_Competence_To_Bloc_Competence(diction):
for local_eu_id in tab_ue:
local_mysy_single_field = str(diction['competence_id']) + "_" + str(local_eu_id)
local_mysy_single_field = str(diction['competence_id']) + "_" + str(local_eu_id)+"_"+str(local_diplome_id)
"""
Si local_mysy_single_field existe dans le bloc de compétence alors on fait un update,
si non on fait une insertion
@ -1180,7 +1182,7 @@ def Add_Update_tab_UE_And_Competence_To_Bloc_Competence(diction):
for local_eu_id in tab_ue:
local_mysy_single_field = str(diction['domaine_competence_id']) + "_" + str(local_eu_id)
local_mysy_single_field = str(diction['domaine_competence_id']) + "_" + str(local_eu_id)+"_"+str(local_diplome_id)
"""
Si local_mysy_single_field existe dans le bloc de compétence alors on fait un update,
si non on fait une insertion

View File

@ -8228,7 +8228,7 @@ def Delete_UE_From_Class(diction):
"""
Verification des input acceptés
"""
field_list = ['token', 'class_id', 'ue_id', ]
field_list = ['token', 'class_id', 'ue_id', 'diplome_id' ]
incom_keys = diction.keys()
for val in incom_keys:
@ -8276,7 +8276,8 @@ def Delete_UE_From_Class(diction):
is_ue_exist_count = MYSY_GV.dbname['unite_enseignement'].count_documents({'partner_owner_recid':my_partner['recid'],
'valide':'1',
'_id':ObjectId(str(diction['ue_id'])),
'locked':'0'
'locked':'0',
})
if( is_ue_exist_count != 1 ):
mycommon.myprint(
@ -8339,16 +8340,32 @@ def Delete_UE_From_Class(diction):
" WARNING : Impossible de logguer l'historique pour l'évènement : " + str(history_event_dict))
delete = MYSY_GV.dbname['myclass'].update_one({'_id': ObjectId(str(diction['class_id'])),
'partner_owner_recid': str(
my_partner['recid']),
'valide': '1',
'locked': '0',
'list_unite_enseignement._id': str(diction['ue_id'])},
if( "diplome_id" in diction.keys() and diction['diplome_id']):
delete = MYSY_GV.dbname['myclass'].update_one({'_id': ObjectId(str(diction['class_id'])),
'partner_owner_recid': str(
my_partner['recid']),
'valide': '1',
'locked': '0',
'list_unite_enseignement._id': str(diction['ue_id'])},
{'$pull': {'list_unite_enseignement': {
"_id": str(diction['ue_id'])}}}
)
{'$pull': {'list_unite_enseignement': {
"_id": str(diction['ue_id']),
'diplome_id': str(diction['diplome_id'])
}}}
)
else:
delete = MYSY_GV.dbname['myclass'].update_one({'_id': ObjectId(str(diction['class_id'])),
'partner_owner_recid': str(
my_partner['recid']),
'valide': '1',
'locked': '0',
'list_unite_enseignement._id': str(diction['ue_id'])},
{'$pull': {'list_unite_enseignement': {
"_id": str(diction['ue_id']),
}}}
)

38
main.py
View File

@ -2607,8 +2607,8 @@ def Get_List_UE_Given_SessionFormation():
# On recupere le corps (payload) de la requete
payload = mycommon.strip_dictionary (request.form.to_dict())
print(" ### Get_List_UE_Given_SessionFormation : payload = ",str(payload))
localStatus, message= SF.Get_List_UE_Given_SessionFormation(payload)
return jsonify(status=localStatus, message=message )
localStatus, message, diplome = SF.Get_List_UE_Given_SessionFormation(payload)
return jsonify(status=localStatus, message=message, diplome=diplome )
@ -8447,6 +8447,20 @@ def Delete_Given_Session_Sequence_Mass():
"""
API qui permet de confimer / valider des sequence de formation en masse
"""
@app.route('/myclass/api/Confirme_Valide_Given_Session_Sequence_Mass/', methods=['POST','GET'])
@crossdomain(origin='*')
def Confirme_Valide_Given_Session_Sequence_Mass():
# On recupere le corps (payload) de la requete
payload = mycommon.strip_dictionary (request.form.to_dict())
print(" ### Confirme_Valide_Given_Session_Sequence_Mass payload = ",)
status, retval = Session_Formation_Sequence.Confirme_Valide_Given_Session_Sequence_Mass(payload)
return jsonify(status=status, message=retval)
"""
API Affecter une ressource à une sequence (humaine ou materielle)
@ -11278,8 +11292,8 @@ def Get_List_Unite_Enseignement_Of_Given_Session_Id():
# On recupere le corps (payload) de la requete
payload = mycommon.strip_dictionary (request.form.to_dict())
print(" ### Get_List_Unite_Enseignement_Of_Given_Session_Id payload = ",payload)
status, retval = unite_enseignement_mgt.Get_List_Unite_Enseignement_Of_Given_Session_Id(payload)
return jsonify(status=status, message=retval)
status, retval, diplome = unite_enseignement_mgt.Get_List_Unite_Enseignement_Of_Given_Session_Id(payload)
return jsonify(status=status, message=retval, diplome=diplome)
@ -12138,6 +12152,22 @@ def Get_List_Participant_Notes():
"""
API pour Recuperer l'historique de modification d'une ligne de notes
"""
@app.route('/myclass/api/Get_Given_Participant_Notes_Change_History/', methods=['POST','GET'])
@crossdomain(origin='*')
def Get_Given_Participant_Notes_Change_History():
# On recupere le corps (payload) de la requete
payload = mycommon.strip_dictionary (request.form.to_dict())
print(" ### Get_Given_Participant_Notes_Change_History payload = ",payload)
status, retval = note_evaluation_mgt.Get_Given_Participant_Notes_Change_History(payload)
return jsonify(status=status, message=retval)
"""
API pour Exporter au format excel la liste des note de l'inscrit"""
@app.route('/myclass/api/Export_Excel_List_Participant_Notes/<token>/<tab_session_id>/<tab_inscription_id>/', methods=['POST','GET'])

View File

@ -51,6 +51,7 @@ from email.mime.text import MIMEText
from email.mime.base import MIMEBase
from email import encoders
import attached_file_mgt
from main import disable_class
"""
Ajout d'une evaluation planifiée
@ -65,7 +66,8 @@ def Add_Evaluation_Planification(diction):
field_list = ['token', 'code', 'titre', 'description', 'comment',
'class_id', 'class_eu_id', 'type_eval_id',
'eval_date_heure_debut', 'eval_date_heure_fin', 'statut', 'adress', 'cp', 'ville',
'pays', 'responsable_id', 'session_id', 'mode_animation']
'pays', 'responsable_id', 'session_id', 'mode_animation', 'rattrapage',
'tab_diplome_ids']
incom_keys = diction.keys()
for val in incom_keys:
@ -114,6 +116,24 @@ def Add_Evaluation_Planification(diction):
return False, " La formation et l'UE ne sont pas cohérents "
"""
Verif des diplomes
"""
tab_diplome_ids = []
tab_diplome_ids_work = []
if( "tab_diplome_ids" in diction.keys() and diction['tab_diplome_ids']):
tab_diplome_ids_work = diction['tab_diplome_ids'].split(",")
for tmp in tab_diplome_ids_work :
if( tmp ):
is_valide_diplome = MYSY_GV.dbname['diplome'].count_documents({'_id':ObjectId(str(tmp)),
'partner_owner_recid':str(my_partner['recid'])})
if( is_valide_diplome != 1):
mycommon.myprint(
str(inspect.stack()[0][3]) + " L'identifiant du diplome "+str(tmp)+" est invalide ")
return False, " L'identifiant du diplome "+str(tmp)+" est invalide "
tab_diplome_ids.append(str(tmp))
"""
Verifier que le type d'évaluation est valide
"""
@ -202,22 +222,26 @@ def Add_Evaluation_Planification(diction):
Aller recuperer les criteres de notation : max_note et type_note
class_unite_enseignement_type_evaluation
"""
notation_critere_is_valide = MYSY_GV.dbname['class_unite_enseignement_type_evaluation'].count_documents({'class_id':str(diction['class_id']),
'type_evaluation_id': str(diction['type_eval_id']),
'class_ue_id':str(diction['class_eu_id']),
'partner_owner_recid':
my_partner[
'recid'],
'valide': '1',
'locked': '0'
})
if( notation_critere_is_valide != 1 ):
mycommon.myprint(
str(inspect.stack()[0][
3]) + " Les critères de notation ne sont pas valides. - collection: class_unite_enseignement_type_evaluation")
return False, " Les critères de notation ne sont pas valides."
for local_diplome in tab_diplome_ids:
notation_critere_is_valide = MYSY_GV.dbname['class_unite_enseignement_type_evaluation'].count_documents({'class_id':str(diction['class_id']),
'type_evaluation_id': str(diction['type_eval_id']),
'class_ue_id':str(diction['class_eu_id']),
'partner_owner_recid':
my_partner[
'recid'],
'valide': '1',
'locked': '0',
'diplome_id':local_diplome
})
if( notation_critere_is_valide != 1 ):
mycommon.myprint(
str(inspect.stack()[0][
3]) + " Les critères de notation ne sont pas valides. - collection: class_unite_enseignement_type_evaluation")
return False, " Les critères de notation ne sont pas valides."
notation_critere_data = MYSY_GV.dbname['class_unite_enseignement_type_evaluation'].find_one(
{'class_id': str(diction['class_id']),
@ -255,12 +279,16 @@ def Add_Evaluation_Planification(diction):
else:
new_data['type_note'] = "num"
if( "rattrapage" not in new_data.keys() or new_data['rattrapage'] not in ['0', '1', '']):
new_data['rattrapage'] = '0'
new_data['valide'] = "1"
new_data['locked'] = "0"
new_data['create_date'] = str(datetime.now())
new_data['creation_by'] = str(my_partner['_id'])
new_data['partner_owner_recid'] = str(my_partner['recid'])
new_data['tab_diplome_ids'] = tab_diplome_ids
inserted_id = MYSY_GV.dbname['note_evaluation'].insert_one(new_data).inserted_id
if (not inserted_id):
@ -316,7 +344,8 @@ def Update_Evaluation_Planification(diction):
field_list = ['token', 'evaluation_id', 'code', 'titre', 'description', 'comment',
'class_id', 'class_eu_id', 'type_eval_id',
'eval_date_heure_debut', 'eval_date_heure_fin', 'statut', 'site_id', 'adress', 'cp', 'ville',
'pays', 'responsable_id', 'session_id', 'mode_animation']
'pays', 'responsable_id', 'session_id', 'mode_animation', 'rattrapage',
'tab_diplome_ids']
incom_keys = diction.keys()
for val in incom_keys:
@ -350,6 +379,25 @@ def Update_Evaluation_Planification(diction):
if (local_status is not True):
return local_status, my_partner
"""
Verif des diplomes
"""
tab_diplome_ids = []
tab_diplome_ids_work = []
if ("tab_diplome_ids" in diction.keys() and diction['tab_diplome_ids']):
tab_diplome_ids_work = diction['tab_diplome_ids'].split(",")
for tmp in tab_diplome_ids_work:
if (tmp):
is_valide_diplome = MYSY_GV.dbname['diplome'].count_documents({'_id': ObjectId(str(tmp)),
'partner_owner_recid': str(
my_partner['recid'])})
if (is_valide_diplome != 1):
mycommon.myprint(
str(inspect.stack()[0][3]) + " L'identifiant du diplome " + str(tmp) + " est invalide ")
return False, " L'identifiant du diplome " + str(tmp) + " est invalide "
tab_diplome_ids.append(str(tmp))
"""
Verifier que class_ue_id est valide
@ -463,27 +511,32 @@ def Update_Evaluation_Planification(diction):
if ("mode_animation" in diction.keys() and diction['mode_animation'] not in ['0', '1']):
del diction['mode_animation']
"""
Aller recuperer les criteres de notation : max_note et type_note
class_unite_enseignement_type_evaluation
"""
notation_critere_is_valide = MYSY_GV.dbname['class_unite_enseignement_type_evaluation'].count_documents(
{'class_id': str(diction['class_id']),
'type_evaluation_id': str(diction['type_eval_id']),
'class_ue_id': str(diction['class_eu_id']),
'partner_owner_recid':
my_partner[
'recid'],
'valide': '1',
'locked': '0'
})
"""
for local_diplome in tab_diplome_ids:
notation_critere_is_valide = MYSY_GV.dbname['class_unite_enseignement_type_evaluation'].count_documents(
{'class_id': str(diction['class_id']),
'type_evaluation_id': str(diction['type_eval_id']),
'class_ue_id': str(diction['class_eu_id']),
'partner_owner_recid':
my_partner[
'recid'],
'valide': '1',
'locked': '0',
'diplome_id': local_diplome
})
if (notation_critere_is_valide != 1):
mycommon.myprint(
str(inspect.stack()[0][
3]) + " Les critères de notation ne sont pas valides. - collection: class_unite_enseignement_type_evaluation")
if (notation_critere_is_valide != 1):
mycommon.myprint(
str(inspect.stack()[0][
3]) + " Les critères de notation ne sont pas valides. - collection: class_unite_enseignement_type_evaluation")
return False, " Les critères de notation ne sont pas valides."
return False, " Les critères de notation ne sont pas valides."
notation_critere_data = MYSY_GV.dbname['class_unite_enseignement_type_evaluation'].find_one(
{'class_id': str(diction['class_id']),
@ -519,11 +572,17 @@ def Update_Evaluation_Planification(diction):
else:
new_data['max_note'] = "20"
if ("tab_diplome_ids" in diction.keys() ):
new_data['tab_diplome_ids'] = tab_diplome_ids
if ("type_note" in notation_critere_data.keys()):
new_data['type_note'] = notation_critere_data['type_note']
else:
new_data['type_note'] = "num"
if ("rattrapage" in new_data.keys() and new_data['rattrapage'] not in ['0', '1']):
new_data['rattrapage'] = "0"
result = MYSY_GV.dbname['note_evaluation'].find_one_and_update(
{'_id': ObjectId(str(local_evaluation_id)),
@ -845,6 +904,9 @@ def Get_List_Evaluation_Planification_No_Filter(diction):
if ("max_note" not in user.keys()):
user['max_note'] = "20"
if ("rattrapage" not in user.keys()):
user['rattrapage'] = "0"
RetObject.append(mycommon.JSONEncoder().encode(user))
return True, RetObject
@ -870,7 +932,7 @@ def Get_List_Evaluation_Planification_With_Filter(diction):
"""
Verification des input acceptés
"""
field_list = ['token','class_external_code', 'code_session', 'code_ue']
field_list = ['token','class_external_code', 'code_session', 'code_ue', 'rattrapage']
incom_keys = diction.keys()
for val in incom_keys:
@ -977,6 +1039,12 @@ def Get_List_Evaluation_Planification_With_Filter(diction):
#print(" ### filt_ue_id des Id list_ue_id ", filt_ue_id)
filt_rattrapage = {}
if( "rattrapage" in diction.keys() and diction['rattrapage'] == "1"):
filt_rattrapage = {"rattrapage":"1"}
elif ("rattrapage" in diction.keys() and diction['rattrapage'] == "0"):
filt_rattrapage = {"rattrapage": {"$ne":"1"}}
"""
Clés de mise à jour
"""
@ -985,7 +1053,7 @@ def Get_List_Evaluation_Planification_With_Filter(diction):
data_cle['valide'] = "1"
data_cle['locked'] = "0"
query = {"$and": [filt_session_id, filt_class_id, filt_ue_id, data_cle]}
query = {"$and": [filt_session_id, filt_class_id, filt_ue_id, data_cle, filt_rattrapage]}
@ -1003,6 +1071,9 @@ def Get_List_Evaluation_Planification_With_Filter(diction):
if ("max_note" not in user.keys()):
user['max_note'] = "20"
if ("rattrapage" not in user.keys()):
user['rattrapage'] = "0"
RetObject.append(mycommon.JSONEncoder().encode(user))
return True, RetObject
@ -1084,7 +1155,50 @@ def Get_Given_Evaluation_Planification(diction):
if( "mode_animation" not in retval.keys() ):
user['mode_animation'] = ""
if ("rattrapage" not in retval.keys()):
user['rattrapage'] = ""
"""
Pour gerer la selection des diplomes
1 - recuperer la liste globale des diplome de l'UE
2 - Mettre les diplome de l'UE choisi
"""
tab_evaluation_selected_diplome = []
tab_all_UE_diplome = []
if( "session_id" in user.keys() and user['session_id']):
local_session_data = MYSY_GV.dbname['session_formation'].find_one({'_id':ObjectId(str(user['session_id'])),
'partner_owner_recid':str(my_partner['recid'])}, {'list_unite_enseignement':1, 'class_eu_id':1})
if( local_session_data and 'list_unite_enseignement' in local_session_data.keys()):
for local_ue in local_session_data['list_unite_enseignement']:
if( '_id' in local_ue.keys() and local_ue['_id'] == user['class_eu_id'] and
"diplome_id" in local_ue.keys() and local_ue['diplome_id'] ):
diplome_data = MYSY_GV.dbname['diplome'].find_one({'_id':ObjectId(str(local_ue['diplome_id'])),
'partner_owner_recid':str(my_partner['recid'])})
if( diplome_data and "code" in diplome_data.keys() ):
local_node_all_eu_diplome = {}
local_node_all_eu_diplome['_id'] = str(local_ue['diplome_id'])
local_node_all_eu_diplome['code'] = str(diplome_data['code'])
local_node_all_eu_diplome['label'] = str(diplome_data['code'])
local_node_all_eu_diplome['ue_id'] = str(local_ue['_id'])
tab_all_UE_diplome.append(local_node_all_eu_diplome)
for ue_selected_diplome in user['tab_diplome_ids']:
if( diplome_data and str(diplome_data['_id']) == ue_selected_diplome):
local_node_selected_eu_diplome = {}
local_node_selected_eu_diplome['_id'] = str(local_ue['diplome_id'])
local_node_selected_eu_diplome['code'] = str(diplome_data['code'])
local_node_selected_eu_diplome['label'] = str(diplome_data['code'])
local_node_selected_eu_diplome['ue_id'] = str(local_ue['_id'])
tab_evaluation_selected_diplome.append(local_node_selected_eu_diplome)
user['tab_all_ue_diplome'] = tab_all_UE_diplome
user['tab_evaluation_selected_diplome'] = tab_evaluation_selected_diplome
print(" ### user = ", user)
RetObject.append(mycommon.JSONEncoder().encode(user))
return True, RetObject
@ -2261,10 +2375,20 @@ def Update_Participant_Evaluation_Note(diction):
for val in JSON_tab_participant_note:
if( '_id' in val.keys() and val['_id'] ):
"""
Recuperer la ligne de 'note_evaluation_participant' associé à cet inscrit
"""
note_evaluation_participant_data = MYSY_GV.dbname['note_evaluation_participant'].find_one(
{'_id': ObjectId(str(val['_id'])),
'valide': '1',
'locked': '0',
'partner_owner_recid': str(my_partner['recid'])})
#print(" #### VAL = ", val)
new_data = {}
if("note" in val.keys() ):
new_data['note'] = str(val['note'])
local_note = round(mycommon.tryFloat(str(val['note'])), 2)
new_data['note'] = str(local_note)
else:
new_data['note'] = "-1"
@ -2283,6 +2407,52 @@ def Update_Participant_Evaluation_Note(diction):
new_data['update_by'] = str(my_partner['_id'])
new_data['partner_owner_recid'] = str(my_partner['recid'])
"""
17/05/2026 - loguer les modification des notes, seulement pour celles qui change
"""
if( note_evaluation_participant_data['note'] != new_data['note'] ):
local_history_note_changed = {}
connected_user_nom = ""
if( "nom" in my_partner.keys()):
connected_user_nom = str(my_partner["nom"])
connected_user_prenom = ""
if ("prenom" in my_partner.keys()):
connected_user_prenom = str(my_partner["prenom"])
connected_user_email = ""
if ("email" in my_partner.keys()):
connected_user_email = str(my_partner["email"])
local_history_note_changed['change_by'] = str(my_partner['_id']) + "/" + str(connected_user_nom)+"/"+str(connected_user_prenom)
local_history_note_changed['change_email'] = connected_user_email
local_history_note_changed['change_date'] = str(str(datetime.now().strftime("%d/%m/%Y %H:%M:%S")))
if( "note" in note_evaluation_participant_data.keys()):
local_history_note_changed['old_note'] = str(note_evaluation_participant_data['note'])
else:
local_history_note_changed['old_note'] = ""
if ("note" in val.keys()):
local_history_note_changed['new_note'] = str(new_data['note'])
else:
local_history_note_changed['new_note'] = "-1"
local_history_note_changed['change_comment'] = str(local_history_note_changed['old_note'])+" ==> "+str(local_history_note_changed['new_note'])
new_tab_history_note_changed = []
new_tab_history_note_changed.append(local_history_note_changed)
if ("note_history_change" in note_evaluation_participant_data.keys()):
for existing_history in note_evaluation_participant_data['note_history_change']:
new_tab_history_note_changed.append(existing_history)
new_data['note_history_change'] = new_tab_history_note_changed
ret_val = MYSY_GV.dbname['note_evaluation_participant'].find_one_and_update(
{'_id': ObjectId(str(val['_id'])),
'partner_owner_recid': str(my_partner['recid'])},
@ -2328,7 +2498,7 @@ def Publish_Unpublish_Participant_Evaluation_Note(diction):
"""
Verification des input acceptés
"""
field_list = ['token', 'evaluation_id', 'tab_inscription_id', 'publish_status']
field_list = ['token', 'evaluation_id', 'tab_inscription_id', 'publish_status', 'action_date_time', ]
incom_keys = diction.keys()
for val in incom_keys:
@ -2340,7 +2510,7 @@ def Publish_Unpublish_Participant_Evaluation_Note(diction):
"""
Verification des champs obligatoires
"""
field_list_obligatoire = ['token', 'evaluation_id', 'tab_inscription_id', 'publish_status']
field_list_obligatoire = ['token', 'evaluation_id', 'tab_inscription_id']
for val in field_list_obligatoire:
if val not in diction:
@ -2368,6 +2538,21 @@ def Publish_Unpublish_Participant_Evaluation_Note(diction):
if (local_status is not True):
return local_status, my_partner
"""
Verifier que les dates sont correctes
"""
if( "action_date_time" in diction.keys() and diction['action_date_time']):
local_status = mycommon.CheckisDate_Hours(str(diction['action_date_time']).strip()[0:16])
if (local_status is False):
mycommon.myprint(
str(inspect.stack()[0][
3]) + " La date de publication n'est pas au format jj/mm/aaaa hh:mm ")
return False, " La date de publication n'est pas au format jj/mm/aaaa hh:mm"
"""
Verifier que l'evaluation est valide
"""
@ -2418,12 +2603,21 @@ def Publish_Unpublish_Participant_Evaluation_Note(diction):
new_data['publish'] = str(diction['publish_status'])
if( str(diction['publish_status']) == "1"):
new_data['publish_date'] = str(datetime.now())
new_data['publish_by'] = str(my_partner['_id'])
if( "action_date_time" in diction.keys() and diction['action_date_time']):
new_data['publish_date'] = str(diction['action_date_time']).strip()[0:16]
else:
new_data['publish_date'] = str(datetime.now().strftime("%d/%m/%Y %H:%M"))
if (str(diction['publish_status']) == "0"):
new_data['unpublish_date'] = str(datetime.now())
elif (str(diction['publish_status']) == "0"):
new_data['unpublish_by'] = str(my_partner['_id'])
if ("action_date_time" in diction.keys() and diction['action_date_time']):
new_data['unpublish_date'] = diction['action_date_time']
else:
new_data['unpublish_date'] = str(datetime.now().strftime("%d/%m/%Y %H:%M"))
# Suppression des inscription
if( len(tab_id_to_update) > 0 and tab_id_to_update[0]):
@ -2563,7 +2757,7 @@ def Valide_Participant_Evaluation_Note(diction):
new_data['update_date'] = str(datetime.now())
new_data['update_by'] = str(my_partner['_id'])
new_data['is_validated'] = "1"
new_data['is_validated_date'] = str(datetime.now())
new_data['is_validated_date'] = str(datetime.now().strftime("%d/%m/%Y %H:%M"))
new_data['is_validated_by'] = str(my_partner['_id'])
# Suppression des inscription
@ -2587,7 +2781,7 @@ def Valide_Participant_Evaluation_Note(diction):
history_event_dict['token'] = str(token)
history_event_dict['related_collection'] = "note_evaluation"
history_event_dict['related_collection_recid'] = str(diction['evaluation_id'])
history_event_dict['action_date'] = str(now)
history_event_dict['action_date'] = str(datetime.now().strftime("%d/%m/%Y %H:%M"))
history_event_dict['action_description'] = "Validation des notees"
@ -2708,6 +2902,8 @@ def Get_List_Participant_To_Evaluation(diction):
elif ("publish" in retval.keys() and retval['publish'] != "1"):
user['publish'] = False
if ("is_validated" not in retval.keys()):
user['is_validated'] = False
@ -2729,6 +2925,12 @@ def Get_List_Participant_To_Evaluation(diction):
user['convocation_send_type'] = ""
has_history = "0"
if('note_history_change' in user.keys() ):
has_history = str(len(user["note_history_change"]))
user['has_history'] = str(has_history)
nb_val = nb_val + 1
RetObject.append(mycommon.JSONEncoder().encode(user))
@ -2975,6 +3177,87 @@ def Get_List_Participant_Notes(diction):
return False, "Impossible de récupérer les notes de l'apprenant"
"""
Cette fonction permet récuprer l'historique des modification d'une ligne de note
"""
def Get_Given_Participant_Notes_Change_History(diction):
try:
diction = mycommon.strip_dictionary(diction)
"""
Verification des input acceptés
"""
field_list = ['token', 'note_evaluation_participant_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', 'note_evaluation_participant_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
tab_session_id = ""
if ("tab_session_id" in diction.keys()):
if diction['tab_session_id']:
tab_session_id = diction['tab_session_id']
"""
Verification de la validité de ''note_evaluation_participant_id'
"""
is_note_evaluation_participant_id_valide = MYSY_GV.dbname['note_evaluation_participant'].count_documents({'_id':ObjectId(str(diction['note_evaluation_participant_id'])),
'partner_owner_recid':str(my_partner['recid'])})
if( is_note_evaluation_participant_id_valide != 1):
mycommon.myprint(str(inspect.stack()[0][3]) + " La ligne de note est invalide ")
return False, " La ligne de note est invalide "
RetObject = []
val_tmp = 0
for retval in MYSY_GV.dbname['note_evaluation_participant'].find({'_id':ObjectId(str(diction['note_evaluation_participant_id'])),
'partner_owner_recid':str(my_partner['recid'])}):
if( "note_history_change" in retval.keys()):
user = retval['note_history_change']
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) + " - ERRORRRR AT Line : " + str(exc_tb.tb_lineno))
return False, "Impossible de récuperer l'historique de la note"
"""
Exporter les notes de l'apprenant dans un doc excel
"""
@ -4490,6 +4773,9 @@ def Import_Evaluation_Notes_mass(file=None, Folder=None, diction=None):
local_diction['evaluation_id'] = str(diction['evaluation_id'])
local_diction['tab_participant_note'] = str(tab_participant_note)
local_history_note_changed = {}
local_history_note_changed['par'] = str(my_partner)
status, retval = Update_Participant_Evaluation_Note(local_diction)

View File

@ -524,7 +524,7 @@ def Add_Class_UE_Evaluation(diction):
Verification des input acceptés
"""
field_list = ['token', 'class_id', 'class_ue_id', 'type_evaluation_id', 'max_note', 'ponderation_type_eval',
'type_notation' ]
'type_notation', 'diplome_id']
incom_keys = diction.keys()
for val in incom_keys:
@ -558,6 +558,16 @@ def Add_Class_UE_Evaluation(diction):
return local_status, my_partner
if("diplome_id" in diction.keys() and diction['diplome_id']):
is_valide_diplome = MYSY_GV.dbname['diplome'].count_documents({'_id':ObjectId(str(diction['diplome_id'])),
'partner_owner_recid': my_partner['recid'],
})
if (is_valide_diplome != 1):
mycommon.myprint(
str(inspect.stack()[0][3]) + " L'identifiant du diplome est invalide ")
return False, " L'identifiant du diplome est invalide "
if( "type_notation" in diction.keys() and diction['type_notation'] not in ['num', 'alpha']):
mycommon.myprint(
str(inspect.stack()[0][
@ -579,6 +589,16 @@ def Add_Class_UE_Evaluation(diction):
str(inspect.stack()[0][3]) + " L'unité d'enseignement n'existe pas dans la formation ")
return False, " L'unité d'enseignement n'existe pas dans la formation "
ue_id_existe_class_data = MYSY_GV.dbname['myclass'].find_one({'_id': ObjectId(str(diction['class_id'])),
'list_unite_enseignement._id': str(diction['class_ue_id']),
'partner_owner_recid': my_partner['recid'],
'valide': '1',
'locked': '0'}, {'list_unite_enseignement':1})
print(" ue_id_existe_class_data['list_unite_enseignement'] = ", ue_id_existe_class_data['list_unite_enseignement'])
"""
Verifier que le type d'évaluation existe
@ -642,7 +662,7 @@ def Update_Class_UE_Evaluation(diction):
Verification des input acceptés
"""
field_list = ['token', 'max_note', 'class_ue_evaluation_id', 'ponderation_type_eval',
'type_notation']
'type_notation', 'diplome_id']
incom_keys = diction.keys()
for val in incom_keys:
@ -675,6 +695,16 @@ def Update_Class_UE_Evaluation(diction):
if (local_status is not True):
return local_status, my_partner
if ("diplome_id" in diction.keys() and diction['diplome_id']):
is_valide_diplome = MYSY_GV.dbname['diplome'].count_documents({'_id': ObjectId(str(diction['diplome_id'])),
'partner_owner_recid': my_partner['recid'],
})
if (is_valide_diplome != 1):
mycommon.myprint(
str(inspect.stack()[0][3]) + " L'identifiant du diplome est invalide ")
return False, " L'identifiant du diplome est invalide "
if ("type_notation" in diction.keys() and diction['type_notation'] not in ['num', 'alpha']):
mycommon.myprint(
str(inspect.stack()[0][
@ -847,6 +877,21 @@ def Get_List_Class_Evaluation(diction):
if ("max_note" not in user.keys()):
user['max_note'] = "20"
diplome_id = ""
diplome_code = ""
if ("diplome_id" in user.keys() and user['diplome_id']):
diplome_data = MYSY_GV.dbname['diplome'].find_one(
{'_id': ObjectId(str(user['diplome_id'])),
'partner_owner_recid': my_partner['recid'],
})
if( diplome_data ):
diplome_id = str(user['diplome_id'])
diplome_code = str(diplome_data['code'])
user['diplome_id'] = diplome_id
user['diplome_code'] = diplome_code
val_tmp = val_tmp + 1

View File

@ -556,6 +556,8 @@ def Invoice_Partner_Order(diction):
"""
Ajout l'action dans l'historique
"""

View File

@ -855,6 +855,8 @@ def tryFloat(val):
try:
val = str(val).replace(",",".")
myfloat = float(val)
myfloat = int(myfloat) if myfloat == int(myfloat) else myfloat
return myfloat
except ValueError:
return 0

View File

@ -934,6 +934,24 @@ def Get_List_Unite_Enseignement_Of_Given_Class(diction):
user['competence_code'] = str(competence_code)
diplome_id = ""
diplome_code = ""
if( "diplome_id" in user.keys() and user['diplome_id']):
diplome_id_data = MYSY_GV.dbname['diplome'].find_one(
{'_id': ObjectId(str(user['diplome_id'])),
'valide': '1',
'locked': '0',
'partner_owner_recid': str(
my_partner['recid'])})
if (diplome_id_data and "code" in diplome_id_data.keys()):
diplome_code = str(diplome_id_data['code'])
diplome_id = str(user['diplome_id'])
user['diplome_id'] = str(diplome_id)
user['diplome_code'] = str(diplome_code)
RetObject.append(mycommon.JSONEncoder().encode(user))
@ -1110,7 +1128,22 @@ def Get_List_Unite_Enseignement_Of_Given_Class_From_Session_Id(diction):
user['competence_id'] = str(competence_id)
user['competence_code'] = str(competence_code)
diplome_id = ""
diplome_code = ""
if ("diplome_id" in user.keys() and user['diplome_id']):
diplome_id_data = MYSY_GV.dbname['diplome'].find_one(
{'_id': ObjectId(str(user['diplome_id'])),
'valide': '1',
'locked': '0',
'partner_owner_recid': str(
my_partner['recid'])})
if (diplome_id_data and "code" in diplome_id_data.keys()):
diplome_code = str(diplome_id_data['code'])
diplome_id = str(user['diplome_id'])
user['diplome_id'] = str(diplome_id)
user['diplome_code'] = str(diplome_code)
RetObject.append(mycommon.JSONEncoder().encode(user))
@ -1143,7 +1176,7 @@ def Get_List_Unite_Enseignement_Of_Given_Session_Id(diction):
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"
return False, " Les informations fournies sont incorrectes", False
"""
Verification des champs obligatoires
@ -1154,7 +1187,7 @@ def Get_List_Unite_Enseignement_Of_Given_Session_Id(diction):
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"
return False, " Les informations fournies sont incorrectes", False
"""
Verification de l'identité et autorisation de l'entité qui
@ -1167,12 +1200,12 @@ def Get_List_Unite_Enseignement_Of_Given_Session_Id(diction):
local_status, my_partner = mycommon.Check_Connexion_And_Return_Partner_Data(diction)
if (local_status is not True):
return local_status, my_partner
return local_status, my_partner, False
RetObject = []
val_tmp = 0
RetObject_tab_diplome = []
#print(" #### Get_List_Unite_Enseignement_Of_Given_Class qry = ", qry)
@ -1195,16 +1228,41 @@ def Get_List_Unite_Enseignement_Of_Given_Session_Id(diction):
user['id'] = str(val_tmp)
val_tmp = val_tmp + 1
# Gestion des diplomes
diplome_id = ""
diplome_code = ""
if ("diplome_id" in local_val.keys() and local_val['diplome_id']):
local_diplome_id = local_val['diplome_id']
local_diplome_data = MYSY_GV.dbname['diplome'].find_one(
{'_id': ObjectId(local_val['diplome_id']),
'partner_owner_recid': str(my_partner['recid'])})
if (local_diplome_data and "code" in local_diplome_data.keys()):
diplome_id = local_val['diplome_id']
diplome_code = local_diplome_data['code']
diplome_node = {}
diplome_node['_id'] = local_val['diplome_id']
diplome_node['code'] = local_diplome_data['code']
RetObject_tab_diplome.append(mycommon.JSONEncoder().encode(diplome_node))
user['diplome_id'] = str(diplome_id)
user['diplome_code'] = str(diplome_code)
RetObject.append(mycommon.JSONEncoder().encode(user))
#print(" #### RetObject = ", RetObject)
return True, RetObject
return True, RetObject, RetObject_tab_diplome
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 unites d'enseignement de la promotion "
return False, " Impossible de récupérer la liste des unites d'enseignement de la promotion ", False