Compare commits
2 Commits
2708bc74bd
...
638b9d8fc3
Author | SHA1 | Date |
---|---|---|
|
638b9d8fc3 | |
|
5c3ce1ec80 |
|
@ -1,10 +1,14 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="ChangeListManager">
|
||||
<list default="true" id="c6d0259a-16e1-410d-91a1-830590ee2a08" name="Changes" comment="03/05/2025 - 20h">
|
||||
<list default="true" id="c6d0259a-16e1-410d-91a1-830590ee2a08" name="Changes" comment="05/05/2025 - 20h">
|
||||
<change afterPath="$PROJECT_DIR$/jury_mgt.py" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/Log/log_file.log" beforeDir="false" afterPath="$PROJECT_DIR$/Log/log_file.log" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/base_class_calcul_note.py" beforeDir="false" afterPath="$PROJECT_DIR$/base_class_calcul_note.py" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/equipe_team_mgt.py" beforeDir="false" afterPath="$PROJECT_DIR$/equipe_team_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,20 +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" />
|
||||
<option name="presentableId" value="LOCAL-00404" />
|
||||
<option name="project" value="LOCAL" />
|
||||
<updated>1728145402808</updated>
|
||||
</task>
|
||||
<task id="LOCAL-00405" summary="07/10/2024 - 20h30">
|
||||
<created>1728325045729</created>
|
||||
<option name="number" value="00405" />
|
||||
|
@ -424,7 +414,21 @@
|
|||
<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>
|
||||
<task id="LOCAL-00453" summary="05/05/2025 - 20h">
|
||||
<created>1746464819661</created>
|
||||
<option name="number" value="00453" />
|
||||
<option name="presentableId" value="LOCAL-00453" />
|
||||
<option name="project" value="LOCAL" />
|
||||
<updated>1746464819662</updated>
|
||||
</task>
|
||||
<option name="localTasksCounter" value="454" />
|
||||
<servers />
|
||||
</component>
|
||||
<component name="Vcs.Log.Tabs.Properties">
|
||||
|
@ -466,7 +470,6 @@
|
|||
</option>
|
||||
</component>
|
||||
<component name="VcsManagerConfiguration">
|
||||
<MESSAGE value="31/12/2024 - 12h30" />
|
||||
<MESSAGE value="03/01/2025 - 17h30" />
|
||||
<MESSAGE value="04/01/2025 - 14h48" />
|
||||
<MESSAGE value="16/01/2025 - 16h30" />
|
||||
|
@ -491,6 +494,7 @@
|
|||
<MESSAGE value="30/04/2025 - 15h" />
|
||||
<MESSAGE value="02/05/2025 - 20h" />
|
||||
<MESSAGE value="03/05/2025 - 20h" />
|
||||
<option name="LAST_COMMIT_MESSAGE" value="03/05/2025 - 20h" />
|
||||
<MESSAGE value="05/05/2025 - 20h" />
|
||||
<option name="LAST_COMMIT_MESSAGE" value="05/05/2025 - 20h" />
|
||||
</component>
|
||||
</project>
|
|
@ -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
|
||||
|
|
5614
Log/log_file.log
5614
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 "
|
||||
|
||||
|
||||
|
||||
|
@ -909,9 +947,9 @@ def Get_List_Evaluation_Final_Note_Classement_Detail_With_Filter(diction):
|
|||
|
||||
|
||||
"""
|
||||
Recuperation des notes finales avec le classement
|
||||
Recuperation des notes et le classement par unité d'enseignement (UE)
|
||||
"""
|
||||
def Get_List_Evaluation_Final_Note_Classement_With_Filter(diction):
|
||||
def Get_List_Evaluation_UE_Note_Classement_With_Filter(diction):
|
||||
try:
|
||||
diction = mycommon.strip_dictionary(diction)
|
||||
|
||||
|
@ -1042,3 +1080,599 @@ 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 "
|
||||
|
||||
|
||||
|
||||
"""
|
||||
Recuperation des notes et le classement par Inscription (donc le classement et moyenne definitive)
|
||||
"""
|
||||
def Get_List_Evaluation_Inscriptio_Note_Classement_With_Filter(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','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 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
|
||||
|
||||
|
||||
"""
|
||||
Clés de mise à jour
|
||||
"""
|
||||
data_cle = {}
|
||||
data_cle['partner_owner_recid'] = str(my_partner['recid'])
|
||||
data_cle['valide'] = "1"
|
||||
data_cle['session_id'] = str(diction['session_id'])
|
||||
|
||||
RetObject = []
|
||||
val_tmp = 0
|
||||
|
||||
for retval in MYSY_GV.dbname['inscription'].find(data_cle).sort([("rang", pymongo.ASCENDING),("note_finale", pymongo.DESCENDING),
|
||||
("nom", 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 les classement pour la collection 'inscription' "
|
||||
|
||||
|
||||
|
||||
"""
|
||||
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
|
||||
|
||||
session_somme_credit_acquis = 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)
|
||||
|
||||
"""
|
||||
Si l'UE est validée, alors on attribut le credit comme validé
|
||||
"""
|
||||
if ("ue_validation" in tmps_data.keys() and str(tmps_data['ue_validation']) == "1" ):
|
||||
if( "credit" in tmps_data.keys() and tmps_data['credit']):
|
||||
session_somme_credit_acquis = round( (float(session_somme_credit_acquis) + float(tmps_data['credit'])), 2)
|
||||
|
||||
print(" ### session_somme_credit_acquis total = ", session_somme_credit_acquis)
|
||||
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),
|
||||
'credit_acquis':str(session_somme_credit_acquis)}},
|
||||
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'])})
|
||||
|
||||
tab_inscrit_id = []
|
||||
for inscrit in MYSY_GV.dbname['inscription'].find({'valide':'1',
|
||||
'partner_owner_recid':str(my_partner['recid']),
|
||||
'session_id':str(is_session_valide_data['_id'])}):
|
||||
tab_inscrit_id.append(str(inscrit['_id']))
|
||||
|
||||
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'])})
|
||||
|
||||
|
||||
"""
|
||||
Preparation des calculs
|
||||
"""
|
||||
|
||||
# On recupere la liste des ue_id de la formation
|
||||
tab_ue_id = []
|
||||
for class_class_ue_data in is_class_data['list_unite_enseignement'] :
|
||||
tab_ue_id.append( str(class_class_ue_data['_id']))
|
||||
|
||||
|
||||
local_diction = {}
|
||||
local_diction['token'] = str(diction['token'])
|
||||
local_diction['class_id'] = str(is_class_data['_id'])
|
||||
local_diction['session_id'] = str(diction['session_id'])
|
||||
|
||||
|
||||
list_inscrit_id = ",".join(tab_ue_id)
|
||||
local_diction['tab_ue_ids'] = str(list_inscrit_id)
|
||||
|
||||
list_inscrit_id = ",".join(tab_inscrit_id)
|
||||
local_diction['tab_inscriptions_ids'] = str(list_inscrit_id)
|
||||
|
||||
print('### local_diction 01010 =', local_diction)
|
||||
|
||||
local_status, local_retval = run_ue_pre_calcul_moyenne_somme(local_diction)
|
||||
|
||||
if( local_status is False ):
|
||||
mycommon.myprint(str(
|
||||
inspect.stack()[0][3]) + " Impossible d'initialiser les calculs (fonction :run_ue_pre_calcul_moyenne_somme ) ")
|
||||
return False, " Impossible d'initialiser les calculs ",
|
||||
|
||||
|
||||
"""
|
||||
Pour Chaque UE de l'enseignement aller chercher le 'note_ue_calculation_rule_id', puis la formule de calcul associée
|
||||
"""
|
||||
for class_class_ue_data in is_class_data['list_unite_enseignement'] :
|
||||
|
||||
unite_enseignement_data = MYSY_GV.dbname['unite_enseignement'].find_one(
|
||||
{'_id': ObjectId(str(class_class_ue_data['_id'])),
|
||||
'valide': '1',
|
||||
'locked': '0',
|
||||
})
|
||||
|
||||
|
||||
note_ue_calculation_rule_id = ""
|
||||
if( "note_ue_calculation_rule_id" in unite_enseignement_data.keys() and unite_enseignement_data['note_ue_calculation_rule_id']):
|
||||
|
||||
note_ue_calculation_rule_id = unite_enseignement_data['note_ue_calculation_rule_id']
|
||||
|
||||
if( note_ue_calculation_rule_id == ""):
|
||||
mycommon.myprint(
|
||||
str(inspect.stack()[0][3]) + " L'unité d'enseignement "+str(unite_enseignement_data['code'])+" n'a pas de règle de calcul de la note")
|
||||
return False, " L'unité d'enseignement "+str(unite_enseignement_data['code'])+" n'a pas de règle de calcul de la note"
|
||||
|
||||
base_calcul_note_class_and_ue_data = MYSY_GV.dbname['base_calcul_note_class_and_ue'].find_one({'_id':ObjectId(str(unite_enseignement_data['note_ue_calculation_rule_id'])),
|
||||
'valide':'1',
|
||||
'locked':'0',
|
||||
'related_collection':'unite_enseignement'})
|
||||
|
||||
ue_calcul_fonction_name = ""
|
||||
if ("fonction_name" in base_calcul_note_class_and_ue_data.keys() and base_calcul_note_class_and_ue_data['fonction_name']):
|
||||
ue_calcul_fonction_name = base_calcul_note_class_and_ue_data['fonction_name']
|
||||
|
||||
if (ue_calcul_fonction_name == ""):
|
||||
mycommon.myprint(
|
||||
str(inspect.stack()[0][3]) + " L'unité d'enseignement " + str(
|
||||
unite_enseignement_data['code']) + " n'a pas de règle de calcul de la note (2) ")
|
||||
return False, " L'unité d'enseignement " + str(
|
||||
unite_enseignement_data['code']) + " n'a pas de règle de calcul de la note (2) "
|
||||
|
||||
print(" ### Pour l'UE : ",str(unite_enseignement_data['code']),
|
||||
" Coef : ", class_class_ue_data['coefficient'],
|
||||
" seuil validation : ", class_class_ue_data['seuil_validation'])
|
||||
|
||||
print(" ### la formule de calcul est : ", base_calcul_note_class_and_ue_data['fonction_name'])
|
||||
|
||||
#field_list = ['token', 'class_id', 'session_id', 'ue_id', 'tab_inscriptions_ids',]
|
||||
local_node = {}
|
||||
local_node['token'] = str(diction['token'])
|
||||
local_node['class_id'] = str(is_class_data['_id'])
|
||||
local_node['session_id'] = str(diction['session_id'])
|
||||
local_node['ue_id'] = str(unite_enseignement_data['_id'])
|
||||
|
||||
list_inscrit_id = ",".join(tab_inscrit_id)
|
||||
local_node['tab_inscriptions_ids'] = str(list_inscrit_id)
|
||||
|
||||
|
||||
possibles = globals().copy()
|
||||
possibles.update(locals())
|
||||
cron_function = possibles.get(base_calcul_note_class_and_ue_data['fonction_name'])
|
||||
|
||||
if not cron_function:
|
||||
mycommon.myprint(str(
|
||||
inspect.stack()[0][3]) + " Fonction '" + str(base_calcul_note_class_and_ue_data['fonction_name']) + "' est introuvable")
|
||||
|
||||
print(" Exécution de la fonction : UE de Session = ", base_calcul_note_class_and_ue_data['fonction_name'])
|
||||
local_status, local_retval = cron_function(local_node)
|
||||
|
||||
|
||||
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 niveau SESSION = ", 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")
|
||||
|
||||
#field_list = ['token', 'class_id', 'session_id', 'tab_inscriptions_ids', ]
|
||||
|
||||
local_node = {}
|
||||
local_node['token'] = str(diction['token'])
|
||||
local_node['class_id'] = str(is_class_data['_id'])
|
||||
local_node['session_id'] = str(diction['session_id'])
|
||||
|
||||
list_inscrit_id = ",".join(tab_inscrit_id)
|
||||
local_node['tab_inscriptions_ids'] = str(list_inscrit_id)
|
||||
|
||||
local_con_status, local_con_retval = cron_function(local_node)
|
||||
|
||||
|
||||
print(" ### class_note_calcul_data = ", class_note_calcul_data)
|
||||
RetObject = []
|
||||
|
||||
|
||||
return True, "Le calcul des notes est 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 le calcul des notes "
|
||||
|
||||
|
|
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'])),
|
||||
|
|
|
@ -363,7 +363,7 @@ def Add_Update_Equipe_Team_Membres(diction):
|
|||
Cette fonction permet de supprimer des membres d'une équipe
|
||||
"""
|
||||
|
||||
def Delete_Groupe_Equipe_Team_Membre(diction):
|
||||
def Delete_Equipe_Team_Membre(diction):
|
||||
try:
|
||||
diction = mycommon.strip_dictionary(diction)
|
||||
|
||||
|
@ -534,7 +534,6 @@ def Delete_Groupe_Equipe_Team_Membre(diction):
|
|||
"""
|
||||
Mise à jour d'une équipe
|
||||
"""
|
||||
|
||||
def Update_Equipe_Team(diction):
|
||||
try:
|
||||
diction = mycommon.strip_dictionary(diction)
|
||||
|
@ -720,7 +719,7 @@ def Update_Equipe_Team(diction):
|
|||
mycommon.myprint(
|
||||
" WARNING : Impossible de logguer l'historique pour l'évènement : " + str(history_event_dict))
|
||||
|
||||
return True, " L'équipe de formation a été correctement mise à jour"
|
||||
return True, " L'équipe a été correctement mise à jour"
|
||||
|
||||
except Exception as e:
|
||||
exc_type, exc_obj, exc_tb = sys.exc_info()
|
||||
|
|
File diff suppressed because it is too large
Load Diff
204
main.py
204
main.py
|
@ -97,6 +97,7 @@ import model_planning_sequence_mgt as model_planning_sequence_mgt
|
|||
import base_partner_catalog_config as base_partner_catalog_config
|
||||
import equipe_team_mgt as equipe_team_mgt
|
||||
import base_class_calcul_note as base_class_calcul_note
|
||||
import jury_mgt as jury_mgt
|
||||
|
||||
import base_document_automatic_setup as base_document_automatic_setup
|
||||
|
||||
|
@ -9815,7 +9816,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)
|
||||
|
||||
|
@ -12143,13 +12144,13 @@ def Get_Given_Equipe_Team_With_Members():
|
|||
"""
|
||||
API pour ajouter / mettre à jour les membres d'une équipe
|
||||
"""
|
||||
@app.route('/myclass/api/Delete_Groupe_Equipe_Team_Membre/', methods=['POST','GET'])
|
||||
@app.route('/myclass/api/Delete_Equipe_Team_Membre/', methods=['POST','GET'])
|
||||
@crossdomain(origin='*')
|
||||
def Delete_Groupe_Equipe_Team_Membre():
|
||||
def Delete_Equipe_Team_Membre():
|
||||
# On recupere le corps (payload) de la requete
|
||||
payload = mycommon.strip_dictionary (request.form.to_dict())
|
||||
print(" ### Delete_Groupe_Equipe_Team_Membre : payload = ",payload)
|
||||
localStatus, message= equipe_team_mgt.Delete_Groupe_Equipe_Team_Membre(payload)
|
||||
print(" ### Delete_Equipe_Team_Membre : payload = ",payload)
|
||||
localStatus, message= equipe_team_mgt.Delete_Equipe_Team_Membre(payload)
|
||||
return jsonify(status=localStatus, message=message )
|
||||
|
||||
|
||||
|
@ -12171,13 +12172,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 )
|
||||
|
||||
|
||||
|
@ -12200,28 +12201,195 @@ def Get_List_Evaluation_Final_Note_Classement_Detail_With_Filter():
|
|||
"""
|
||||
API qui retourne la note finale et le classement sur une session de formation
|
||||
"""
|
||||
@app.route('/myclass/api/Get_List_Evaluation_Final_Note_Classement_With_Filter', methods=['POST','GET'])
|
||||
@app.route('/myclass/api/Get_List_Evaluation_UE_Note_Classement_With_Filter', methods=['POST','GET'])
|
||||
@crossdomain(origin='*')
|
||||
def Get_List_Evaluation_Final_Note_Classement_With_Filter():
|
||||
def Get_List_Evaluation_UE_Note_Classement_With_Filter():
|
||||
# On recupere le corps (payload) de la requete
|
||||
payload = mycommon.strip_dictionary(request.form.to_dict())
|
||||
print(" ### Get_List_Evaluation_Final_Note_Classement_With_Filter : payload = ",payload)
|
||||
localStatus, message= base_class_calcul_note.Get_List_Evaluation_Final_Note_Classement_With_Filter(payload)
|
||||
print(" ### Get_List_Evaluation_UE_Note_Classement_With_Filter : payload = ",payload)
|
||||
localStatus, message= base_class_calcul_note.Get_List_Evaluation_UE_Note_Classement_With_Filter(payload)
|
||||
return jsonify(status=localStatus, message=message )
|
||||
|
||||
|
||||
|
||||
|
||||
"""
|
||||
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 )
|
||||
|
||||
|
||||
"""
|
||||
API qui prend une session de formation et retour la liste des inscrit classée selon le rang et la moyenne
|
||||
"""
|
||||
@app.route('/myclass/api/Get_List_Evaluation_Inscriptio_Note_Classement_With_Filter', methods=['POST','GET'])
|
||||
@crossdomain(origin='*')
|
||||
def Get_List_Evaluation_Inscriptio_Note_Classement_With_Filter():
|
||||
# On recupere le corps (payload) de la requete
|
||||
payload = mycommon.strip_dictionary(request.form.to_dict())
|
||||
print(" ### Get_List_Evaluation_Inscriptio_Note_Classement_With_Filter : payload = ",payload)
|
||||
localStatus, message= base_class_calcul_note.Get_List_Evaluation_Inscriptio_Note_Classement_With_Filter(payload)
|
||||
return jsonify(status=localStatus, message=message )
|
||||
|
||||
|
||||
|
||||
|
||||
"""
|
||||
API pour ajouter un Jury
|
||||
"""
|
||||
@app.route('/myclass/api/Add_Jury/', methods=['POST','GET'])
|
||||
@crossdomain(origin='*')
|
||||
def Add_Jury():
|
||||
# On recupere le corps (payload) de la requete
|
||||
payload = mycommon.strip_dictionary (request.form.to_dict())
|
||||
print(" ### Add_Jury : payload = ",payload)
|
||||
localStatus, message= jury_mgt.Add_Jury(payload)
|
||||
return jsonify(status=localStatus, message=message )
|
||||
|
||||
|
||||
"""
|
||||
API pour mettre à jour un Jury
|
||||
"""
|
||||
@app.route('/myclass/api/Update_Jury/', methods=['POST','GET'])
|
||||
@crossdomain(origin='*')
|
||||
def Update_Jury():
|
||||
# On recupere le corps (payload) de la requete
|
||||
payload = mycommon.strip_dictionary (request.form.to_dict())
|
||||
print(" ### Update_Jury : payload = ",payload)
|
||||
localStatus, message= jury_mgt.Update_Jury(payload)
|
||||
return jsonify(status=localStatus, message=message )
|
||||
|
||||
|
||||
"""
|
||||
API pour mettre supprimer un Jury
|
||||
"""
|
||||
@app.route('/myclass/api/Delete_Jury/', methods=['POST','GET'])
|
||||
@crossdomain(origin='*')
|
||||
def Delete_Jury():
|
||||
# On recupere le corps (payload) de la requete
|
||||
payload = mycommon.strip_dictionary (request.form.to_dict())
|
||||
print(" ### Delete_Jury : payload = ",payload)
|
||||
localStatus, message= jury_mgt.Delete_Jury(payload)
|
||||
return jsonify(status=localStatus, message=message )
|
||||
|
||||
|
||||
"""
|
||||
API pour recuperer la liste des Jurys d'un partenaire
|
||||
"""
|
||||
@app.route('/myclass/api/Get_List_Jury/', methods=['POST','GET'])
|
||||
@crossdomain(origin='*')
|
||||
def Get_List_Jury():
|
||||
# On recupere le corps (payload) de la requete
|
||||
payload = mycommon.strip_dictionary (request.form.to_dict())
|
||||
print(" ### Get_List_Jury : payload = ",payload)
|
||||
localStatus, message= jury_mgt.Get_List_Jury(payload)
|
||||
return jsonify(status=localStatus, message=message )
|
||||
|
||||
|
||||
"""
|
||||
API pour recuperer la liste des Jurys d'un partenaire
|
||||
avec des filtres sur :
|
||||
|
||||
- code
|
||||
- description
|
||||
- membre (nom ou prenom ) equipe
|
||||
"""
|
||||
@app.route('/myclass/api/Get_List_jury_With_Filter/', methods=['POST','GET'])
|
||||
@crossdomain(origin='*')
|
||||
def Get_List_jury_With_Filter():
|
||||
# On recupere le corps (payload) de la requete
|
||||
payload = mycommon.strip_dictionary (request.form.to_dict())
|
||||
print(" ### Get_List_jury_With_Filter : payload = ",payload)
|
||||
localStatus, message= jury_mgt.Get_List_jury_With_Filter(payload)
|
||||
return jsonify(status=localStatus, message=message )
|
||||
|
||||
|
||||
"""
|
||||
API pour recuperer les données d'une Jury d'un partenaire,
|
||||
y compris les membres
|
||||
"""
|
||||
@app.route('/myclass/api/Get_Given_Jury_With_Members/', methods=['POST','GET'])
|
||||
@crossdomain(origin='*')
|
||||
def Get_Given_Jury_With_Members():
|
||||
# On recupere le corps (payload) de la requete
|
||||
payload = mycommon.strip_dictionary (request.form.to_dict())
|
||||
print(" ### Get_Given_Jury_With_Members : payload = ",payload)
|
||||
localStatus, message= jury_mgt.Get_Given_Jury_With_Members(payload)
|
||||
return jsonify(status=localStatus, message=message )
|
||||
|
||||
|
||||
|
||||
"""
|
||||
API pour ajouter / mettre à jour les membres d'un Jury
|
||||
"""
|
||||
@app.route('/myclass/api/Add_Update_Jury_Membres/', methods=['POST','GET'])
|
||||
@crossdomain(origin='*')
|
||||
def Add_Update_Jury_Membres():
|
||||
# On recupere le corps (payload) de la requete
|
||||
payload = mycommon.strip_dictionary (request.form.to_dict())
|
||||
print(" ### Add_Update_Jury_Membres : payload = ",payload)
|
||||
localStatus, message= jury_mgt.Add_Update_Jury_Membres(payload)
|
||||
return jsonify(status=localStatus, message=message )
|
||||
|
||||
|
||||
"""
|
||||
API pour supprimer les membres d'une Jury
|
||||
"""
|
||||
@app.route('/myclass/api/Delete_Jury_Membre/', methods=['POST','GET'])
|
||||
@crossdomain(origin='*')
|
||||
def Add_Update_Jury_Team_Membres():
|
||||
# On recupere le corps (payload) de la requete
|
||||
payload = mycommon.strip_dictionary (request.form.to_dict())
|
||||
print(" ### Delete_Jury_Membre : payload = ",payload)
|
||||
localStatus, message= jury_mgt.Delete_Jury_Membre(payload)
|
||||
return jsonify(status=localStatus, message=message )
|
||||
|
||||
|
||||
|
|
|
@ -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'])
|
||||
|
@ -172,6 +181,9 @@ def Update_Unite_Enseignement(diction):
|
|||
try:
|
||||
diction = mycommon.strip_dictionary(diction)
|
||||
|
||||
print(" ### diction = ", diction)
|
||||
|
||||
|
||||
"""
|
||||
Verification des input acceptés
|
||||
"""
|
||||
|
@ -179,7 +191,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 +243,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 +760,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 +800,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