parent
2708bc74bd
commit
5c3ce1ec80
|
@ -3,8 +3,12 @@
|
|||
<component name="ChangeListManager">
|
||||
<list default="true" id="c6d0259a-16e1-410d-91a1-830590ee2a08" name="Changes" comment="03/05/2025 - 20h">
|
||||
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" 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$/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$/main.py" beforeDir="false" afterPath="$PROJECT_DIR$/main.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" />
|
||||
|
@ -81,13 +85,6 @@
|
|||
<option name="presentableId" value="Default" />
|
||||
<updated>1680804787304</updated>
|
||||
</task>
|
||||
<task id="LOCAL-00403" summary="05/10/2024 - 12h">
|
||||
<created>1728125449140</created>
|
||||
<option name="number" value="00403" />
|
||||
<option name="presentableId" value="LOCAL-00403" />
|
||||
<option name="project" value="LOCAL" />
|
||||
<updated>1728125449141</updated>
|
||||
</task>
|
||||
<task id="LOCAL-00404" summary="05/10/2024 - 18h30">
|
||||
<created>1728145402808</created>
|
||||
<option name="number" value="00404" />
|
||||
|
@ -424,7 +421,14 @@
|
|||
<option name="project" value="LOCAL" />
|
||||
<updated>1746293658250</updated>
|
||||
</task>
|
||||
<option name="localTasksCounter" value="452" />
|
||||
<task id="LOCAL-00452" summary="03/05/2025 - 20h">
|
||||
<created>1746294987207</created>
|
||||
<option name="number" value="00452" />
|
||||
<option name="presentableId" value="LOCAL-00452" />
|
||||
<option name="project" value="LOCAL" />
|
||||
<updated>1746294987208</updated>
|
||||
</task>
|
||||
<option name="localTasksCounter" value="453" />
|
||||
<servers />
|
||||
</component>
|
||||
<component name="Vcs.Log.Tabs.Properties">
|
||||
|
|
|
@ -1511,6 +1511,8 @@ def GetAllClassStagiaire(diction):
|
|||
user = retval
|
||||
user['id'] = str(val_tmp)
|
||||
|
||||
|
||||
|
||||
client_rattachement_id = ""
|
||||
client_rattachement_nom = ""
|
||||
|
||||
|
@ -1599,6 +1601,16 @@ def GetAllClassStagiaire(diction):
|
|||
lms_user_id = retval['lms_user_id']
|
||||
user['lms_user_id'] = lms_user_id
|
||||
|
||||
if ("rang" not in retval.keys()):
|
||||
user['rang'] = "-"
|
||||
else:
|
||||
user['rang'] = retval['rang']
|
||||
|
||||
if ("rang_calculation_date" not in retval.keys()):
|
||||
user['rang_calculation_date'] = "-"
|
||||
else:
|
||||
user['rang_calculation_date'] = retval['rang_calculation_date']
|
||||
|
||||
RetObject.append(mycommon.JSONEncoder().encode(user))
|
||||
|
||||
return True, RetObject
|
||||
|
|
3772
Log/log_file.log
3772
Log/log_file.log
File diff suppressed because it is too large
Load Diff
|
@ -53,7 +53,7 @@ Les données en entrée :
|
|||
- La session
|
||||
- Liste des inscrit
|
||||
"""
|
||||
def run_pre_calcul_moyenne_somme(diction):
|
||||
def run_ue_pre_calcul_moyenne_somme(diction):
|
||||
try:
|
||||
diction = mycommon.strip_dictionary(diction)
|
||||
|
||||
|
@ -255,7 +255,7 @@ def run_pre_calcul_moyenne_somme(diction):
|
|||
local_diction['evaluation_type_code'] = str(eval_type_id_data["code"])
|
||||
local_diction['evaluation_type_id'] = str(eval_type_id_data["_id"])
|
||||
|
||||
local_status, local_retval_moyenne_TD, local_retval_somme_TD, local_retval_nb_eval_TD = Cacul_Note_By_Evaluation_Type(
|
||||
local_status, local_retval_moyenne_TD, local_retval_somme_TD, local_retval_nb_eval_TD = Cacul_UE_Note_By_Evaluation_Type(
|
||||
local_diction)
|
||||
if (local_status):
|
||||
new_node = {}
|
||||
|
@ -322,7 +322,7 @@ def run_pre_calcul_moyenne_somme(diction):
|
|||
|
||||
print(" ### local_diction = ", local_diction)
|
||||
|
||||
local_status, local_retval = Cacul_Note_Finale_For_calcul_mode_1(local_diction)
|
||||
local_status, local_retval = Cacul_UE_Note_Finale_For_calcul_mode_1(local_diction)
|
||||
|
||||
|
||||
return True, tab_note_final
|
||||
|
@ -335,7 +335,7 @@ def run_pre_calcul_moyenne_somme(diction):
|
|||
"""
|
||||
Cette fonction calcule les moyennes les sommes par ue/inscrit/type evaluation
|
||||
"""
|
||||
def Cacul_Note_By_Evaluation_Type(diction):
|
||||
def Cacul_UE_Note_By_Evaluation_Type(diction):
|
||||
try:
|
||||
diction = mycommon.strip_dictionary(diction)
|
||||
|
||||
|
@ -490,7 +490,7 @@ def Cacul_Note_By_Evaluation_Type(diction):
|
|||
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 lancer Cacul_Note_By_Evaluation_Type "
|
||||
return False, " Impossible de lancer Cacul_UE_Note_By_Evaluation_Type "
|
||||
|
||||
|
||||
"""
|
||||
|
@ -501,10 +501,9 @@ appliquant la forule 1:
|
|||
|
||||
Alog :
|
||||
la fonction va essentiellement travailler sur la collection : session_formation_final_note_classement_detail
|
||||
|
||||
|
||||
"""
|
||||
def Cacul_Note_Finale_For_calcul_mode_1(diction):
|
||||
def Cacul_UE_Note_Finale_For_calcul_mode_1(diction):
|
||||
try:
|
||||
diction = mycommon.strip_dictionary(diction)
|
||||
|
||||
|
@ -565,6 +564,23 @@ def Cacul_Note_Finale_For_calcul_mode_1(diction):
|
|||
'locked': '0',
|
||||
'partner_owner_recid': str(my_partner['recid'])})
|
||||
|
||||
# Recuperer les données de l'UE dans la formation (ex : credit, seuil de validation, etc)
|
||||
class_ue_data = {}
|
||||
is_class_ue_data = "0"
|
||||
if( "list_unite_enseignement" in is_myclass_valide_data.keys() ):
|
||||
for data in is_myclass_valide_data['list_unite_enseignement']:
|
||||
if( data['_id'] == str(diction['ue_id'])):
|
||||
class_ue_data = data
|
||||
is_class_ue_data = "1"
|
||||
|
||||
|
||||
if( is_class_ue_data == "0"):
|
||||
mycommon.myprint(
|
||||
str(inspect.stack()[0][3]) + " La formation ne contient pas l'UE selectionné code = "+str(is_ue_valide_data['code']))
|
||||
return False, " La formation ne contient pas l'UE selectionné code = "+str(is_ue_valide_data['code'])
|
||||
|
||||
|
||||
|
||||
# Verifier la validité de la liste des inscrits fournie
|
||||
tab_inscriptions_ids = ""
|
||||
if ("tab_inscriptions_ids" in diction.keys()):
|
||||
|
@ -664,9 +680,6 @@ def Cacul_Note_Finale_For_calcul_mode_1(diction):
|
|||
print(" ############################ ")
|
||||
|
||||
note_finale_ue = ( (( (MA_TD_float + (MA_TP_float * 2 )) / 3 ) + MA_Examen_float) )/ 2
|
||||
tmp = (MA_TD_float + (MA_TP_float * 2 )) / 3
|
||||
|
||||
print(" ## tmp = ", tmp)
|
||||
|
||||
note_finale_ue = round(note_finale_ue, 2)
|
||||
|
||||
|
@ -683,6 +696,35 @@ def Cacul_Note_Finale_For_calcul_mode_1(diction):
|
|||
local_node['type_eval_id'] = "----"
|
||||
|
||||
local_node['ue_id'] = str(diction['ue_id'])
|
||||
|
||||
if( "credit" in class_ue_data.keys() ):
|
||||
local_node['credit'] = str(class_ue_data['credit'])
|
||||
elif ( "ects" in is_ue_valide_data.keys() ):
|
||||
local_node['credit'] = str(is_ue_valide_data['ects'])
|
||||
else:
|
||||
local_node['credit'] = "0"
|
||||
|
||||
if ("coefficient" in class_ue_data.keys()):
|
||||
local_node['ue_coefficient'] = str(class_ue_data['coefficient'])
|
||||
elif ("coefficient" in is_ue_valide_data.keys()):
|
||||
local_node['ue_coefficient'] = str(is_ue_valide_data['coefficient'])
|
||||
else:
|
||||
local_node['ue_coefficient'] = "1"
|
||||
|
||||
if ("seuil_validation" in class_ue_data.keys()):
|
||||
local_node['seuil_validation'] = str(class_ue_data['seuil_validation'])
|
||||
elif ("seuil_validation" in is_ue_valide_data.keys()):
|
||||
local_node['seuil_validation'] = str(is_ue_valide_data['seuil_validation'])
|
||||
else:
|
||||
local_node['seuil_validation'] = "99" # le 99 pour eviter les validation par defaut
|
||||
|
||||
# Acter si la personne valide l'UE
|
||||
print(" #### si la personne valide l'UE CMP de float(note_finale_ue) = ", float(note_finale_ue) , " et float(local_node['seuil_validation'] ) = ", float(local_node['seuil_validation'] ))
|
||||
if(float(note_finale_ue) >= float(local_node['seuil_validation'] )):
|
||||
local_node['ue_validation'] = "1"
|
||||
else:
|
||||
local_node['ue_validation'] = "0"
|
||||
|
||||
local_node['class_id'] = str(diction['class_id'])
|
||||
local_node['inscription_email'] = str(inscri_data_email)
|
||||
local_node['inscription_nom'] = str(inscri_data_nom)
|
||||
|
@ -749,21 +791,17 @@ def Cacul_Note_Finale_For_calcul_mode_1(diction):
|
|||
'locked':'0'
|
||||
|
||||
},
|
||||
{"$set": {'rang':str(classement)}},
|
||||
{"$set": {'rang':str(classement), 'rang_calculation_date':str(datetime.now())}},
|
||||
return_document=ReturnDocument.AFTER,
|
||||
upsert=False,
|
||||
)
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
return True, "Calcul Final Moyenne et Classement ok"
|
||||
|
||||
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 lancer Cacul_Note_By_Evaluation_Type "
|
||||
return False, " Impossible de lancer Cacul_UE_Note_By_Evaluation_Type "
|
||||
|
||||
|
||||
|
||||
|
@ -1042,3 +1080,402 @@ def Get_List_Evaluation_Final_Note_Classement_With_Filter(diction):
|
|||
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 évaluations "
|
||||
|
||||
|
||||
|
||||
"""
|
||||
Cette fonction va calculer moyenne par session (formation)
|
||||
|
||||
Précedemment les calculs se faisaient pas UE, a présent nous allons faire le calcul par formation.
|
||||
|
||||
Calcul selon la règle :
|
||||
- [ UE * Coef (UE) ] / nb_coef
|
||||
|
||||
"""
|
||||
def Cacul_Session_Note_Finale_For_calcul_mode_1(diction):
|
||||
try:
|
||||
diction = mycommon.strip_dictionary(diction)
|
||||
|
||||
|
||||
"""
|
||||
Verification des input acceptés
|
||||
"""
|
||||
field_list = ['token', 'class_id', 'session_id', 'tab_inscriptions_ids',]
|
||||
|
||||
|
||||
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', 'class_id', 'session_id', 'tab_inscriptions_ids',]
|
||||
|
||||
for val in field_list_obligatoire:
|
||||
if val not in diction:
|
||||
mycommon.myprint(
|
||||
str(inspect.stack()[0][3]) + " - La valeur '" + val + "' n'est pas presente dans liste ")
|
||||
return False, " Les informations fournies sont incorrectes"
|
||||
|
||||
"""
|
||||
Verification de l'identité et autorisation de l'entité qui
|
||||
appelle cette API
|
||||
"""
|
||||
token = ""
|
||||
if ("token" in diction.keys()):
|
||||
if diction['token']:
|
||||
token = diction['token']
|
||||
|
||||
local_status, my_partner = mycommon.Check_Connexion_And_Return_Partner_Data(diction)
|
||||
if (local_status is not True):
|
||||
return local_status, my_partner
|
||||
|
||||
# Verifier la validité de la session
|
||||
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'])})
|
||||
|
||||
# Verifier si la formartion est valide
|
||||
is_myclass_valide_count = MYSY_GV.dbname['myclass'].count_documents(
|
||||
{'_id': ObjectId(str(diction['class_id'])),
|
||||
'valide': '1',
|
||||
'locked': '0',
|
||||
'partner_owner_recid': str(my_partner['recid'])})
|
||||
|
||||
if (is_myclass_valide_count != 1):
|
||||
mycommon.myprint(
|
||||
str(inspect.stack()[0][3]) + " L'identifiant de la formation est invalide ")
|
||||
return False, " L'identifiant de la formation est invalide"
|
||||
|
||||
is_myclass_valide_data = MYSY_GV.dbname['myclass'].find_one(
|
||||
{'_id': ObjectId(str(diction['class_id'])),
|
||||
'valide': '1',
|
||||
'locked': '0',
|
||||
'partner_owner_recid': str(my_partner['recid'])})
|
||||
|
||||
"""
|
||||
Recuperer la liste des UE de la formation, avec leur credit et coeff.*
|
||||
"""
|
||||
tab_class_ue = []
|
||||
if( "list_unite_enseignement" in is_myclass_valide_data.keys() ):
|
||||
tab_class_ue = is_myclass_valide_data['list_unite_enseignement']
|
||||
|
||||
if(len(tab_class_ue) <= 0 ):
|
||||
mycommon.myprint(
|
||||
str(inspect.stack()[0][3]) + " Aucune unité d'enseignement pour cette formation ")
|
||||
return False, " Aucune unité d'enseignement pour cette formation "
|
||||
|
||||
|
||||
# Verifier la validité de la liste des inscrits fournie
|
||||
tab_inscriptions_ids = ""
|
||||
if ("tab_inscriptions_ids" in diction.keys()):
|
||||
if diction['tab_inscriptions_ids']:
|
||||
tab_inscriptions_ids = diction['tab_inscriptions_ids']
|
||||
|
||||
tab_inscriptions_ids_splited = str(tab_inscriptions_ids).split(",")
|
||||
|
||||
# Controle de validité de toutes info avant de commencer les traitements
|
||||
for my_inscription in tab_inscriptions_ids_splited:
|
||||
my_inscription = str(my_inscription).strip()
|
||||
|
||||
# Verifier que l'inscription est valide
|
||||
my_inscription_is_valide = MYSY_GV.dbname['inscription'].count_documents(
|
||||
{'_id': ObjectId(str(my_inscription)), 'status': '1',
|
||||
'partner_owner_recid': str(my_partner['recid'])})
|
||||
|
||||
if (my_inscription_is_valide != 1):
|
||||
mycommon.myprint(
|
||||
str(inspect.stack()[0][3]) + " L'inscription_id '" + my_inscription + "' n'est pas valide ")
|
||||
return False, " L'inscription_id '" + my_inscription + "' n'est pas valide "
|
||||
|
||||
"""
|
||||
La formule : [ UE * Coef (UE) ] / nb_coef
|
||||
"""
|
||||
|
||||
# Controle de validité de toutes info avant de commencer les traitements
|
||||
for my_inscription in tab_inscriptions_ids_splited:
|
||||
my_inscription = str(my_inscription).strip()
|
||||
|
||||
print(" ### pour l'inscrit = ", my_inscription)
|
||||
nb_coef = 0
|
||||
session_somme_note_with_coef = 0
|
||||
session_moyenne_note_with_coef = 0
|
||||
|
||||
for class_ue in tab_class_ue :
|
||||
for tmps_data in MYSY_GV.dbname['session_formation_final_note_classement'].find({'partner_owner_recid':str(my_partner['recid']),
|
||||
'ue_id':str(class_ue['_id']),
|
||||
'inscription_id':str(my_inscription),
|
||||
'valide':'1',
|
||||
'locked':'0'}):
|
||||
|
||||
|
||||
|
||||
coefficient = "1"
|
||||
if( "coefficient" in class_ue.keys() and class_ue['coefficient']):
|
||||
coefficient = class_ue['coefficient']
|
||||
|
||||
nb_coef = nb_coef + float(coefficient)
|
||||
|
||||
ue_note_with_coef = round( (float(tmps_data['note_finale'])*float(coefficient)), 2)
|
||||
session_somme_note_with_coef = round( (session_somme_note_with_coef + ue_note_with_coef), 2)
|
||||
|
||||
print(" ### nb_coef total = ", nb_coef)
|
||||
print(" ### session_somme_note_with_coef = ", session_somme_note_with_coef)
|
||||
session_moyenne_note_with_coef = round( (float(session_somme_note_with_coef) / float(nb_coef)), 2)
|
||||
print(" ### session_moyenne_note_with_coef = ", session_moyenne_note_with_coef)
|
||||
|
||||
# MAJ de la note glabale
|
||||
print(" MAJJ classement glabal sur l'inscription = ")
|
||||
MYSY_GV.dbname['inscription'].find_one_and_update(
|
||||
{'_id': ObjectId(str(my_inscription)),
|
||||
'partner_owner_recid': str(is_session_valide_data['partner_owner_recid']),
|
||||
'session_id':str(is_session_valide_data['_id']),
|
||||
'valide': '1',
|
||||
'locked': '0'
|
||||
|
||||
},
|
||||
{"$set": {'note_finale': str(session_moyenne_note_with_coef)}},
|
||||
return_document=ReturnDocument.AFTER,
|
||||
upsert=False,
|
||||
)
|
||||
|
||||
|
||||
"""
|
||||
Apres avoir saisi la note finale sur l'inscription, on va mettre à jour le rang
|
||||
"""
|
||||
classement = 0
|
||||
note_precedente = ""
|
||||
for sorted_data in MYSY_GV.dbname['inscription'].find(
|
||||
{'partner_owner_recid': str(is_session_valide_data['partner_owner_recid']),
|
||||
'session_id':str(is_session_valide_data['_id']),
|
||||
'valide': '1',
|
||||
'locked': '0' }).sort(
|
||||
[("note_finale", pymongo.DESCENDING), ]):
|
||||
|
||||
if( sorted_data and "note_finale" in sorted_data.keys() ):
|
||||
# Gestion des Execo
|
||||
if (str(note_precedente) != str(sorted_data['note_finale'])):
|
||||
classement = classement + 1
|
||||
note_precedente = str(sorted_data['note_finale'])
|
||||
|
||||
# MAJ du rang
|
||||
print(" MAJJ classement = ", classement)
|
||||
MYSY_GV.dbname['inscription'].find_one_and_update(
|
||||
{'_id': ObjectId(str(sorted_data['_id'])),
|
||||
'partner_owner_recid': str(sorted_data['partner_owner_recid']),
|
||||
'valide': '1',
|
||||
'locked': '0'
|
||||
|
||||
},
|
||||
{"$set": {'rang': str(classement), 'rang_calculation_date':str(datetime.now())}},
|
||||
return_document=ReturnDocument.AFTER,
|
||||
upsert=False,
|
||||
)
|
||||
|
||||
|
||||
return True, "Calcul Final Moyenne et Classement ok"
|
||||
|
||||
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 lancer Cacul_Session_Note_Finale_For_calcul_mode_1 "
|
||||
|
||||
|
||||
|
||||
"""
|
||||
Cette fonction retourne les données de 'base_calcul_note_class_and_ue' avec des filter
|
||||
"""
|
||||
def Get_List_base_calcul_note_class_and_ue_With_Filter(diction):
|
||||
try:
|
||||
diction = mycommon.strip_dictionary(diction)
|
||||
|
||||
"""
|
||||
Verification des input acceptés
|
||||
"""
|
||||
field_list = ['token','tab_related_collection', ]
|
||||
|
||||
incom_keys = diction.keys()
|
||||
for val in incom_keys:
|
||||
if val not in field_list and val.startswith('my_') is False:
|
||||
mycommon.myprint(str(
|
||||
inspect.stack()[0][3]) + " Le champ '" + val + "' n'existe pas")
|
||||
return False, " Les informations fournies sont incorrectes",
|
||||
|
||||
"""
|
||||
Verification des champs obligatoires
|
||||
"""
|
||||
field_list_obligatoire = ['token', ]
|
||||
for val in field_list_obligatoire:
|
||||
if val not in diction:
|
||||
mycommon.myprint(
|
||||
str(inspect.stack()[0][3]) + " - La valeur '" + val + "' n'est pas presente dans liste ")
|
||||
return False, " Les informations fournies sont incorrectes",
|
||||
|
||||
"""
|
||||
Verification de l'identité et autorisation de l'entité qui
|
||||
appelle cette API
|
||||
"""
|
||||
token = ""
|
||||
if ("token" in diction.keys()):
|
||||
if diction['token']:
|
||||
token = diction['token']
|
||||
|
||||
local_status, my_partner = mycommon.Check_Connexion_And_Return_Partner_Data(diction)
|
||||
if (local_status is not True):
|
||||
return local_status, my_partner
|
||||
|
||||
# Verifier la validité de la liste des inscrits fournie
|
||||
tab_related_collection_name = ""
|
||||
if ("tab_related_collection" in diction.keys()):
|
||||
if diction['tab_related_collection']:
|
||||
tab_related_collection_name = diction['tab_related_collection']
|
||||
|
||||
tab_related_collection_name_splited = str(tab_related_collection_name).split(",")
|
||||
|
||||
tab_partner_owner_recid = [str(my_partner['recid']), 'default']
|
||||
data_cle = {}
|
||||
data_cle['partner_owner_recid'] = {'$in':tab_partner_owner_recid}
|
||||
data_cle['valide'] = "1"
|
||||
data_cle['locked'] = "0"
|
||||
data_cle['related_collection'] = {'$in':tab_related_collection_name_splited}
|
||||
|
||||
|
||||
query = data_cle
|
||||
|
||||
RetObject = []
|
||||
val_tmp = 0
|
||||
|
||||
for retval in MYSY_GV.dbname['base_calcul_note_class_and_ue'].find(query).sort([("_id", pymongo.DESCENDING)]):
|
||||
user = retval
|
||||
user['id'] = str(val_tmp)
|
||||
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) + " - Line : " + str(exc_tb.tb_lineno))
|
||||
return False, " Impossible de récupérer la liste des base_calcul_note_class_and_ue "
|
||||
|
||||
|
||||
"""
|
||||
Fonction globale de calcul en prenant en entrée une session
|
||||
"""
|
||||
|
||||
|
||||
def Calcul_Note_Classement_Session(diction):
|
||||
try:
|
||||
diction = mycommon.strip_dictionary(diction)
|
||||
|
||||
"""
|
||||
Verification des input acceptés
|
||||
"""
|
||||
field_list = ['token','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'existe pas")
|
||||
return False, " Les informations fournies sont incorrectes",
|
||||
|
||||
"""
|
||||
Verification des champs obligatoires
|
||||
"""
|
||||
field_list_obligatoire = ['token', ]
|
||||
for val in field_list_obligatoire:
|
||||
if val not in diction:
|
||||
mycommon.myprint(
|
||||
str(inspect.stack()[0][3]) + " - La valeur '" + val + "' n'est pas presente dans liste ")
|
||||
return False, " Les informations fournies sont incorrectes",
|
||||
|
||||
"""
|
||||
Verification de l'identité et autorisation de l'entité qui
|
||||
appelle cette API
|
||||
"""
|
||||
token = ""
|
||||
if ("token" in diction.keys()):
|
||||
if diction['token']:
|
||||
token = diction['token']
|
||||
|
||||
local_status, my_partner = mycommon.Check_Connexion_And_Return_Partner_Data(diction)
|
||||
if (local_status is not True):
|
||||
return local_status, my_partner
|
||||
|
||||
|
||||
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'])})
|
||||
|
||||
print(" ### str(is_session_valide_data['class_internal_url']) = ", str(is_session_valide_data['class_internal_url']))
|
||||
|
||||
is_class_data = MYSY_GV.dbname['myclass'].find_one({'internal_url':str(is_session_valide_data['class_internal_url']),
|
||||
'valide':'1',
|
||||
'partner_owner_recid':str(my_partner['recid'])})
|
||||
|
||||
|
||||
class_function_note_calcul_rule = ""
|
||||
class_note_calcul_data = None
|
||||
if( is_class_data and "note_finale_calculation_rule_id" in is_class_data.keys() and is_class_data['note_finale_calculation_rule_id'] ):
|
||||
print(" ### note_finale_calculation_rule_id = ", is_class_data['note_finale_calculation_rule_id'])
|
||||
|
||||
|
||||
class_note_calcul_data = MYSY_GV.dbname['base_calcul_note_class_and_ue'].find_one({ 'valide':'1',
|
||||
'locked':'0',
|
||||
'_id':ObjectId(str(is_class_data['note_finale_calculation_rule_id']))})
|
||||
|
||||
|
||||
if ("fonction_name" in class_note_calcul_data.keys() and class_note_calcul_data['fonction_name']):
|
||||
|
||||
print(" Traitement fonction = ", class_note_calcul_data['fonction_name'])
|
||||
|
||||
possibles = globals().copy()
|
||||
possibles.update(locals())
|
||||
cron_function = possibles.get(class_note_calcul_data['fonction_name'])
|
||||
|
||||
if not cron_function:
|
||||
mycommon.myprint(str(
|
||||
inspect.stack()[0][3]) + " Fonction '" + str(class_note_calcul_data['job_name']) + "' est introuvable")
|
||||
|
||||
|
||||
local_con_status, local_con_retval = cron_function()
|
||||
|
||||
|
||||
print(" ### class_note_calcul_data = ", class_note_calcul_data)
|
||||
RetObject = []
|
||||
|
||||
|
||||
return True, "OK"
|
||||
|
||||
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 base_calcul_note_class_and_ue "
|
||||
|
||||
|
|
88
class_mgt.py
88
class_mgt.py
|
@ -59,7 +59,8 @@ def add_class(diction):
|
|||
'programme', 'prerequis', 'note', 'cpf', 'certif', 'class_inscription_url', 'pourqui',
|
||||
'support', 'img_banner_detail_class', 'source', 'lms_class_code', 'formateur_id',
|
||||
'class_level', 'methode_pedagogique', 'condition_handicape', 'suivi_eval', 'class_id',
|
||||
'version', 'categorie', 'recyclage_delai', 'recyclage_periodicite', 'recyclage_alert', 'contenu_attestation']
|
||||
'version', 'categorie', 'recyclage_delai', 'recyclage_periodicite', 'recyclage_alert',
|
||||
'contenu_attestation', 'note_finale_calculation_rule_id']
|
||||
|
||||
incom_keys = diction.keys()
|
||||
for val in incom_keys:
|
||||
|
@ -263,6 +264,22 @@ def add_class(diction):
|
|||
|
||||
mydata['recyclage_periodicite'] = str(recyclage_periodicite)
|
||||
|
||||
note_finale_calculation_rule_id = ""
|
||||
if( "note_finale_calculation_rule_id" in diction.keys() and diction['note_finale_calculation_rule_id']):
|
||||
is_valide_calculation_rule_id_count = MYSY_GV.dbname['base_calcul_note_class_and_ue'].count_documents({'_id':ObjectId(str(diction['note_finale_calculation_rule_id'])),
|
||||
'valide':'1',
|
||||
'locked':'0'})
|
||||
|
||||
if(is_valide_calculation_rule_id_count != 1):
|
||||
mycommon.myprint(str(
|
||||
inspect.stack()[0][
|
||||
3]) + " L'identifiant de la règle de calcul de la note finale est invalide ")
|
||||
return False, " L'identifiant de la règle de calcul de la note finale est invalide ", False
|
||||
|
||||
note_finale_calculation_rule_id = str(diction['note_finale_calculation_rule_id'])
|
||||
|
||||
mydata['note_finale_calculation_rule_id'] = str(note_finale_calculation_rule_id)
|
||||
|
||||
|
||||
class_level = "0"
|
||||
if ("class_level" in diction.keys()):
|
||||
|
@ -790,7 +807,8 @@ def update_class(diction):
|
|||
'cpf', 'certif', 'class_inscription_url','pourqui', 'support', 'img_banner_detail_class',
|
||||
'duration_unit', 'source', 'lms_class_code', 'formateur_id', 'class_level','methode_pedagogique',
|
||||
'condition_handicape', 'suivi_eval', 'class_id', 'version', 'categorie', 'recyclage_delai',
|
||||
'recyclage_periodicite', 'recyclage_alert', 'contenu_attestation']
|
||||
'recyclage_periodicite', 'recyclage_alert', 'contenu_attestation',
|
||||
'note_finale_calculation_rule_id']
|
||||
|
||||
incom_keys = diction.keys()
|
||||
for val in incom_keys:
|
||||
|
@ -803,7 +821,7 @@ def update_class(diction):
|
|||
Une fois qu'on a controlé que toutes les clés mise dans l'API sont correcte. etape precedente,
|
||||
On controle que les champs obligatoires sont presents dans la liste
|
||||
'''
|
||||
field_list_obligatoire = ['internal_url', 'token']
|
||||
field_list_obligatoire = ['internal_url', 'token', 'class_id']
|
||||
|
||||
for val in field_list_obligatoire:
|
||||
if val not in diction:
|
||||
|
@ -912,6 +930,24 @@ def update_class(diction):
|
|||
mydata['recyclage_periodicite'] = str(recyclage_periodicite)
|
||||
|
||||
|
||||
if ("note_finale_calculation_rule_id" in diction.keys() ):
|
||||
|
||||
if( diction['note_finale_calculation_rule_id'] ):
|
||||
is_valide_calculation_rule_id_count = MYSY_GV.dbname['base_calcul_note_class_and_ue'].count_documents(
|
||||
{'_id': ObjectId(str(diction['note_finale_calculation_rule_id'])),
|
||||
'valide': '1',
|
||||
'locked': '0'})
|
||||
|
||||
if (is_valide_calculation_rule_id_count != 1):
|
||||
mycommon.myprint(str(
|
||||
inspect.stack()[0][
|
||||
3]) + " L'identifiant de la règle de calcul de la note finale est invalide ")
|
||||
return False, " L'identifiant de la règle de calcul de la note finale est invalide ", False
|
||||
|
||||
mydata['note_finale_calculation_rule_id']= str(diction['note_finale_calculation_rule_id'])
|
||||
|
||||
else:
|
||||
mydata['note_finale_calculation_rule_id'] = ""
|
||||
|
||||
source = ""
|
||||
if ("source" in diction.keys()):
|
||||
|
@ -1304,6 +1340,12 @@ def update_class(diction):
|
|||
#print(" ### mydata = ", mydata)
|
||||
|
||||
# seules les formations avec locked = 0 et valide=1 sont modifiables
|
||||
print(" QRY = ", {'internal_url': str(my_internal_url), 'partner_owner_recid':partner_recid, 'locked': '0', 'valide': '1',
|
||||
'_id':ObjectId(str(diction['class_id']))})
|
||||
|
||||
|
||||
print(" MY DATA = " , mydata)
|
||||
|
||||
ret_val = coll_name.find_one_and_update({'internal_url': str(my_internal_url), 'partner_owner_recid':partner_recid, 'locked': '0', 'valide': '1',
|
||||
'_id':ObjectId(str(diction['class_id']))},
|
||||
{"$set": mydata},
|
||||
|
@ -2468,6 +2510,9 @@ def get_class(diction):
|
|||
if ("recyclage_periodicite" not in user.keys()):
|
||||
user['recyclage_periodicite'] = ""
|
||||
|
||||
if ("note_finale_calculation_rule_id" not in user.keys()):
|
||||
user['note_finale_calculation_rule_id'] = ""
|
||||
|
||||
"""
|
||||
15/09/2024 :
|
||||
Si la formation a des unité d'enseignements rattaché,
|
||||
|
@ -2911,6 +2956,8 @@ def get_class_for_partner_catalog(diction):
|
|||
if ("recyclage_periodicite" not in user.keys()):
|
||||
user['recyclage_periodicite'] = ""
|
||||
|
||||
if ("note_finale_calculation_rule_id" not in user.keys()):
|
||||
user['note_finale_calculation_rule_id'] = ""
|
||||
|
||||
RetObject.append(JSONEncoder().encode(user))
|
||||
|
||||
|
@ -3026,6 +3073,9 @@ def get_class_coup_de_coeur(diction):
|
|||
if ("recyclage_periodicite" not in user.keys()):
|
||||
user['recyclage_periodicite'] = ""
|
||||
|
||||
if ("note_finale_calculation_rule_id" not in user.keys()):
|
||||
user['note_finale_calculation_rule_id'] = ""
|
||||
|
||||
RetObject.append(JSONEncoder().encode(user))
|
||||
|
||||
return True, RetObject
|
||||
|
@ -3255,6 +3305,8 @@ def get_partner_class(diction):
|
|||
if ("recyclage_periodicite" not in retVal.keys()):
|
||||
retVal['recyclage_periodicite'] = ""
|
||||
|
||||
if ("note_finale_calculation_rule_id" not in retVal.keys()):
|
||||
retVal['note_finale_calculation_rule_id'] = ""
|
||||
|
||||
# Recuperation des données du formateur
|
||||
formateur_nom_prenom = ""
|
||||
|
@ -3544,6 +3596,9 @@ def find_partner_class_like(diction):
|
|||
retVal['recyclage_periodicite'] = ""
|
||||
|
||||
|
||||
if ("note_finale_calculation_rule_id" not in retVal.keys()):
|
||||
retVal['note_finale_calculation_rule_id'] = ""
|
||||
|
||||
# Recuperer le nombre de session pour cette formation
|
||||
nb_session_formation_count = MYSY_GV.dbname['session_formation'].count_documents(
|
||||
{'class_internal_url': str(retVal['internal_url']),
|
||||
|
@ -3808,6 +3863,9 @@ def get_partner_class_external_code(diction):
|
|||
if ("recyclage_periodicite" not in user.keys()):
|
||||
user['recyclage_periodicite'] = ""
|
||||
|
||||
if ("note_finale_calculation_rule_id" not in user.keys()):
|
||||
user['note_finale_calculation_rule_id'] = ""
|
||||
|
||||
user['id'] = str(val_tmp)
|
||||
|
||||
'''
|
||||
|
@ -5105,6 +5163,9 @@ def get_class_by_metier(diction):
|
|||
if ("recyclage_periodicite" not in user.keys()):
|
||||
user['recyclage_periodicite'] = ""
|
||||
|
||||
if ("note_finale_calculation_rule_id" not in user.keys()):
|
||||
user['note_finale_calculation_rule_id'] = ""
|
||||
|
||||
RetObject.append(JSONEncoder().encode(user))
|
||||
# print(" 22222 ")
|
||||
retVal_for_stat = retVal
|
||||
|
@ -5897,6 +5958,11 @@ def get_Class_From_Internal_Url(diction):
|
|||
|
||||
if ("recyclage_periodicite" not in user.keys()):
|
||||
user['recyclage_periodicite'] = ""
|
||||
|
||||
if ("note_finale_calculation_rule_id" not in user.keys()):
|
||||
user['note_finale_calculation_rule_id'] = ""
|
||||
|
||||
|
||||
val_tmp = val_tmp + 1
|
||||
RetObject.append(mycommon.JSONEncoder().encode(user))
|
||||
|
||||
|
@ -5968,6 +6034,11 @@ def get_Class_From_Url(diction):
|
|||
|
||||
if ("recyclage_periodicite" not in user.keys()):
|
||||
user['recyclage_periodicite'] = ""
|
||||
|
||||
if ("note_finale_calculation_rule_id" not in user.keys()):
|
||||
user['note_finale_calculation_rule_id'] = ""
|
||||
|
||||
|
||||
user['id'] = str(val_tmp)
|
||||
val_tmp = val_tmp + 1
|
||||
RetObject.append(mycommon.JSONEncoder().encode(user))
|
||||
|
@ -6565,7 +6636,8 @@ 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', ]
|
||||
field_list = ['token', 'class_id', 'ue_id', 'credit', 'pres_dist_hyp', 'is_noted',
|
||||
'coefficient', 'seuil_validation' ]
|
||||
|
||||
incom_keys = diction.keys()
|
||||
for val in incom_keys:
|
||||
|
@ -6692,6 +6764,7 @@ def Add_Update_UE_To_Class(diction):
|
|||
if (is_ue_id_existe_class > 0):
|
||||
|
||||
# L'UE existe dans la formation, on autorise la mise à jour
|
||||
|
||||
update = MYSY_GV.dbname['myclass'].update_one({'_id': ObjectId(str(diction['class_id'])),
|
||||
'partner_owner_recid': str(
|
||||
my_partner['recid']),
|
||||
|
@ -6709,6 +6782,10 @@ def Add_Update_UE_To_Class(diction):
|
|||
diction['is_noted']),
|
||||
'list_unite_enseignement.$[xxx].date_update': str(
|
||||
datetime.now()),
|
||||
'list_unite_enseignement.$[xxx].coefficient': str(
|
||||
diction['coefficient']),
|
||||
'list_unite_enseignement.$[xxx].seuil_validation': str(
|
||||
diction['seuil_validation']),
|
||||
'list_unite_enseignement.$[xxx].update_by': str(
|
||||
my_partner['_id']),
|
||||
}
|
||||
|
@ -6750,6 +6827,9 @@ def Add_Update_UE_To_Class(diction):
|
|||
new_data['pres_dist_hyp'] = str(diction['pres_dist_hyp'])
|
||||
new_data['is_noted'] = str(diction['is_noted'])
|
||||
|
||||
new_data['coefficient'] = str(diction['coefficient'])
|
||||
new_data['seuil_validation'] = str(diction['seuil_validation'])
|
||||
|
||||
new_data['_id'] = str(diction['ue_id'])
|
||||
|
||||
insert = MYSY_GV.dbname['myclass'].update_one({'_id': ObjectId(str(diction['class_id'])),
|
||||
|
|
60
main.py
60
main.py
|
@ -9815,7 +9815,7 @@ API pour mettre à jour une unité d'enseignement (UE)
|
|||
def Update_Unite_Enseignement():
|
||||
# On recupere le corps (payload) de la requete
|
||||
payload = mycommon.strip_dictionary (request.form.to_dict())
|
||||
print(" ### Update_Unite_Enseignement payload = ",payload)
|
||||
print(" ### Update_Unite_Enseignement payload (trop lg cherif) = ")
|
||||
status, retval = unite_enseignement_mgt.Update_Unite_Enseignement(payload)
|
||||
return jsonify(status=status, message=retval)
|
||||
|
||||
|
@ -12171,13 +12171,13 @@ def Add_Update_Equipe_Team_Membres():
|
|||
"""
|
||||
API de PRE PRE PRE calcul de la note finale
|
||||
"""
|
||||
@app.route('/myclass/api/run_pre_calcul_moyenne_somme', methods=['POST','GET'])
|
||||
@app.route('/myclass/api/run_ue_pre_calcul_moyenne_somme', methods=['POST','GET'])
|
||||
@crossdomain(origin='*')
|
||||
def run_pre_calcul_moyenne_somme():
|
||||
def run_ue_pre_calcul_moyenne_somme():
|
||||
# On recupere le corps (payload) de la requete
|
||||
payload = mycommon.strip_dictionary(request.form.to_dict())
|
||||
print(" ### run_pre_calcul_moyenne_somme : payload = ",payload)
|
||||
localStatus, message= base_class_calcul_note.run_pre_calcul_moyenne_somme(payload)
|
||||
print(" ### run_ue_pre_calcul_moyenne_somme : payload = ",payload)
|
||||
localStatus, message= base_class_calcul_note.run_ue_pre_calcul_moyenne_somme(payload)
|
||||
return jsonify(status=localStatus, message=message )
|
||||
|
||||
|
||||
|
@ -12213,19 +12213,59 @@ def Get_List_Evaluation_Final_Note_Classement_With_Filter():
|
|||
|
||||
|
||||
"""
|
||||
API de calcul de la note finale d'une formation avec le model : calcul_mode_1
|
||||
API de calcul de la note finale d'une UE avec le model : UE_calcul_mode_1
|
||||
"""
|
||||
@app.route('/myclass/api/Cacul_Note_Finale_For_calcul_mode_1', methods=['POST','GET'])
|
||||
@app.route('/myclass/api/Cacul_UE_Note_Finale_For_calcul_mode_1', methods=['POST','GET'])
|
||||
@crossdomain(origin='*')
|
||||
def Cacul_Note_Finale_For_calcul_mode_1():
|
||||
def Cacul_UE_Note_Finale_For_calcul_mode_1():
|
||||
# On recupere le corps (payload) de la requete
|
||||
payload = mycommon.strip_dictionary(request.form.to_dict())
|
||||
print(" ### Cacul_Note_Finale_For_calcul_mode_1 : payload = ",payload)
|
||||
localStatus, message= base_class_calcul_note.Cacul_Note_Finale_For_calcul_mode_1(payload)
|
||||
print(" ### Cacul_UE_Note_Finale_For_calcul_mode_1 : payload = ",payload)
|
||||
localStatus, message= base_class_calcul_note.Cacul_UE_Note_Finale_For_calcul_mode_1(payload)
|
||||
return jsonify(status=localStatus, message=message )
|
||||
|
||||
|
||||
|
||||
"""
|
||||
API de calcul de la note finale d'une formation avec le model : class_calcul_mode_1
|
||||
"""
|
||||
@app.route('/myclass/api/Cacul_Session_Note_Finale_For_calcul_mode_1', methods=['POST','GET'])
|
||||
@crossdomain(origin='*')
|
||||
def Cacul_Session_Note_Finale_For_calcul_mode_1():
|
||||
# On recupere le corps (payload) de la requete
|
||||
payload = mycommon.strip_dictionary(request.form.to_dict())
|
||||
print(" ### Cacul_Session_Note_Finale_For_calcul_mode_1 : payload = ",payload)
|
||||
localStatus, message= base_class_calcul_note.Cacul_Session_Note_Finale_For_calcul_mode_1(payload)
|
||||
return jsonify(status=localStatus, message=message )
|
||||
|
||||
|
||||
"""
|
||||
API recupere la liste des formule de calcul avec un filtre que cela concerne 'myclass', ou 'unite_enseignement', ou les 2
|
||||
"""
|
||||
@app.route('/myclass/api/Get_List_base_calcul_note_class_and_ue_With_Filter', methods=['POST','GET'])
|
||||
@crossdomain(origin='*')
|
||||
def Get_List_base_calcul_note_class_and_ue_With_Filter():
|
||||
# On recupere le corps (payload) de la requete
|
||||
payload = mycommon.strip_dictionary(request.form.to_dict())
|
||||
print(" ### Get_List_base_calcul_note_class_and_ue_With_Filter : payload = ",payload)
|
||||
localStatus, message= base_class_calcul_note.Get_List_base_calcul_note_class_and_ue_With_Filter(payload)
|
||||
return jsonify(status=localStatus, message=message )
|
||||
|
||||
|
||||
|
||||
"""
|
||||
API qui prend une session de formation et lance le calcul des notes et moyenne
|
||||
"""
|
||||
@app.route('/myclass/api/Calcul_Note_Classement_Session', methods=['POST','GET'])
|
||||
@crossdomain(origin='*')
|
||||
def Calcul_Note_Classement_Session():
|
||||
# On recupere le corps (payload) de la requete
|
||||
payload = mycommon.strip_dictionary(request.form.to_dict())
|
||||
print(" ### Calcul_Note_Classement_Session : payload = ",payload)
|
||||
localStatus, message= base_class_calcul_note.Calcul_Note_Classement_Session(payload)
|
||||
return jsonify(status=localStatus, message=message )
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
print(" debut api")
|
||||
context = SSL.Context(SSL.SSLv23_METHOD)
|
||||
|
|
|
@ -65,7 +65,7 @@ def Add_Unite_Enseignement(diction):
|
|||
field_list = ['token', 'code', 'titre', 'description', 'objectif', 'prerequis', 'programme', 'methode_pedagogique', 'methode_evaluation',
|
||||
'support', 'duration', 'duration_unite', 'domain_id', 'bloc' ,
|
||||
'ects', 'seuil_validation', 'niveau_competence', 'vh_cm', 'vh_tp', 'vh_tpg',
|
||||
'vh_td', 'semestre']
|
||||
'vh_td', 'semestre', 'note_ue_calculation_rule_id']
|
||||
|
||||
incom_keys = diction.keys()
|
||||
for val in incom_keys:
|
||||
|
@ -137,8 +137,17 @@ def Add_Unite_Enseignement(diction):
|
|||
str(inspect.stack()[0][3]) + " La durée est invalide ")
|
||||
return False, " La durée est invalide "
|
||||
|
||||
if ("note_ue_calculation_rule_id" in diction.keys() and diction['note_ue_calculation_rule_id']):
|
||||
is_valide_calculation_rule_id_count = MYSY_GV.dbname['base_calcul_note_class_and_ue'].count_documents(
|
||||
{'_id': ObjectId(str(diction['note_ue_calculation_rule_id'])),
|
||||
'valide': '1',
|
||||
'locked': '0'})
|
||||
|
||||
|
||||
if (is_valide_calculation_rule_id_count != 1):
|
||||
mycommon.myprint(str(
|
||||
inspect.stack()[0][
|
||||
3]) + " L'identifiant de la règle de calcul de la note de l'UE est invalide ")
|
||||
return False, " L'identifiant de la règle de calcul de la note de l'UE est invalide "
|
||||
|
||||
mydata['date_update'] = str(datetime.now())
|
||||
mydata['update_by'] = str(my_partner['_id'])
|
||||
|
@ -179,7 +188,7 @@ def Update_Unite_Enseignement(diction):
|
|||
field_list = ['token', '_id', 'code', 'titre', 'description', 'objectif', 'prerequis', 'programme',
|
||||
'methode_pedagogique', 'methode_evaluation', 'support', 'duration', 'duration_unite',
|
||||
'domain_id', 'bloc', 'ects', 'seuil_validation', 'niveau_competence',
|
||||
'vh_cm', 'vh_tp', 'vh_tpg', 'vh_td', 'semestre']
|
||||
'vh_cm', 'vh_tp', 'vh_tpg', 'vh_td', 'semestre', 'note_ue_calculation_rule_id']
|
||||
|
||||
incom_keys = diction.keys()
|
||||
for val in incom_keys:
|
||||
|
@ -231,6 +240,19 @@ def Update_Unite_Enseignement(diction):
|
|||
return False, " L'identifiant de l'UE est invalide "
|
||||
|
||||
|
||||
if ("note_ue_calculation_rule_id" in diction.keys() and diction['note_ue_calculation_rule_id']):
|
||||
is_valide_calculation_rule_id_count = MYSY_GV.dbname['base_calcul_note_class_and_ue'].count_documents(
|
||||
{'_id': ObjectId(str(diction['note_ue_calculation_rule_id'])),
|
||||
'valide': '1',
|
||||
'locked': '0'})
|
||||
|
||||
if (is_valide_calculation_rule_id_count != 1):
|
||||
mycommon.myprint(str(
|
||||
inspect.stack()[0][
|
||||
3]) + " L'identifiant de la règle de calcul de la note de l'UE est invalide ")
|
||||
return False, " L'identifiant de la règle de calcul de la note de l'UE est invalide "
|
||||
|
||||
|
||||
"""
|
||||
Si on veut modidier le code, verifier que le nouveau code n'est pas deja prix
|
||||
"""
|
||||
|
@ -735,6 +757,14 @@ 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']
|
||||
|
||||
eu_class_seuil_validation = ""
|
||||
if ("seuil_validation" in local_val.keys() and local_val['seuil_validation']):
|
||||
eu_class_seuil_validation = local_val['seuil_validation']
|
||||
|
||||
|
||||
user = local_val
|
||||
|
||||
|
@ -767,6 +797,20 @@ def Get_List_Unite_Enseignement_Of_Given_Class(diction):
|
|||
else:
|
||||
user['duration_concat'] = str(ue_data['duration']) + " ?"
|
||||
|
||||
# On ecrase les données si il y a les meme données sur la formation
|
||||
if (eu_class_coef ):
|
||||
user['coefficient'] = str(eu_class_coef)
|
||||
|
||||
if (eu_class_seuil_validation):
|
||||
user['seuil_validation'] = str(eu_class_seuil_validation)
|
||||
|
||||
|
||||
# Si il n'y a pas les infos dans les 2 cas, alors on met une valeur par defaut
|
||||
if( "coefficient" not in user.keys()):
|
||||
user['coefficient'] = "1"
|
||||
|
||||
if ("seuil_validation" not in user.keys()):
|
||||
user['seuil_validation'] = "99"
|
||||
|
||||
|
||||
RetObject.append(mycommon.JSONEncoder().encode(user))
|
||||
|
|
Loading…
Reference in New Issue