24/05/2026 - 18h00

Signed-off-by: Cherif <cbalde@mysy-training.com>
master_Elyos_FI
Cherif 2026-05-24 17:40:33 +02:00
parent 23c7bdb124
commit 35ce0a3ee8
12 changed files with 10533 additions and 92 deletions

View File

@ -4,16 +4,19 @@
<option name="autoReloadType" value="SELECTIVE" />
</component>
<component name="ChangeListManager">
<list default="true" id="c6d0259a-16e1-410d-91a1-830590ee2a08" name="Changes" comment="22/05/2026 - 20h">
<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" />
<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$/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$/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$/partners.py" beforeDir="false" afterPath="$PROJECT_DIR$/partners.py" afterDir="false" />
<change beforePath="$PROJECT_DIR$/prj_common.py" beforeDir="false" afterPath="$PROJECT_DIR$/prj_common.py" afterDir="false" />
<change beforePath="$PROJECT_DIR$/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" />
@ -457,7 +460,7 @@
<option name="project" value="LOCAL" />
<updated>1747251650255</updated>
</task>
<option name="localTasksCounter" value="587" />
<option name="localTasksCounter" value="588" />
<servers />
</component>
<component name="Vcs.Log.Tabs.Properties">
@ -499,7 +502,6 @@
</option>
</component>
<component name="VcsManagerConfiguration">
<MESSAGE value="19/04/2026 - 20h30" />
<MESSAGE value="20/04/2026 - 20h30" />
<MESSAGE value="21/04/2026 - 11h30" />
<MESSAGE value="21/04/2026 - 21h30" />
@ -524,6 +526,7 @@
<MESSAGE value="20/05/2026 - 12h30" />
<MESSAGE value="20/05/2026 - 20h30" />
<MESSAGE value="22/05/2026 - 20h" />
<option name="LAST_COMMIT_MESSAGE" value="22/05/2026 - 20h" />
<MESSAGE value="23/05/2026 - 20h00" />
<option name="LAST_COMMIT_MESSAGE" value="23/05/2026 - 20h00" />
</component>
</project>

File diff suppressed because it is too large Load Diff

View File

@ -18173,8 +18173,6 @@ def Add_Update_UE_To_Session(diction):
"""
Verifier que l'UE est bien paramettrée sur la formation
"""
is_ue_in_class_count = MYSY_GV.dbname['myclass'].count_documents({'_id': ObjectId(str(session_data['class_id'])),
'partner_owner_recid': str(
my_partner['recid']),
@ -18200,6 +18198,7 @@ def Add_Update_UE_To_Session(diction):
local_couleur = "#3573CB"
local_competence_id = ""
local_domaine_competence_id = ""
local_semestre = ""
for is_ue_in_class_data in MYSY_GV.dbname['myclass'].find(
{'list_unite_enseignement._id': str(diction['ue_id']),
@ -18227,6 +18226,8 @@ def Add_Update_UE_To_Session(diction):
if ("competence_id" in local_data.keys() and local_data['competence_id']):
local_competence_id = local_data['competence_id']
if ("semestre" in local_data.keys() and local_data['semestre']):
local_semestre = local_data['semestre']
#local_couleur = is_ue_in_class_data['list_unite_enseignement']['couleur']
@ -18270,6 +18271,7 @@ def Add_Update_UE_To_Session(diction):
},
{'$set':
{
'list_unite_enseignement.$[xxx].semestre': local_semestre,
'list_unite_enseignement.$[xxx].diplome_id': local_diplome_id,
'list_unite_enseignement.$[xxx].formateur_id': local_formateur_id,
'list_unite_enseignement.$[xxx].domaine_competence_id': local_domaine_competence_id,
@ -18320,6 +18322,7 @@ def Add_Update_UE_To_Session(diction):
new_data['domaine_competence_id'] = local_domaine_competence_id
new_data['competence_id'] = local_competence_id
new_data['semestre'] = local_semestre
new_data['_id'] = str(diction['ue_id'])
@ -18576,6 +18579,8 @@ def Get_List_UE_Given_SessionFormation(diction):
'partner_owner_recid': str(my_partner['recid']),
'valide':'1',
'locked':'0'})
user = {}
user['id'] = str(val_tmp)
user['session_id'] = str(diction['session_id'])
@ -18583,6 +18588,11 @@ def Get_List_UE_Given_SessionFormation(diction):
user['code'] = str(ue_data['code'])
user['titre'] = str(ue_data['titre'])
if('semestre' in local_ue.keys()):
user['semestre'] = str(local_ue['semestre'])
else:
user['semestre'] = ""
local_formateur_id = ""
local_formateur_nom = ""
local_formateur_prenom = ""
@ -18629,10 +18639,12 @@ def Get_List_UE_Given_SessionFormation(diction):
user['diplome_id'] = str(diplome_id)
user['diplome_code'] = str(diplome_code)
domaine_competence_id = ""
domaine_competence_code = ""
if( "domaine_competence_id" in local_ue.keys() and local_ue['domaine_competence_id']):
domaine_competence_id_data = MYSY_GV.dbname['domaine_competence_pedagogique'].find_one({'_id':ObjectId(str(local_ue['domaine_competence_id'])),
'partner_owner_recid':str(my_partner['recid'])}, {'couleur':'1'})
'partner_owner_recid':str(my_partner['recid'])},
{'couleur':1, '_id':1, 'code':1})
if (domaine_competence_id_data and "couleur" in domaine_competence_id_data.keys()):
@ -18640,9 +18652,20 @@ def Get_List_UE_Given_SessionFormation(diction):
else:
user['couleur'] = "#3573CB"
if (domaine_competence_id_data and "_id" in domaine_competence_id_data.keys()):
domaine_competence_id = str(domaine_competence_id_data['_id'])
if (domaine_competence_id_data and "code" in domaine_competence_id_data.keys()):
domaine_competence_code = str(domaine_competence_id_data['code'])
else:
user['couleur'] = "#3573CB"
user['domaine_competence_id'] = str(domaine_competence_id)
user['domaine_competence_code'] = str(domaine_competence_code)
val_tmp = val_tmp + 1
RetObject.append(mycommon.JSONEncoder().encode(user))

View File

@ -2520,6 +2520,80 @@ def Confirme_Valide_Given_Session_Sequence_Mass(diction):
mycommon.myprint(str(inspect.stack()[0][3]) + " -" + str(e) + " - Line : " + str(exc_tb.tb_lineno))
return False, " Impossible de confirmer les séquences"
"""
Cette fonction permet de devalider une sequence
"""
def Unconfirme_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'] = ""
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) dévalidé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 dévalider les séquences"
"""

View File

@ -354,7 +354,7 @@ def Cacul_UE_Note_By_Evaluation_Type(diction):
Verification des input acceptés
"""
field_list = ['token', 'class_id', 'session_id', 'ue_id', 'tab_inscriptions_ids', 'evaluation_type_id',
'inscri_data_nom', 'inscri_data_prenom', 'inscri_data_email', 'evaluation_type_code']
'inscri_data_nom', 'inscri_data_prenom', 'inscri_data_email', 'evaluation_type_code', 'tab_ue_id_with_compet_diplome']
incom_keys = diction.keys()
@ -1057,7 +1057,7 @@ def Get_List_Evaluation_Final_Note_Classement_Detail_With_Filter(diction):
'$unwind': '$myclass_collection'
},
{'$project': {'_id': 1, 'session_id': 1, 'type_eval': 1, 'ue_id': 1, 'class_id': 1,
'inscription_id': 1, 'moyenne': 1, 'somme': 1,
'inscription_id': 1, 'moyenne': 1, 'somme': 1, 'diplome_id':1, 'domaine_competence_id':1,
'inscription_collection.email': 1, 'inscription_collection.nom': 1,
'inscription_collection.prenom': 1,
@ -1078,7 +1078,6 @@ def Get_List_Evaluation_Final_Note_Classement_Detail_With_Filter(diction):
for retval in MYSY_GV.dbname['session_formation_final_note_classement_detail'].aggregate(query2):
#print(" ## retval = ", retval )
user = retval
user['id'] = str(val_tmp)
val_tmp = val_tmp + 1
@ -1116,70 +1115,47 @@ def Get_List_Evaluation_Final_Note_Classement_Detail_With_Filter(diction):
user['inscription_id_nom'] = inscription_id_nom
user['inscription_id_prenom'] = inscription_id_prenom
domaine_competence_code = ""
domaine_competence_id = ""
if ("domaine_competence_id" in user.keys() and user['domaine_competence_id']):
domaine_competence_id_data = MYSY_GV.dbname['domaine_competence_pedagogique'].find_one(
{'_id': ObjectId(str(user['domaine_competence_id'])),
'valide': '1',
'locked': '0',
'partner_owner_recid': str(
my_partner['recid'])})
if (domaine_competence_id_data and "code" in domaine_competence_id_data.keys()):
domaine_competence_code = str(domaine_competence_id_data['code'])
domaine_competence_id = str(user['domaine_competence_id'])
user['domaine_competence_id'] = str(domaine_competence_id)
user['domaine_competence_code'] = str(domaine_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)
#print(" ### user = ", user)
RetObject.append(mycommon.JSONEncoder().encode(user))
"""
for retval in MYSY_GV.dbname['session_formation_final_note_classement_detail'].aggregate(query2).sort([("ue_id", pymongo.DESCENDING),("inscription_id", pymongo.DESCENDING),
("type_eval_id", pymongo.DESCENDING), ]):
print(" ## retval = ", retval )
user = retval
user['id'] = str(val_tmp)
val_tmp = val_tmp + 1
ue_id_code = ""
if( "ue_id" in retval.keys() ):
ue_id_data = MYSY_GV.dbname['unite_enseignement'].find_one({'_id':ObjectId(str(retval['ue_id'])),
'partner_owner_recid':my_partner['recid'],
'valide':'1',
'locked':'0'},
{'code':1})
if( ue_id_data and "code" in ue_id_data.keys() ):
ue_id_code = ue_id_data['code']
user['ue_id_code'] = ue_id_code
class_id_external_code = ""
if ("class_id" in retval.keys()):
class_id_data = MYSY_GV.dbname['myclass'].find_one({'_id': ObjectId(str(retval['ue_id'])),
'partner_owner_recid': my_partner['recid'],
'valide': '1',
'locked': '0'},
{'external_code': 1})
if (class_id_data and "external_code" in class_id_data.keys()):
class_id_external_code = class_id_data['external_code']
user['class_id_external_code'] = class_id_external_code
inscription_id_nom = ""
inscription_id_prenom = ""
inscription_id_mail = ""
if ("inscription_id" in retval.keys()):
inscription_id_data = MYSY_GV.dbname['inscription'].find_one({'_id': ObjectId(str(retval['inscription_id'])),
'partner_owner_recid': my_partner['recid'],
'valide': '1',},
{'email': 1, 'nom':1, 'prenom':1})
if (inscription_id_data and "email" in inscription_id_data.keys()):
inscription_id_mail = inscription_id_data['email']
if (inscription_id_data and "nom" in inscription_id_data.keys()):
inscription_id_nom = inscription_id_data['nom']
if (inscription_id_data and "prenom" in inscription_id_data.keys()):
inscription_id_prenom = inscription_id_data['prenom']
user['inscription_id_mail'] = inscription_id_mail
user['inscription_id_nom'] = inscription_id_nom
user['inscription_id_prenom'] = inscription_id_prenom
RetObject.append(mycommon.JSONEncoder().encode(user))
"""
return True, RetObject
@ -1872,11 +1848,19 @@ def Calcul_Note_Classement_Session(diction):
# On recupere la liste des ue_id de la promotion
tab_ue_id = []
tab_ue_id_with_compet_diplome = []
for class_class_ue_data in is_session_valide_data['list_unite_enseignement'] :
local_node = {}
local_node['ue_id'] = class_class_ue_data['_id']
local_node['domaine_competence_id'] = class_class_ue_data['domaine_competence_id']
local_node['diplome_id'] = class_class_ue_data['diplome_id']
tab_ue_id_with_compet_diplome.append(local_node)
tab_ue_id.append( str(class_class_ue_data['_id']))
#print(" ### ooooo tab_ue_id = ", tab_ue_id)
print(" ### ooooo tab_ue_id = ", tab_ue_id)
print(" ### ooooo zz tab_ue_id_with_compet_diplome = ", tab_ue_id_with_compet_diplome)
local_diction = {}
@ -1884,6 +1868,7 @@ def Calcul_Note_Classement_Session(diction):
local_diction['class_id'] = str(is_class_data['_id'])
local_diction['session_id'] = str(diction['session_id'])
local_diction['tab_ue_id_with_compet_diplome'] = tab_ue_id_with_compet_diplome
list_inscrit_id = ",".join(tab_ue_id)
local_diction['tab_ue_ids'] = str(list_inscrit_id)
@ -1891,7 +1876,7 @@ def Calcul_Note_Classement_Session(diction):
list_inscrit_id = ",".join(tab_inscrit_id)
local_diction['tab_inscriptions_ids'] = str(list_inscrit_id)
#print('### local_diction 01010 =', local_diction)
print('### local_diction 01010 =', local_diction)
local_status, local_retval = run_ue_pre_calcul_moyenne_somme_v2(local_diction)
@ -2602,7 +2587,7 @@ def run_ue_pre_calcul_moyenne_somme_v2(diction):
"""
Verification des input acceptés
"""
field_list = ['token', 'class_id', 'session_id', 'tab_ue_ids', 'tab_inscriptions_ids' ]
field_list = ['token', 'class_id', 'session_id', 'tab_ue_ids', 'tab_inscriptions_ids', 'tab_ue_id_with_compet_diplome' ]
incom_keys = diction.keys()
for val in incom_keys:
@ -2635,6 +2620,7 @@ def run_ue_pre_calcul_moyenne_somme_v2(diction):
if (local_status is not True):
return local_status, my_partner
print(" ### IN run_ue_pre_calcul_moyenne_somme_v2 tab_ue_id_with_compet_diplome = ", diction['tab_ue_id_with_compet_diplome'])
# Verifier la validité de la session
is_session_valide_count = MYSY_GV.dbname['session_formation'].count_documents({'_id':ObjectId(str(diction['session_id'])),
@ -2720,12 +2706,18 @@ def run_ue_pre_calcul_moyenne_somme_v2(diction):
La formule : ( (Moyenne Art. (TD) + Moyenne Art(TP) * 2)/3 + Examen Final ) / 2
"""
print(" ### diction['tab_ue_id_with_compet_diplome'] = ", diction['tab_ue_id_with_compet_diplome'])
for tab_my_ue_id_with_compet_diplome in diction['tab_ue_id_with_compet_diplome']:
if( "ue_id" in tab_my_ue_id_with_compet_diplome.keys() and "domaine_competence_id" in tab_my_ue_id_with_compet_diplome.keys()
and "diplome_id" in tab_my_ue_id_with_compet_diplome.keys()):
print(" OKKKKKK all tab_my_ue_id_with_compet_diplome = ", tab_my_ue_id_with_compet_diplome)
for my_ue_id in tab_ue_ids_splited:
my_ue_id = str(my_ue_id).strip()
my_ue_id = str(tab_my_ue_id_with_compet_diplome['ue_id']).strip()
my_domaine_competence_id = str(tab_my_ue_id_with_compet_diplome['domaine_competence_id']).strip()
my_diplome_id = str(tab_my_ue_id_with_compet_diplome['diplome_id']).strip()
#print(" ## TGGT my_ue_id = ", my_ue_id)
print(" ## TGGT my_ue_id = ", my_ue_id)
my_ue_id_data = MYSY_GV.dbname['unite_enseignement'].find_one(
{'_id': ObjectId(str(my_ue_id)),
@ -2744,6 +2736,8 @@ def run_ue_pre_calcul_moyenne_somme_v2(diction):
{'class_ue_id': str(my_ue_id),
'valide': '1',
'locked': '0',
'diplome_id': str(my_diplome_id),
'domaine_competence_id': str(my_domaine_competence_id),
'class_id': str(
diction['class_id']),
'partner_owner_recid': str(
@ -2751,11 +2745,13 @@ def run_ue_pre_calcul_moyenne_somme_v2(diction):
}
)
#print(" ### la liste Class_UE_type_eval = ", Class_UE_type_eval)
print(" ### la liste Class_UE_type_eval = ", Class_UE_type_eval)
print(" ### QRYYY = ",{'class_eu_id': str(my_ue_id),
print(" ### QRYYY on note_evaluation = ",{'class_eu_id': str(my_ue_id),
'valide': '1',
'locked': '0',
'tab_diplome_ids':str(my_diplome_id),
'domaine_competence_id': str( my_domaine_competence_id),
'session_id':str(diction['session_id']),
'partner_owner_recid': str(my_partner['recid']),
'type_eval_id':{'$in':Class_UE_type_eval}
@ -2765,6 +2761,8 @@ def run_ue_pre_calcul_moyenne_somme_v2(diction):
{'class_eu_id': str(my_ue_id),
'valide': '1',
'locked': '0',
'tab_diplome_ids':str(my_diplome_id),
'domaine_competence_id': str( my_domaine_competence_id),
'session_id':str(diction['session_id']),
'partner_owner_recid': str(my_partner['recid']),
'type_eval_id':{'$in':Class_UE_type_eval}
@ -2810,7 +2808,6 @@ def run_ue_pre_calcul_moyenne_somme_v2(diction):
'locked': '0',
'_id': ObjectId(str(eval_type_id))})
print(" TRAITEMENT TYPE EVAL iii : ", eval_type_id_data)
local_diction = diction
local_diction['tab_inscriptions_ids'] = str(my_inscription)
@ -2835,6 +2832,10 @@ def run_ue_pre_calcul_moyenne_somme_v2(diction):
new_node['class_id'] = str(diction['class_id'])
new_node['session_id'] = str(diction['session_id'])
new_node['ue_id'] = str(my_ue_id)
new_node['domaine_competence_id'] = str(my_domaine_competence_id)
new_node['diplome_id'] = str(my_diplome_id)
new_node['type_eval'] = str(eval_type_id_data["code"])
new_node['type_eval_id'] = str(eval_type_id)
new_node['moyenne'] = str(local_retval_moyenne_TD)
@ -3628,3 +3629,352 @@ def Create_Bar_Chart_And_Save_Ok(diction):
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 Create_Bar_Chart_And_Save"
"""
24/05/206 - Nouvelle methode de calcul des notes
etape 1 : collection : work_evaluation_participant_note
On va aller peupler une table de travail qui contient la jointure
-note_evaluation et note_evaluation_participant
Etape 2 :
calculer les moyennes selon les filtre que souhaite (par diplome, par domaine de compétence etc)
"""
def Create_work_evaluation_participant_note(diction):
try:
"""
Verification des input acceptés
"""
field_list = ['partner_owner_recid', 'semestre', 'diplome_id', 'domaine_competence_id', 'inscrit_id', 'class_id', 'session_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"
filt_diplome_id = {}
if ("diplome_id" in diction.keys() and diction['diplome_id']):
filt_diplome_id = {'diplome_id': str(diction['diplome_id']) }
filt_domaine_competence_id = {}
if ("domaine_competence_id" in diction.keys() and diction['domaine_competence_id']):
filt_domaine_competence_id = {'domaine_competence_id': str(diction['domaine_competence_id'])}
filt_class_id = {}
if ("class_id" in diction.keys() and diction['class_id']):
filt_class_id = {'class_id': str(diction['class_id'])}
filt_session_id = {}
if ("session_id" in diction.keys() and diction['session_id']):
filt_session_id = {'session_id': str(diction['session_id'])}
pipeline = [
{
"$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]
}
},
{
"$lookup": {
"from": "note_evaluation_participant",
"let": {
"evaluation_id": {"$toString": "$_id"},
"owner": "$partner_owner_recid"
},
"pipeline": [
{
"$match": {
"$expr": {
"$and": [
{"$eq": ["$evaluation_id", "$$evaluation_id"]},
{"$eq": ["$partner_owner_recid", "$$owner"]},
{"$eq": ["$valide", "1"]},
{"$eq": ["$locked", "0"]}
]
}
}
}
],
"as": "note_evaluation_participant"
}
},
{
"$unwind": "$note_evaluation_participant"
},
{
"$project": {
# On utilise l'_id de note_evaluation_participant comme _id du document de travail
"_id": "$note_evaluation_participant._id",
# Infos évaluation
"evaluation_id": {"$toString": "$_id"},
"evaluation_code": "$code",
"evaluation_titre": "$titre",
"evaluation_description": "$description",
"evaluation_comment": "$comment",
"class_id": "$class_id",
"class_eu_id": "$class_eu_id",
"type_eval_id": "$type_eval_id",
"domaine_competence_id": "$domaine_competence_id",
"session_id": "$session_id",
"responsable_id": "$responsable_id",
"tab_diplome_ids": "$tab_diplome_ids",
"rattrapage": "$rattrapage",
"eval_date_heure_debut": "$eval_date_heure_debut",
"eval_date_heure_fin": "$eval_date_heure_fin",
"mode_animation": "$mode_animation",
"max_note": "$max_note",
"type_note": "$type_note",
# Infos note participant
"note_evaluation_participant_id": {
"$toString": "$note_evaluation_participant._id"
},
"inscription_id": "$note_evaluation_participant.inscription_id",
"group_inscription_id": "$note_evaluation_participant.group_inscription_id",
"note": "$note_evaluation_participant.note",
"note_history_change": "$note_evaluation_participant.note_history_change",
"is_validated": "$note_evaluation_participant.is_validated",
"is_validated_by": "$note_evaluation_participant.is_validated_by",
"is_validated_date": "$note_evaluation_participant.is_validated_date",
"publish": "$note_evaluation_participant.publish",
"publish_by": "$note_evaluation_participant.publish_by",
"publish_date": "$note_evaluation_participant.publish_date",
# Champs techniques
"partner_owner_recid": "$partner_owner_recid",
"valide": "$note_evaluation_participant.valide",
"locked": "$note_evaluation_participant.locked",
"source_collection": {
"$literal": "note_evaluation/note_evaluation_participant"
},
"work_update_date": "$$NOW"
}
},
{
"$merge": {
"into": "work_evaluation_participant_note",
"on": "_id",
"whenMatched": "replace",
"whenNotMatched": "insert"
}
}
]
MYSY_GV.dbname["note_evaluation"].aggregate(pipeline)
return True, "Ok creation de la table des notes de travail"
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"
"""
24/05/2026 -
Fonction de calcul des moyennes en logique : Bloc Compétence / UE
Avec des filtre sur la formation, le rattrapge
"""
def Calcul_Moyen_evaluation_participant_note_BC_UE(diction):
try:
diction = mycommon.strip_dictionary(diction)
"""
Verification des input acceptés
"""
field_list = ['token', 'session_id', 'semestre', 'diplome_id', 'domaine_competence_id', 'inscrit_id',
'class_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', 'session_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
is_session_valide_count = MYSY_GV.dbname['session_formation'].count_documents(
{'_id': ObjectId(str(diction['session_id'])),
'valide': '1',
'partner_owner_recid': str(my_partner['recid'])})
if (is_session_valide_count != 1):
mycommon.myprint(
str(inspect.stack()[0][3]) + " L'identifiant de la session est invalide ")
return False, " L'identifiant de la session est invalide ",
is_session_valide_data = MYSY_GV.dbname['session_formation'].find_one(
{'_id': ObjectId(str(diction['session_id'])),
'valide': '1',
'partner_owner_recid': str(my_partner['recid'])})
"""
Etape 0 : On met à jours (vider et recharger) la table temporaire de travail :work_evaluation_participant_note
"""
work_collection_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'])
local_status, local_retval = Create_work_evaluation_participant_note(work_collection_diction)
if( local_status is False):
return local_status, local_retval
tab_inscrit_id = []
for inscrit in MYSY_GV.dbname['inscription'].find({'valide': '1', 'status': '1',
'partner_owner_recid': str(my_partner['recid']),
'session_id': str(is_session_valide_data['_id'])}):
tab_inscrit_id.append(str(inscrit['_id']))
filt_class_id = {}
if ("class_id" in diction.keys() and diction['class_id']):
filt_class_id = {'class_id': str(diction['class_id'])}
# On recupere la liste des ue_id de la promotion
tab_ue_id = []
tab_ue_id_with_compet_diplome = []
if ("semestre" in diction.keys() and diction['semestre']):
for class_class_ue_data in is_session_valide_data['list_unite_enseignement'] :
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']
local_node['domaine_competence_id'] = class_class_ue_data['domaine_competence_id']
local_node['diplome_id'] = class_class_ue_data['diplome_id']
local_node['semestre'] = class_class_ue_data['semestre']
tab_ue_id_with_compet_diplome.append(local_node)
tab_ue_id.append( str(class_class_ue_data['_id']))
else:
for class_class_ue_data in is_session_valide_data['list_unite_enseignement']:
local_node = {}
local_node['ue_id'] = class_class_ue_data['_id']
local_node['domaine_competence_id'] = class_class_ue_data['domaine_competence_id']
local_node['diplome_id'] = class_class_ue_data['diplome_id']
local_node['semestre'] = class_class_ue_data['semestre']
tab_ue_id_with_compet_diplome.append(local_node)
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)
"""
Etape 2 : On va aller chercher toutes lignes concernées par : tab_ue_id_with_compet_diplome
"""
filt_diplome_id = {}
if ("diplome_id" in diction.keys() and 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']):
filt_domaine_competence_id = {'domaine_competence_id': str(diction['domaine_competence_id'])}
"""
Etape 3 :
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:
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(" 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 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)
new_query_note = {'$and': [
qry_select_note, filt_diplome_id, filt_domaine_competence_id]}
#print(" new_query_note0002 = ", new_query_note)
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(" ======================================================== ")
return True, "Ok creation de la table des notes de travail"
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"

File diff suppressed because it is too large Load Diff

View File

@ -7971,7 +7971,7 @@ def Add_Update_UE_To_Class(diction):
Verification des input acceptés
"""
field_list = ['token', 'class_id', 'ue_id', 'credit', 'pres_dist_hyp', 'is_noted',
'coefficient', 'seuil_validation' ]
'coefficient', 'seuil_validation', ]
incom_keys = diction.keys()
for val in incom_keys:
@ -8788,6 +8788,7 @@ def Update_Class_UE_From_Ref_pedago(diction):
new_data['update_by'] = str(my_partner['_id'])
new_data['locked'] = "0"
if( "credit" in local_ue.keys() ):
new_data['credit'] = str(local_ue['credit'])
else:

View File

@ -660,7 +660,7 @@ def Get_Ent_Student_Session_Sequence_List(diction):
nb_sequence = 0
for New_retVal in MYSY_GV.dbname['session_formation_sequence'].find({'$and':[
{'partner_owner_recid':str(apprenant_data['partner_owner_recid']), 'valide':'1', 'locked':'0'},
{'partner_owner_recid':str(apprenant_data['partner_owner_recid']), 'valide':'1', 'locked':'0', 'confirmed':'1'},
filt_session]}):
user = New_retVal

47
main.py
View File

@ -8463,6 +8463,24 @@ def Confirme_Valide_Given_Session_Sequence_Mass():
"""
API qui permet de déconfimer / valider des sequence de formation en masse
"""
@app.route('/myclass/api/Unconfirme_Valide_Given_Session_Sequence_Mass/', methods=['POST','GET'])
@crossdomain(origin='*')
def Unconfirme_Valide_Given_Session_Sequence_Mass():
# On recupere le corps (payload) de la requete
payload = mycommon.strip_dictionary (request.form.to_dict())
print(" ### Unconfirme_Valide_Given_Session_Sequence_Mass payload = ",)
status, retval = Session_Formation_Sequence.Unconfirme_Valide_Given_Session_Sequence_Mass(payload)
return jsonify(status=status, message=retval)
"""
API Affecter une ressource à une sequence (humaine ou materielle)
@ -18122,6 +18140,35 @@ def Get_Given_Diplome():
"""
API qui met les notes dans une collection tempraire pour faire les calculs
"""
@app.route('/myclass/api/Create_work_evaluation_participant_note', methods=['POST','GET'])
@crossdomain(origin='*')
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 )
"""
API de test de calcul des moyennes en logique : Bloc Compétence / UE
Avec des filtre sur la formation, le rattrapge
"""
@app.route('/myclass/api/Calcul_Moyen_evaluation_participant_note_BC_UE', methods=['POST','GET'])
@crossdomain(origin='*')
def Calcul_Moyen_evaluation_participant_note_BC_UE():
# On recupere le corps (payload) de la requete
payload = mycommon.strip_dictionary(request.form.to_dict())
print(" ### Calcul_Moyen_evaluation_participant_note_BC_UE : payload = ",payload)
localStatus, message= base_class_calcul_note.Calcul_Moyen_evaluation_participant_note_BC_UE(payload)
return jsonify(status=localStatus, message=message )
if __name__ == '__main__':
print(" debut api")

View File

@ -67,7 +67,7 @@ def Add_Evaluation_Planification(diction):
'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', 'rattrapage',
'tab_diplome_ids']
'tab_diplome_ids', 'domaine_competence_id']
incom_keys = diction.keys()
for val in incom_keys:
@ -116,6 +116,18 @@ def Add_Evaluation_Planification(diction):
return False, " La formation et l'UE ne sont pas cohérents "
if ("domaine_competence_id" in diction.keys() and diction['domaine_competence_id']):
is_valide_domaine_competence_id = MYSY_GV.dbname['domaine_competence_pedagogique'].count_documents(
{'_id': ObjectId(str(diction['domaine_competence_id'])),
'partner_owner_recid': my_partner['recid'],
})
if (is_valide_domaine_competence_id != 1):
mycommon.myprint(
str(inspect.stack()[0][3]) + " Le domaine de compétence est invalide ")
return False, "Le domaine de compétence est invalide "
"""
Verif des diplomes
"""
@ -223,8 +235,8 @@ def Add_Evaluation_Planification(diction):
class_unite_enseignement_type_evaluation
"""
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']),
@ -236,6 +248,7 @@ def Add_Evaluation_Planification(diction):
'diplome_id':local_diplome
})
if( notation_critere_is_valide != 1 ):
mycommon.myprint(
str(inspect.stack()[0][
@ -345,7 +358,7 @@ def Update_Evaluation_Planification(diction):
'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', 'rattrapage',
'tab_diplome_ids']
'tab_diplome_ids', 'domaine_competence_id', ]
incom_keys = diction.keys()
for val in incom_keys:
@ -379,6 +392,19 @@ def Update_Evaluation_Planification(diction):
if (local_status is not True):
return local_status, my_partner
if ("domaine_competence_id" in diction.keys() and diction['domaine_competence_id']):
is_valide_domaine_competence_id = MYSY_GV.dbname['domaine_competence_pedagogique'].count_documents(
{'_id': ObjectId(str(diction['domaine_competence_id'])),
'partner_owner_recid': my_partner['recid'],
})
if (is_valide_domaine_competence_id != 1):
mycommon.myprint(
str(inspect.stack()[0][3]) + " Le domaine de compétence est invalide ")
return False, "Le domaine de compétence est invalide "
"""
Verif des diplomes
"""
@ -575,6 +601,7 @@ def Update_Evaluation_Planification(diction):
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:

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', 'diplome_id']
'type_notation', 'diplome_id', 'domaine_competence_id']
incom_keys = diction.keys()
for val in incom_keys:
@ -568,6 +568,19 @@ def Add_Class_UE_Evaluation(diction):
str(inspect.stack()[0][3]) + " L'identifiant du diplome est invalide ")
return False, " L'identifiant du diplome est invalide "
if ("domaine_competence_id" in diction.keys() and diction['domaine_competence_id']):
is_valide_domaine_competence_id = MYSY_GV.dbname['domaine_competence_pedagogique'].count_documents(
{'_id': ObjectId(str(diction['domaine_competence_id'])),
'partner_owner_recid': my_partner['recid'],
})
if (is_valide_domaine_competence_id != 1):
mycommon.myprint(
str(inspect.stack()[0][3]) + " Le domaine de compétence est invalide ")
return False, "Le domaine de compétence est invalide "
if( "type_notation" in diction.keys() and diction['type_notation'] not in ['num', 'alpha']):
mycommon.myprint(
str(inspect.stack()[0][
@ -662,7 +675,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', 'diplome_id']
'type_notation', 'diplome_id', 'domaine_competence_id']
incom_keys = diction.keys()
for val in incom_keys:
@ -705,6 +718,19 @@ def Update_Class_UE_Evaluation(diction):
str(inspect.stack()[0][3]) + " L'identifiant du diplome est invalide ")
return False, " L'identifiant du diplome est invalide "
if ("domaine_competence_id" in diction.keys() and diction['domaine_competence_id']):
is_valide_domaine_competence_id = MYSY_GV.dbname['domaine_competence_pedagogique'].count_documents({'_id': ObjectId(str(diction['domaine_competence_id'])),
'partner_owner_recid': my_partner['recid'],
})
if (is_valide_domaine_competence_id != 1):
mycommon.myprint(
str(inspect.stack()[0][3]) + " Le domaine de compétence est invalide ")
return False, "Le domaine de compétence est invalide "
if ("type_notation" in diction.keys() and diction['type_notation'] not in ['num', 'alpha']):
mycommon.myprint(
str(inspect.stack()[0][

View File

@ -842,6 +842,7 @@ def Get_List_Unite_Enseignement_Of_Given_Class(diction):
for New_retVal in MYSY_GV.dbname['myclass'].find(qry).sort([("_id", pymongo.DESCENDING), ]):
if( "list_unite_enseignement" in New_retVal.keys() ):
for local_val in New_retVal['list_unite_enseignement'] :
eu_class_coef = ""
if( "coefficient" in local_val.keys() and local_val['coefficient']):
eu_class_coef = local_val['coefficient']
@ -853,6 +854,7 @@ def Get_List_Unite_Enseignement_Of_Given_Class(diction):
user = local_val
user['id'] = str(val_tmp)
val_tmp = val_tmp + 1
@ -863,7 +865,7 @@ def Get_List_Unite_Enseignement_Of_Given_Class(diction):
Recuperation des données associées à cette UE
"""
ue_data = MYSY_GV.dbname['unite_enseignement'].find_one({'partner_owner_recid':str(my_partner['recid']), 'valide':'1', 'locked':'0',
'_id':ObjectId(str(local_val['_id']))})
'_id':ObjectId(str(local_val['_id']))}, {'semestre':0, 'objectif':0, 'prerequis':0, 'programme':0 })
if( ue_data ):
for val in ue_data.keys() :
@ -897,9 +899,11 @@ def Get_List_Unite_Enseignement_Of_Given_Class(diction):
if ("seuil_validation" not in user.keys()):
user['seuil_validation'] = "99"
if ("semestre" not in user.keys()):
user['semestre'] = ""
domaine_competence_code = ""
domaine_competence_id = ""
if ("domaine_competence_id" in user.keys() and user['domaine_competence_id']):
@ -1063,7 +1067,7 @@ def Get_List_Unite_Enseignement_Of_Given_Class_From_Session_Id(diction):
Recuperation des données associées à cette UE
"""
ue_data = MYSY_GV.dbname['unite_enseignement'].find_one({'partner_owner_recid':str(my_partner['recid']), 'valide':'1', 'locked':'0',
'_id':ObjectId(str(local_val['_id']))})
'_id':ObjectId(str(local_val['_id']))}, {'semestre':0, 'objectif':0, 'prerequis':0, 'programme':0 })
if( ue_data ):
for val in ue_data.keys() :
@ -1361,7 +1365,7 @@ def Get_Givent_Unite_Enseignement_Data_Of_Given_Class(diction):
Recuperation des données associées à cette UE
"""
ue_data = MYSY_GV.dbname['unite_enseignement'].find_one({'partner_owner_recid':str(my_partner['recid']), 'valide':'1', 'locked':'0',
'_id':ObjectId(str(local_val['_id']))})
'_id':ObjectId(str(local_val['_id']))}, {'semestre':0, 'objectif':0, 'prerequis':0, 'programme':0 })
if( ue_data ):
for val in ue_data.keys() :