27/05/2026 - 18h00

Signed-off-by: Cherif <cbalde@mysy-training.com>
master_Elyos_FI
Cherif 2026-05-27 21:46:11 +02:00
parent 08cb1422d4
commit 674a113901
3 changed files with 1915 additions and 144 deletions

View File

@ -4,11 +4,10 @@
<option name="autoReloadType" value="SELECTIVE" />
</component>
<component name="ChangeListManager">
<list default="true" id="c6d0259a-16e1-410d-91a1-830590ee2a08" name="Changes" comment="24/05/2026 - 18h00">
<list default="true" id="c6d0259a-16e1-410d-91a1-830590ee2a08" name="Changes" comment="26/05/2026 - 18h00">
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" 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$/base_class_calcul_note.py" beforeDir="false" afterPath="$PROJECT_DIR$/base_class_calcul_note.py" afterDir="false" />
<change beforePath="$PROJECT_DIR$/main.py" beforeDir="false" afterPath="$PROJECT_DIR$/main.py" afterDir="false" />
</list>
<option name="SHOW_DIALOG" value="false" />
<option name="HIGHLIGHT_CONFLICTS" value="true" />
@ -452,7 +451,7 @@
<option name="project" value="LOCAL" />
<updated>1747251650255</updated>
</task>
<option name="localTasksCounter" value="589" />
<option name="localTasksCounter" value="590" />
<servers />
</component>
<component name="Vcs.Log.Tabs.Properties">
@ -494,7 +493,6 @@
</option>
</component>
<component name="VcsManagerConfiguration">
<MESSAGE value="21/04/2026 - 11h30" />
<MESSAGE value="21/04/2026 - 21h30" />
<MESSAGE value="24/04/26 - 19h" />
<MESSAGE value="26/04/26 - 19h" />
@ -519,6 +517,7 @@
<MESSAGE value="22/05/2026 - 20h" />
<MESSAGE value="23/05/2026 - 20h00" />
<MESSAGE value="24/05/2026 - 18h00" />
<option name="LAST_COMMIT_MESSAGE" value="24/05/2026 - 18h00" />
<MESSAGE value="26/05/2026 - 18h00" />
<option name="LAST_COMMIT_MESSAGE" value="26/05/2026 - 18h00" />
</component>
</project>

File diff suppressed because it is too large Load Diff

View File

@ -3808,6 +3808,13 @@ def Create_work_evaluation_participant_note(diction):
24/05/2026 -
Fonction de calcul des moyennes en logique : Bloc Compétence / UE
Avec des filtre sur la formation, le rattrapge
Important :
Quand les notes 'session_formation.list_unite_enseignement' est calculé,
on peut lui mettre la valeur "archived" à "1", verrouiller les calcul déja faits.
ainsi, on ira toujours traiter les lignes dans 'archived' est different 1
"""
@ -3830,7 +3837,7 @@ def Calcul_Moyen_evaluation_participant_note_BC_UE(diction):
"""
Verification des champs obligatoires
"""
field_list_obligatoire = ['token', 'session_id', ]
field_list_obligatoire = ['token', 'session_id', 'semestre', 'diplome_id', 'domaine_competence_id',]
for val in field_list_obligatoire:
if val not in diction:
mycommon.myprint(
@ -3899,9 +3906,61 @@ def Calcul_Moyen_evaluation_participant_note_BC_UE(diction):
# On recupere la liste des ue_id de la promotion
tab_ue_id = []
tab_ue_id_with_compet_diplome = []
pipeline = [
{
"$match": {
"_id": ObjectId(str(diction['session_id'])),
"partner_owner_recid": "43598820dd270936c3d2fd822717d0f18f194b1a1b894aaf89",
"valide": "1"
}
},
{
"$project": {
"_id": 0,
"list_unite_enseignement": {
"$filter": {
"input": "$list_unite_enseignement",
"as": "ue",
"cond": {
"$and": [
{
"$eq": [
"$$ue.semestre",
str(diction['semestre'])
]
},
{
"$eq": [
"$$ue.diplome_id",
str(diction['diplome_id'])
]
},
{
"$eq": [
"$$ue.domaine_competence_id",
str(diction['domaine_competence_id'])
]
},
{"$ne": ["$$ue.archived", "1"]}
]
}
}
}
}
}
]
session_list_ue = {}
for tmp in MYSY_GV.dbname["session_formation"].aggregate(pipeline):
if( "list_unite_enseignement" in tmp.keys() ):
session_list_ue = tmp["list_unite_enseignement"]
if ("semestre" in diction.keys() and diction['semestre']):
for class_class_ue_data in is_session_valide_data['list_unite_enseignement'] :
for class_class_ue_data in session_list_ue :
if( "semestre" in class_class_ue_data.keys() and class_class_ue_data['semestre'] == str(diction['semestre'])):
local_node = {}
local_node['ue_id'] = class_class_ue_data['_id']
@ -3913,7 +3972,7 @@ def Calcul_Moyen_evaluation_participant_note_BC_UE(diction):
tab_ue_id.append( str(class_class_ue_data['_id']))
else:
for class_class_ue_data in is_session_valide_data['list_unite_enseignement']:
for class_class_ue_data in session_list_ue:
local_node = {}
local_node['ue_id'] = class_class_ue_data['_id']
local_node['domaine_competence_id'] = class_class_ue_data['domaine_competence_id']
@ -3924,7 +3983,7 @@ def Calcul_Moyen_evaluation_participant_note_BC_UE(diction):
tab_ue_id.append(str(class_class_ue_data['_id']))
print(" ### ooooo zz tab_ue_id_with_compet_diplome = ", tab_ue_id_with_compet_diplome)
#print(" ### ooooo zz tab_ue_id_with_compet_diplome = ", tab_ue_id_with_compet_diplome)
"""
Etape 2 : On va aller chercher toutes lignes concernées par : tab_ue_id_with_compet_diplome
@ -3946,176 +4005,240 @@ def Calcul_Moyen_evaluation_participant_note_BC_UE(diction):
pour calculer les moyennes par UE
"""
for inscrit_id in tab_inscrit_id:
"""
Aller chercher la liste des note concernées par :
- ce type d'evaluation (ex : les td, tp, exam)
- ce diplome
- ce bloc de compétence
- pour chaque inscrit, calculer la moyenne : tab_inscrit_id.append(str(inscrit['_id']))
"""
if( inscrit_id in ['69d0bdcbb4469130284c79a8', '69d38f85b4469130284c79bc'] ):
"""
Aller chercher la liste des note concernées par :
- ce type d'evaluation (ex : les td, tp, exam)
- ce diplome
- ce bloc de compétence
- pour chaque inscrit, calculer la moyenne : tab_inscrit_id.append(str(inscrit['_id']))
"""
print(" ## inscrit_id = ", inscrit_id)
inscrit_data = MYSY_GV.dbname['inscription'].find_one({'valide': '1', 'status': '1',
'partner_owner_recid': str(my_partner['recid']),
'_id': ObjectId(inscrit_id)}, {'_id':1, 'nom':1, 'email':1, 'prenom':1})
print(" ## inscrit_id = ", inscrit_id)
inscrit_data = MYSY_GV.dbname['inscription'].find_one({'valide': '1', 'status': '1',
'partner_owner_recid': str(my_partner['recid']),
'_id': ObjectId(inscrit_id)}, {'_id':1, 'nom':1, 'email':1, 'prenom':1})
print(" ======================================================== ")
print(" ## INSCRIT = ", str(inscrit_data['nom']), str(inscrit_data['prenom']), str(inscrit_data['email']) )
print(" ======================================================== ")
print(" ## INSCRIT = ", str(inscrit_data['nom']), str(inscrit_data['prenom']), str(inscrit_data['email']) )
for ue_id_with_compet_diplome in tab_ue_id_with_compet_diplome:
for ue_id_with_compet_diplome in tab_ue_id_with_compet_diplome:
#print(" ## POUR SESSION _ UE _ DIPLOME _ BC = ", ue_id_with_compet_diplome)
ue_id_code = ""
if("ue_id" in ue_id_with_compet_diplome.keys() and ue_id_with_compet_diplome['ue_id']):
ue_id_data = MYSY_GV.dbname['unite_enseignement'].find_one({'_id':ObjectId(str(ue_id_with_compet_diplome['ue_id'])),
'partner_owner_recid':str(my_partner['recid']),}, {'code':1})
#print(" ## POUR SESSION _ UE _ DIPLOME _ BC = ", ue_id_with_compet_diplome)
ue_id_code = ""
local_eu_id = ""
if("ue_id" in ue_id_with_compet_diplome.keys() and ue_id_with_compet_diplome['ue_id']):
ue_id_data = MYSY_GV.dbname['unite_enseignement'].find_one({'_id':ObjectId(str(ue_id_with_compet_diplome['ue_id'])),
'partner_owner_recid':str(my_partner['recid']),}, {'code':1})
if( ue_id_data and 'code' in ue_id_data.keys()):
ue_id_code = ue_id_data['code']
if( ue_id_data and 'code' in ue_id_data.keys()):
ue_id_code = ue_id_data['code']
local_eu_id = str(ue_id_data['_id'])
domaine_competence_id_code = ""
if ("domaine_competence_id" in ue_id_with_compet_diplome.keys() and ue_id_with_compet_diplome['domaine_competence_id']):
domaine_competence_id_data = MYSY_GV.dbname['domaine_competence_pedagogique'].find_one(
{'_id': ObjectId(str(ue_id_with_compet_diplome['domaine_competence_id'])),
'partner_owner_recid': str(my_partner['recid']), }, {'code': 1})
domaine_competence_id_code = ""
local_domaine_competence_id = ""
if ("domaine_competence_id" in ue_id_with_compet_diplome.keys() and ue_id_with_compet_diplome['domaine_competence_id']):
domaine_competence_id_data = MYSY_GV.dbname['domaine_competence_pedagogique'].find_one(
{'_id': ObjectId(str(ue_id_with_compet_diplome['domaine_competence_id'])),
'partner_owner_recid': str(my_partner['recid']), }, {'code': 1})
if (domaine_competence_id_data and 'code' in domaine_competence_id_data.keys()):
domaine_competence_id_code = domaine_competence_id_data['code']
if (domaine_competence_id_data and 'code' in domaine_competence_id_data.keys()):
domaine_competence_id_code = domaine_competence_id_data['code']
local_domaine_competence_id = str(domaine_competence_id_data['_id'])
diplome_id_code = ""
if ("diplome_id" in ue_id_with_compet_diplome.keys() and ue_id_with_compet_diplome[
'diplome_id']):
diplome_id_data = MYSY_GV.dbname['diplome'].find_one(
{'_id': ObjectId(str(ue_id_with_compet_diplome['diplome_id'])),
'partner_owner_recid': str(my_partner['recid']), }, {'code': 1})
if (diplome_id_data and 'code' in diplome_id_data.keys()):
diplome_id_code = diplome_id_data['code']
diplome_id_code = ""
local_diplome_id = ""
if ("diplome_id" in ue_id_with_compet_diplome.keys() and ue_id_with_compet_diplome[
'diplome_id']):
diplome_id_data = MYSY_GV.dbname['diplome'].find_one(
{'_id': ObjectId(str(ue_id_with_compet_diplome['diplome_id'])),
'partner_owner_recid': str(my_partner['recid']), }, {'code': 1})
print(" ## POUR SESSION _ UE _ DIPLOME _ BC = ", str(ue_id_code), " / ", str(diplome_id_code), " / ", str(domaine_competence_id_code), " / ", str(ue_id_with_compet_diplome['semestre']))
if (diplome_id_data and 'code' in diplome_id_data.keys()):
diplome_id_code = diplome_id_data['code']
local_diplome_id = str(diplome_id_data['_id'])
somme_ue = 0
ponderation_ue = 0
moyenne_ue = 0
somme_ue_ponderation = 0
for class_type_evaluation_with_ponderation in MYSY_GV.dbname['class_unite_enseignement_type_evaluation'].find({'class_id':str(is_session_valide_data['class_id']),
'partner_owner_recid':str(my_partner['recid']),
'valide':'1',
'locked':'0',
'diplome_id':str(ue_id_with_compet_diplome['diplome_id']),
'domaine_competence_id': str(
ue_id_with_compet_diplome[
'domaine_competence_id']),
}):
pipeline = [
{
"$match": {
"_id": ObjectId(str(is_session_valide_data['class_id'])),
"partner_owner_recid": str(my_partner['recid']),
"valide": "1"
}
},
{
"$project": {
"_id": 0,
"list_unite_enseignement": {
"$filter": {
"input": "$list_unite_enseignement",
"as": "ue",
"cond": {
"$and": [
{
"$eq": [
"$$ue.domaine_competence_id",
str(local_domaine_competence_id)
]
},
{
"$eq": [
"$$ue.diplome_id",
str(local_diplome_id)
]
},
{
"$eq": [
"$$ue._id",
str(local_eu_id)
]
},
]
}
}
}
}
}
]
class_ue_coefficient = 1
for class_list_ue in MYSY_GV.dbname["myclass"].aggregate(pipeline) :
if( "coefficient" in class_list_ue['list_unite_enseignement'][0].keys() and class_list_ue['list_unite_enseignement'][0]['coefficient']):
class_ue_coefficient = mycommon.tryFloat(class_list_ue['list_unite_enseignement'][0]['coefficient'])
#print(" les note class evaluation = ", class_type_evaluation_with_ponderation)
ue_ponderation = "0"
print(" ## POUR SESSION _ UE _ DIPLOME _ BC _ COEFF = ", str(ue_id_code), " / ", str(diplome_id_code), " / ", str(domaine_competence_id_code), " / ", str(ue_id_with_compet_diplome['semestre']), " / "+str(class_ue_coefficient))
if( "ponderation_type_eval" in class_type_evaluation_with_ponderation.keys() and class_type_evaluation_with_ponderation['ponderation_type_eval']):
ue_ponderation = class_type_evaluation_with_ponderation['ponderation_type_eval']
else:
mycommon.myprint(
str(inspect.stack()[0][
3]) + " La pondération du type d'évaluation "+str(ue_id_with_compet_diplome)+" est invalide ")
return False, " La pondération du type d'évaluation "+str(ue_id_with_compet_diplome)+" est invalide "
somme_ue = 0
ponderation_ue = 0
moyenne_ue = 0
somme_ue_ponderation = 0
for class_type_evaluation_with_ponderation in MYSY_GV.dbname['class_unite_enseignement_type_evaluation'].find({'class_id':str(is_session_valide_data['class_id']),
'partner_owner_recid':str(my_partner['recid']),
'valide':'1',
'locked':'0',
'diplome_id':str(ue_id_with_compet_diplome['diplome_id']),
'domaine_competence_id': str(
ue_id_with_compet_diplome[
'domaine_competence_id']),
}):
if( "type_evaluation_id" in class_type_evaluation_with_ponderation.keys() and class_type_evaluation_with_ponderation['type_evaluation_id']):
#print(" les note class evaluation = ", class_type_evaluation_with_ponderation)
ue_ponderation = "0"
type_evaluation_id_data = MYSY_GV.dbname['type_evaluation'].find_one({'_id':ObjectId(str(class_type_evaluation_with_ponderation['type_evaluation_id'])),
'partner_owner_recid':str(my_partner['recid'])}, {'code'})
qry_select_note = {}
qry_select_note['class_eu_id'] = ue_id_with_compet_diplome['ue_id']
qry_select_note['tab_diplome_ids'] = ue_id_with_compet_diplome['diplome_id']
qry_select_note['domaine_competence_id'] = ue_id_with_compet_diplome['domaine_competence_id']
qry_select_note['type_eval_id'] = str(class_type_evaluation_with_ponderation['type_evaluation_id'])
qry_select_note['inscription_id'] = str(inscrit_id)
qry_select_note['code_action'] = str(code_action)
new_query_note = {'$and': [
qry_select_note, filt_diplome_id, filt_domaine_competence_id]}
#print(" new_query_note0002 = ", new_query_note)
existe_ligne_node = MYSY_GV.dbname['work_evaluation_participant_note'].count_documents(new_query_note)
somme = 0
moyenne = 0
cpt = 0
if( existe_ligne_node > 0 ):
print(" FOR INSCRIT ID = ", str(inscrit_id), " TYPE EVALUATION = ", str(type_evaluation_id_data['code']).upper(), " PONDERATION TYPE EVAL = ", str(ue_ponderation), " EVALUATION ID = ", str(type_evaluation_id_data['_id']))
for notes in MYSY_GV.dbname['work_evaluation_participant_note'].find(new_query_note):
print("\t {{002 Type : "+str(type_evaluation_id_data['code']).upper()+" : Note = "+str( notes['note'])+" //// ligne de notes = ", notes)
if("note" in notes.keys() and notes['note']):
note_float = mycommon.tryFloat(notes['note'])
somme = somme + note_float
cpt = cpt + 1
if( cpt > 0 ):
moyenne = mycommon.tryFloat(round(somme/cpt, 2))*mycommon.tryFloat(ue_ponderation)
print(" Fin calcul note UE : Moyenne = ", str(moyenne), " Pondération = ", str(ue_ponderation))
if( "ponderation_type_eval" in class_type_evaluation_with_ponderation.keys() and class_type_evaluation_with_ponderation['ponderation_type_eval']):
ue_ponderation = class_type_evaluation_with_ponderation['ponderation_type_eval']
else:
mycommon.myprint(
str(inspect.stack()[0][
3]) + " La pondération du type d'évaluation "+str(ue_id_with_compet_diplome)+" est invalide ")
return False, " La pondération du type d'évaluation "+str(ue_id_with_compet_diplome)+" est invalide "
somme_ue = somme_ue + moyenne
ponderation_ue = ponderation_ue + mycommon.tryFloat(ue_ponderation)
if( "type_evaluation_id" in class_type_evaluation_with_ponderation.keys() and class_type_evaluation_with_ponderation['type_evaluation_id']):
somme_ue_ponderation = somme_ue_ponderation + mycommon.tryFloat(ue_ponderation)
type_evaluation_id_data = MYSY_GV.dbname['type_evaluation'].find_one({'_id':ObjectId(str(class_type_evaluation_with_ponderation['type_evaluation_id'])),
'partner_owner_recid':str(my_partner['recid'])}, {'code'})
print(" ### pour cette UE somme_ue = ", str(somme_ue), " total ponderation = ", str(ponderation_ue), " - somme_ue_ponderation = ", somme_ue_ponderation)
if (somme_ue_ponderation > 0):
moyenne_ue = mycommon.tryFloat(round(somme_ue / ponderation_ue, 2))
qry_select_note = {}
qry_select_note['class_eu_id'] = ue_id_with_compet_diplome['ue_id']
qry_select_note['tab_diplome_ids'] = ue_id_with_compet_diplome['diplome_id']
qry_select_note['domaine_competence_id'] = ue_id_with_compet_diplome['domaine_competence_id']
qry_select_note['type_eval_id'] = str(class_type_evaluation_with_ponderation['type_evaluation_id'])
qry_select_note['inscription_id'] = str(inscrit_id)
qry_select_note['code_action'] = str(code_action)
print(" Fin calcul note UE : Moyenne_UE = ", str(moyenne_ue), " Pondération TOTAL UE = ", str(somme_ue_ponderation))
new_query_note = {'$and': [
qry_select_note, filt_diplome_id, filt_domaine_competence_id]}
local_node_moyenne_par_promo_diplome_bc_ue_semestre = {}
#print(" new_query_note0002 = ", new_query_note)
existe_ligne_node = MYSY_GV.dbname['work_evaluation_participant_note'].count_documents(new_query_note)
local_node_moyenne_par_promo_diplome_bc_ue_semestre['inscrit_id'] = str(inscrit_data['_id'])
local_node_moyenne_par_promo_diplome_bc_ue_semestre['inscrit_nom'] = inscrit_data['nom']
local_node_moyenne_par_promo_diplome_bc_ue_semestre['inscrit_prenom'] = inscrit_data['prenom']
local_node_moyenne_par_promo_diplome_bc_ue_semestre['inscrit_email'] = inscrit_data['email']
somme = 0
moyenne = 0
cpt = 0
local_node_moyenne_par_promo_diplome_bc_ue_semestre['session_id'] = diction['session_id']
local_node_moyenne_par_promo_diplome_bc_ue_semestre['diplome_id'] = ue_id_with_compet_diplome['diplome_id']
local_node_moyenne_par_promo_diplome_bc_ue_semestre['diplome_id_code'] = str(diplome_id_code)
if( existe_ligne_node > 0 ):
print("\t FOR INSCRIT ID = ", str(inscrit_id), " TYPE EVALUATION = ", str(type_evaluation_id_data['code']).upper(), " PONDERATION TYPE EVAL = ", str(ue_ponderation), " EVALUATION ID = ", str(type_evaluation_id_data['_id']))
for notes in MYSY_GV.dbname['work_evaluation_participant_note'].find(new_query_note):
print("\t\t {{002 Type : "+str(type_evaluation_id_data['code']).upper()+" : Note = "+str( notes['note'])+" //// ligne de notes = ", notes)
if("note" in notes.keys() and notes['note']):
note_float = mycommon.tryFloat(notes['note'])
somme = somme + note_float
cpt = cpt + 1
local_node_moyenne_par_promo_diplome_bc_ue_semestre['domaine_competence_id'] = ue_id_with_compet_diplome['domaine_competence_id']
local_node_moyenne_par_promo_diplome_bc_ue_semestre['domaine_competence_id_code'] = str(domaine_competence_id_code)
local_node_moyenne_par_promo_diplome_bc_ue_semestre['semestre'] = ue_id_with_compet_diplome['semestre']
if( cpt > 0 ):
moyenne = mycommon.tryFloat(round(somme/cpt, 2))*mycommon.tryFloat(ue_ponderation)
local_node_moyenne_par_promo_diplome_bc_ue_semestre['ue_id'] = ue_id_with_compet_diplome['ue_id']
local_node_moyenne_par_promo_diplome_bc_ue_semestre['ue_id_code'] = str(ue_id_code)
print(" \t Note UE : ", str(moyenne), " Avec Pondération = ", str(ue_ponderation))
local_node_moyenne_par_promo_diplome_bc_ue_semestre['somme_note'] = str(mycommon.tryFloat(round(somme_ue, 2)))
local_node_moyenne_par_promo_diplome_bc_ue_semestre['total_ponderation'] =str(somme_ue_ponderation)
local_node_moyenne_par_promo_diplome_bc_ue_semestre['moyenne'] = str(moyenne_ue)
local_node_moyenne_par_promo_diplome_bc_ue_semestre['create_date'] = str(datetime.now())
local_node_moyenne_par_promo_diplome_bc_ue_semestre['creation_by'] = str(my_partner['_id'])
local_node_moyenne_par_promo_diplome_bc_ue_semestre['partner_owner_recid'] = str(my_partner['recid'])
data_key = {}
data_key['inscrit_id'] = str(inscrit_data['_id'])
data_key['session_id'] = diction['session_id']
data_key['diplome_id'] = ue_id_with_compet_diplome[ 'diplome_id']
data_key['domaine_competence_id'] = ue_id_with_compet_diplome['domaine_competence_id']
data_key['semestre'] = ue_id_with_compet_diplome['semestre']
data_key['ue_id'] = ue_id_with_compet_diplome['ue_id']
data_key['partner_owner_recid'] = str(my_partner['recid'])
result = MYSY_GV.dbname['work_calcul_moyenne_by_ue_bc_diplome_session_semestre'].find_one_and_update(
data_key,
{"$set": local_node_moyenne_par_promo_diplome_bc_ue_semestre},
upsert=True,
return_document=ReturnDocument.AFTER
)
somme_ue = somme_ue + moyenne
ponderation_ue = ponderation_ue + mycommon.tryFloat(ue_ponderation)
somme_ue_ponderation = somme_ue_ponderation + mycommon.tryFloat(ue_ponderation)
print(" ### pour cette UE somme_ue = ", str(somme_ue), " class_ue_coefficient = ", str(class_ue_coefficient), " Pondération = ", str(somme_ue_ponderation))
moyenne_avant_coef = 0
if (somme_ue_ponderation > 0):
moyenne_ue = mycommon.tryFloat(round( (somme_ue / somme_ue_ponderation)*class_ue_coefficient, 2))
moyenne_avant_coef = mycommon.tryFloat(round((somme_ue / somme_ue_ponderation), 2))
print(" Fin calcul note UE : Moyenne_UE = ", str(moyenne_ue))
local_node_moyenne_par_promo_diplome_bc_ue_semestre = {}
local_node_moyenne_par_promo_diplome_bc_ue_semestre['inscrit_id'] = str(inscrit_data['_id'])
local_node_moyenne_par_promo_diplome_bc_ue_semestre['inscrit_nom'] = inscrit_data['nom']
local_node_moyenne_par_promo_diplome_bc_ue_semestre['inscrit_prenom'] = inscrit_data['prenom']
local_node_moyenne_par_promo_diplome_bc_ue_semestre['inscrit_email'] = inscrit_data['email']
local_node_moyenne_par_promo_diplome_bc_ue_semestre['session_id'] = diction['session_id']
local_node_moyenne_par_promo_diplome_bc_ue_semestre['diplome_id'] = ue_id_with_compet_diplome['diplome_id']
local_node_moyenne_par_promo_diplome_bc_ue_semestre['diplome_id_code'] = str(diplome_id_code)
local_node_moyenne_par_promo_diplome_bc_ue_semestre['domaine_competence_id'] = ue_id_with_compet_diplome['domaine_competence_id']
local_node_moyenne_par_promo_diplome_bc_ue_semestre['domaine_competence_id_code'] = str(domaine_competence_id_code)
local_node_moyenne_par_promo_diplome_bc_ue_semestre['semestre'] = ue_id_with_compet_diplome['semestre']
local_node_moyenne_par_promo_diplome_bc_ue_semestre['ue_id'] = ue_id_with_compet_diplome['ue_id']
local_node_moyenne_par_promo_diplome_bc_ue_semestre['ue_id_code'] = str(ue_id_code)
local_node_moyenne_par_promo_diplome_bc_ue_semestre['moyenne_avant_coef'] = str(moyenne_avant_coef)
local_node_moyenne_par_promo_diplome_bc_ue_semestre['coef'] = str(class_ue_coefficient)
local_node_moyenne_par_promo_diplome_bc_ue_semestre['moyenne_apres_coef'] = str(moyenne_ue)
local_node_moyenne_par_promo_diplome_bc_ue_semestre['total_ponderation'] =str(somme_ue_ponderation)
local_node_moyenne_par_promo_diplome_bc_ue_semestre['moyenne'] = str(moyenne_ue)
local_node_moyenne_par_promo_diplome_bc_ue_semestre['create_date'] = str(datetime.now())
local_node_moyenne_par_promo_diplome_bc_ue_semestre['creation_by'] = str(my_partner['_id'])
local_node_moyenne_par_promo_diplome_bc_ue_semestre['partner_owner_recid'] = str(my_partner['recid'])
data_key = {}
data_key['inscrit_id'] = str(inscrit_data['_id'])
data_key['session_id'] = diction['session_id']
data_key['diplome_id'] = ue_id_with_compet_diplome[ 'diplome_id']
data_key['domaine_competence_id'] = ue_id_with_compet_diplome['domaine_competence_id']
data_key['semestre'] = ue_id_with_compet_diplome['semestre']
data_key['ue_id'] = ue_id_with_compet_diplome['ue_id']
data_key['partner_owner_recid'] = str(my_partner['recid'])
result = MYSY_GV.dbname['work_calcul_moyenne_by_ue_bc_diplome_session_semestre'].find_one_and_update(
data_key,
{"$set": local_node_moyenne_par_promo_diplome_bc_ue_semestre},
upsert=True,
return_document=ReturnDocument.AFTER
)