26/05/2026 - 18h00

Signed-off-by: Cherif <cbalde@mysy-training.com>
master_Elyos_FI
Cherif 2026-05-26 22:03:09 +02:00
parent 35ce0a3ee8
commit 08cb1422d4
4 changed files with 2385 additions and 48 deletions

View File

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

File diff suppressed because it is too large Load Diff

View File

@ -3654,11 +3654,11 @@ def Create_work_evaluation_participant_note(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
filt_diplome_id = {}
if ("diplome_id" in diction.keys() and diction['diplome_id']):
filt_diplome_id = {'diplome_id': str(diction['diplome_id']) }
filt_diplome_id = {'tab_diplome_ids': str(diction['diplome_id']) }
filt_domaine_competence_id = {}
if ("domaine_competence_id" in diction.keys() and diction['domaine_competence_id']):
@ -3672,6 +3672,22 @@ def Create_work_evaluation_participant_note(diction):
if ("session_id" in diction.keys() and diction['session_id']):
filt_session_id = {'session_id': str(diction['session_id'])}
"""
Creation d'un token pour identifier les lignes qui viennes d'etre insérées
"""
code_action = mycommon.create_token_urlsafe()
local_qry = {
"$match": { '$and':
[ {"partner_owner_recid": str(diction["partner_owner_recid"]),
"valide": "1",
"locked": "0"},
filt_diplome_id, filt_domaine_competence_id, filt_class_id, filt_session_id]
}
}
print(" ## local_qry = ", local_qry)
pipeline = [
{
"$match": { '$and':
@ -3712,7 +3728,7 @@ def Create_work_evaluation_participant_note(diction):
"$project": {
# On utilise l'_id de note_evaluation_participant comme _id du document de travail
"_id": "$note_evaluation_participant._id",
"code_action": str(code_action),
# Infos évaluation
"evaluation_id": {"$toString": "$_id"},
"evaluation_code": "$code",
@ -3760,6 +3776,7 @@ def Create_work_evaluation_participant_note(diction):
"valide": "$note_evaluation_participant.valide",
"locked": "$note_evaluation_participant.locked",
"source_collection": {
"$literal": "note_evaluation/note_evaluation_participant"
},
@ -3776,14 +3793,15 @@ def Create_work_evaluation_participant_note(diction):
}
]
print(" ### pipeline = ", pipeline)
MYSY_GV.dbname["note_evaluation"].aggregate(pipeline)
return True, "Ok creation de la table des notes de travail"
return True, "Ok creation de la table des notes de travail", str(code_action)
except Exception as e:
exc_type, exc_obj, exc_tb = sys.exc_info()
print(str(inspect.stack()[0][3]) + " -" + str(e) + " - ERRORRRR AT Line : " + str(exc_tb.tb_lineno))
return False, " Impossible de créer la collection : Create_work_evaluation_participant_note"
return False, " Impossible de créer la collection : Create_work_evaluation_participant_note", False
"""
@ -3855,11 +3873,15 @@ def Calcul_Moyen_evaluation_participant_note_BC_UE(diction):
work_collection_diction['partner_owner_recid'] = str(my_partner['recid'])
work_collection_diction['class_id'] = str(is_session_valide_data['class_id'])
work_collection_diction['session_id'] = str(is_session_valide_data['_id'])
work_collection_diction['semestre'] = str(diction['semestre'])
work_collection_diction['diplome_id'] = str(diction['diplome_id'])
work_collection_diction['domaine_competence_id'] = str(diction['domaine_competence_id'])
local_status, local_retval = Create_work_evaluation_participant_note(work_collection_diction)
local_status, local_retval, code_action = Create_work_evaluation_participant_note(work_collection_diction)
if( local_status is False):
return local_status, local_retval
print(" ### code action = ", str(code_action))
tab_inscrit_id = []
for inscrit in MYSY_GV.dbname['inscription'].find({'valide': '1', 'status': '1',
@ -3902,7 +3924,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
@ -3923,51 +3945,178 @@ def Calcul_Moyen_evaluation_participant_note_BC_UE(diction):
Aller recuperer les types d'evaluation
pour calculer les moyennes par UE
"""
for ue_id_with_compet_diplome in tab_ue_id_with_compet_diplome:
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']))
"""
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(" ## POUR SESSION _ UE _ DIPLOME _ BC = ", ue_id_with_compet_diplome)
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']),
}):
print(" ## INSCRIT = ", str(inscrit_data['nom']), str(inscrit_data['prenom']), str(inscrit_data['email']) )
#print(" les note class evaluation = ", class_type_evaluation_with_ponderation)
if( "type_evaluation_id" in class_type_evaluation_with_ponderation.keys() and class_type_evaluation_with_ponderation['type_evaluation_id']):
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'})
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})
if( ue_id_data and 'code' in ue_id_data.keys()):
ue_id_code = ue_id_data['code']
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})
if (domaine_competence_id_data and 'code' in domaine_competence_id_data.keys()):
domaine_competence_id_code = domaine_competence_id_data['code']
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']
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']))
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']),
}):
#print(" les note class evaluation = ", class_type_evaluation_with_ponderation)
ue_ponderation = "0"
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 "
if( "type_evaluation_id" in class_type_evaluation_with_ponderation.keys() and class_type_evaluation_with_ponderation['type_evaluation_id']):
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'})
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']))
"""
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))
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), " 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))
print(" Fin calcul note UE : Moyenne_UE = ", str(moyenne_ue), " Pondération TOTAL UE = ", str(somme_ue_ponderation))
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['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
)
print(" FOR INSCRIT ID = ", str(inscrit_id), " TYPE EVALUATION = ", type_evaluation_id_data['code'], " 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()+" : ligne de notes = ", notes)
print(" ======================================================== ")

View File

@ -18149,8 +18149,8 @@ def Create_work_evaluation_participant_note():
# On recupere le corps (payload) de la requete
payload = mycommon.strip_dictionary(request.form.to_dict())
print(" ### Create_work_evaluation_participant_note : payload = ",payload)
localStatus, message= base_class_calcul_note.Create_work_evaluation_participant_note(payload)
return jsonify(status=localStatus, message=message )
localStatus, message, code_action = base_class_calcul_note.Create_work_evaluation_participant_note(payload)
return jsonify(status=localStatus, message=message, code_action=code_action )
"""