15/02/26 - 18h30

Signed-off-by: Cherif <cbalde@mysy-training.com>
master_Elyos_FI
Cherif 2026-02-15 18:31:48 +01:00
parent aff19ed199
commit cff867654d
12 changed files with 8854 additions and 91 deletions

View File

@ -4,11 +4,19 @@
<option name="autoReloadType" value="SELECTIVE" />
</component>
<component name="ChangeListManager">
<list default="true" id="c6d0259a-16e1-410d-91a1-830590ee2a08" name="Changes" comment="12/02/26 - 10h">
<list default="true" id="c6d0259a-16e1-410d-91a1-830590ee2a08" name="Changes" comment="12/02/26 - 10h30">
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
<change beforePath="$PROJECT_DIR$/GlobalVariable.py" beforeDir="false" afterPath="$PROJECT_DIR$/GlobalVariable.py" afterDir="false" />
<change beforePath="$PROJECT_DIR$/Job_Cron.py" beforeDir="false" afterPath="$PROJECT_DIR$/Job_Cron.py" 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$/activite_pedagogique.py" beforeDir="false" afterPath="$PROJECT_DIR$/activite_pedagogique.py" afterDir="false" />
<change beforePath="$PROJECT_DIR$/bloc_competence.py" beforeDir="false" afterPath="$PROJECT_DIR$/bloc_competence.py" afterDir="false" />
<change beforePath="$PROJECT_DIR$/groupe_inscrit_mgt.py" beforeDir="false" afterPath="$PROJECT_DIR$/groupe_inscrit_mgt.py" afterDir="false" />
<change beforePath="$PROJECT_DIR$/jury_mgt.py" beforeDir="false" afterPath="$PROJECT_DIR$/jury_mgt.py" afterDir="false" />
<change beforePath="$PROJECT_DIR$/main.py" beforeDir="false" afterPath="$PROJECT_DIR$/main.py" afterDir="false" />
<change beforePath="$PROJECT_DIR$/note_evaluation_mgt.py" beforeDir="false" afterPath="$PROJECT_DIR$/note_evaluation_mgt.py" afterDir="false" />
<change beforePath="$PROJECT_DIR$/notes_apprenant_mgt.py" beforeDir="false" afterPath="$PROJECT_DIR$/notes_apprenant_mgt.py" afterDir="false" />
<change beforePath="$PROJECT_DIR$/ressources_materiels.py" beforeDir="false" afterPath="$PROJECT_DIR$/ressources_materiels.py" afterDir="false" />
<change beforePath="$PROJECT_DIR$/session_admission_fi.py" beforeDir="false" afterPath="$PROJECT_DIR$/session_admission_fi.py" afterDir="false" />
</list>
<option name="SHOW_DIALOG" value="false" />
<option name="HIGHLIGHT_CONFLICTS" value="true" />
@ -452,7 +460,7 @@
<option name="project" value="LOCAL" />
<updated>1747251650255</updated>
</task>
<option name="localTasksCounter" value="531" />
<option name="localTasksCounter" value="532" />
<servers />
</component>
<component name="Vcs.Log.Tabs.Properties">
@ -494,7 +502,6 @@
</option>
</component>
<component name="VcsManagerConfiguration">
<MESSAGE value="wds" />
<MESSAGE value="22/10*2025 - 22h" />
<MESSAGE value="26/10/2025 - 15h" />
<MESSAGE value="29/10/2025 - 22h" />
@ -519,6 +526,7 @@
<MESSAGE value="09/02/2026" />
<MESSAGE value="10/02/26 - 20h" />
<MESSAGE value="12/02/26 - 10h" />
<option name="LAST_COMMIT_MESSAGE" value="12/02/26 - 10h" />
<MESSAGE value="12/02/26 - 10h30" />
<option name="LAST_COMMIT_MESSAGE" value="12/02/26 - 10h30" />
</component>
</project>

View File

@ -14907,6 +14907,10 @@ def Get_Accepted_Insription_From_Session_id_Reduice_Fields(diction):
"""
Cette fonction prend l'_id d'une session et retourne les inscriptions qui sont validé et celle en cours de validation
(statut IN [0, 1, 2]

File diff suppressed because it is too large Load Diff

View File

@ -371,7 +371,7 @@ def Get_Given_activite_pedagogique(diction):
user["code"] = "--"
tab_tache_pedagogique_with_code = []
if( "tab_tache_pedagogique" in New_retVal.keys() ):
if( "tab_tache_pedagogique" in New_retVal.keys() and New_retVal['tab_tache_pedagogique']):
for tache_pedago in New_retVal['tab_tache_pedagogique']:
tache_pedago_data = MYSY_GV.dbname['tache_pedagogique'].find_one({'_id':ObjectId(str(tache_pedago['_id'])), 'valide':'1'}, {'_id':1, 'code':1, 'description':1, })

View File

@ -54,6 +54,7 @@ def Add_bloc_competence(diction):
Verification des input acceptés
"""
field_list = ['token', 'description', 'commentaire', 'code',
'prerequis'
]
incom_keys = diction.keys()
@ -149,6 +150,7 @@ def Update_bloc_competence(diction):
Verification des input acceptés
"""
field_list = ['token', 'description', 'bloc_competence_id', 'commentaire', 'code',
'prerequis'
]
incom_keys = diction.keys()
@ -392,7 +394,7 @@ def Get_Given_bloc_competence(diction):
user['tab_pole_activite_with_code'] = tab_pole_activite_with_code
tab_tab_ue_competence_with_code = []
tab_ue_competence_with_code = []
cpt_local_tab_ue_competence = 0
if ("tab_ue" in New_retVal.keys()):
for ue_competence in New_retVal['tab_ue']:
@ -423,10 +425,10 @@ def Get_Given_bloc_competence(diction):
local_node['creation_date'] = str(ue_competence['creation_date'])
tab_tab_ue_competence_with_code.append(local_node)
tab_ue_competence_with_code.append(local_node)
user['tab_tab_ue_competence_with_code'] = tab_tab_ue_competence_with_code
user['tab_ue_competence_with_code'] = tab_ue_competence_with_code
user['id'] = str(val_tmp)
val_tmp = val_tmp + 1
@ -510,7 +512,7 @@ def Add_Update_tab_Pole_Activite_To_Bloc_Competence(diction):
"""
Verification des input acceptés
"""
field_list = ['token', 'bloc_competence_id', 'pole_activite_id', 'rang', 'obligatoire']
field_list = ['token', 'bloc_competence_id', 'pole_activite_id', 'rang', ]
incom_keys = diction.keys()
for val in incom_keys:
@ -522,7 +524,7 @@ def Add_Update_tab_Pole_Activite_To_Bloc_Competence(diction):
"""
Verification des champs obligatoires
"""
field_list_obligatoire = ['token', 'bloc_competence_id', 'pole_activite_id', 'rang', 'obligatoire']
field_list_obligatoire = ['token', 'bloc_competence_id', 'pole_activite_id', 'rang', ]
for val in field_list_obligatoire:
if val not in diction:
@ -543,11 +545,7 @@ def Add_Update_tab_Pole_Activite_To_Bloc_Competence(diction):
if (local_status is not True):
return local_status, my_partner
if( diction['obligatoire'] not in ['0', '1']):
mycommon.myprint(
str(inspect.stack()[0][
3]) + " La notion d'obligation est invalide ")
return False, " La notion d'obligation est invalide "
if ("rang" in diction.keys()):
local_status, local_note_max = mycommon.IsInt(str(diction['rang']).strip())
@ -613,7 +611,7 @@ def Add_Update_tab_Pole_Activite_To_Bloc_Competence(diction):
{'$set':
{
'tab_pole_activite.$[xxx].rang': str( diction['rang']),
'tab_pole_activite.$[xxx].obligatoire': str( diction['obligatoire']),
'tab_pole_activite.$[xxx].update_date': str( datetime.now()),
'tab_pole_activite.$[xxx].update_by': str(my_partner['_id']),
}
@ -629,7 +627,7 @@ def Add_Update_tab_Pole_Activite_To_Bloc_Competence(diction):
new_data = {}
new_data['_id'] = ObjectId(str(pole_id))
new_data['rang'] = str(diction['rang'])
new_data['obligatoire'] = str(diction['obligatoire'])
new_data['valide'] = "1"
new_data['creation_by'] = str(my_partner['_id'])
new_data['creation_date'] = str(datetime.now())
@ -771,7 +769,7 @@ def Delete_Pole_Activite_From_Bloc_Competence(diction):
return True, " Le pôle d'activité a été correctement supprimée "
return True, " Le pôle d'activité a été correctement supprimé "
except Exception as e:
@ -790,7 +788,7 @@ def Add_Update_tab_UE_And_Competence_To_Bloc_Competence(diction):
"""
Verification des input acceptés
"""
field_list = ['token', 'bloc_competence_id', 'ue_id', 'competence_id', 'rang', 'obligatoire']
field_list = ['token', 'bloc_competence_id', 'ue_id', 'competence_id',]
incom_keys = diction.keys()
for val in incom_keys:
@ -802,7 +800,7 @@ def Add_Update_tab_UE_And_Competence_To_Bloc_Competence(diction):
"""
Verification des champs obligatoires
"""
field_list_obligatoire = ['token', 'bloc_competence_id', 'ue_id', 'competence_id', 'rang', 'obligatoire']
field_list_obligatoire = ['token', 'bloc_competence_id', 'ue_id', 'competence_id', ]
for val in field_list_obligatoire:
if val not in diction:
@ -823,19 +821,6 @@ def Add_Update_tab_UE_And_Competence_To_Bloc_Competence(diction):
if (local_status is not True):
return local_status, my_partner
if( diction['obligatoire'] not in ['0', '1']):
mycommon.myprint(
str(inspect.stack()[0][
3]) + " La notion d'obligation est invalide ")
return False, " La notion d'obligation est invalide "
if ("rang" in diction.keys()):
local_status, local_note_max = mycommon.IsInt(str(diction['rang']).strip())
if (local_status is False):
mycommon.myprint(
" Le rang doit être un nombre entier ")
return False, " Le rang doit être un nombre entier"
"""
@ -908,8 +893,6 @@ def Add_Update_tab_UE_And_Competence_To_Bloc_Competence(diction):
},
{'$set':
{
'tab_ue.$[xxx].rang': str( diction['rang']),
'tab_ue.$[xxx].obligatoire': str( diction['obligatoire']),
'tab_ue.$[xxx].update_date': str( datetime.now()),
'tab_ue.$[xxx].update_by': str(my_partner['_id']),
}
@ -927,8 +910,6 @@ def Add_Update_tab_UE_And_Competence_To_Bloc_Competence(diction):
new_data['ue_id'] = str(diction['ue_id'])
new_data['competence_id'] = str(diction['competence_id'])
new_data['rang'] = str(diction['rang'])
new_data['obligatoire'] = str(diction['obligatoire'])
new_data['valide'] = "1"
new_data['creation_by'] = str(my_partner['_id'])
new_data['creation_date'] = str(datetime.now())

View File

@ -566,45 +566,85 @@ def Get_List_Groupe_Inscrit_With_Filter(diction):
print("### Get_List_Groupe_Inscrit_With_Filter find_qry = ", find_qry)
for retval in MYSY_GV.dbname['groupe_inscription'].find(find_qry).sort([("_id", pymongo.DESCENDING), ]):
user = retval
user['id'] = str(val_tmp)
"""
Verifier la validité de la session associée
"""
is_valide_session = "1"
if( "session_id" in retval.keys() and retval['session_id']):
my_session_formation_count = MYSY_GV.dbname['session_formation'].count_documents(
{"_id": ObjectId(str(retval['session_id'])),
'valide': '1','partner_owner_recid':str(my_partner['recid']) })
if ("class_id" not in retval.keys()):
user['class_title'] = ""
user['class_internal_url'] = ""
else:
my_class_data = MYSY_GV.dbname['myclass'].find_one({"_id":ObjectId(str(retval['class_id'])),
if( my_session_formation_count != 1):
is_valide_session = "-1"
"""
Verifier la validité de la formation associée
"""
is_valide_class = "1"
if ("class_id" in retval.keys() and retval['class_id']):
my_class_count = MYSY_GV.dbname['myclass'].count_documents({"_id":ObjectId(str(retval['class_id'])),
'valide':'1',
'locked':'0'})
if( my_class_data and "title" in my_class_data.keys() ):
user['class_title'] = my_class_data['title']
if (my_class_data and "internal_url" in my_class_data.keys()):
user['class_internal_url'] = my_class_data['internal_url']
if ("session_id" not in retval.keys()):
user['session_code_session'] = ""
else:
my_session_formation_data = MYSY_GV.dbname['session_formation'].find_one({"_id": ObjectId(str(retval['session_id'])),
'valide': '1',})
if (my_session_formation_data and "code_session" in my_session_formation_data.keys()):
user['session_code_session'] = my_session_formation_data['code_session']
'locked':'0',
'partner_owner_recid':str(my_partner['recid'])})
if (my_class_count != 1):
is_valide_class = "-1"
"""
Récuperer le nombre de membre du groupe (collection : groupe_inscription_membre)
"""
grp_nb_member = MYSY_GV.dbname['groupe_inscription_membre'].count_documents({'groupe_inscription_id':str(retval['_id']),
Verifier la validité du type de groupe associé
"""
is_valide_type_groupe = "1"
if ("type_groupe_code" in retval.keys() and retval['type_groupe_code']):
my_type_groupe_count = MYSY_GV.dbname['groupe_inscription_type'].count_documents({"code": str(retval['type_groupe_code']),
'valide': '1',
'locked': '0'})
if (my_type_groupe_count <= 0):
is_valide_type_groupe = "-1"
if( is_valide_session == "1" and is_valide_class == "1" and is_valide_type_groupe == "1"):
user = retval
user['id'] = str(val_tmp)
if ("class_id" not in retval.keys()):
user['class_title'] = ""
user['class_internal_url'] = ""
else:
my_class_data = MYSY_GV.dbname['myclass'].find_one({"_id":ObjectId(str(retval['class_id'])),
'valide':'1',
'locked':'0',
'partner_owner_recid':str(my_partner['recid'])})
'partner_owner_recid':str(my_partner['recid'])})
user['nb_membre'] = str(grp_nb_member)
if( my_class_data and "title" in my_class_data.keys() ):
user['class_title'] = my_class_data['title']
val_tmp = val_tmp + 1
RetObject.append(mycommon.JSONEncoder().encode(user))
if (my_class_data and "internal_url" in my_class_data.keys()):
user['class_internal_url'] = my_class_data['internal_url']
if ("session_id" not in retval.keys()):
user['session_code_session'] = ""
else:
my_session_formation_data = MYSY_GV.dbname['session_formation'].find_one({"_id": ObjectId(str(retval['session_id'])),
'valide': '1', 'partner_owner_recid':str(my_partner['recid'])})
if (my_session_formation_data and "code_session" in my_session_formation_data.keys()):
user['session_code_session'] = my_session_formation_data['code_session']
"""
Récuperer le nombre de membre du groupe (collection : groupe_inscription_membre)
"""
grp_nb_member = MYSY_GV.dbname['groupe_inscription_membre'].count_documents({'groupe_inscription_id':str(retval['_id']),
'valide':'1',
'locked':'0',
'partner_owner_recid':str(my_partner['recid'])})
user['nb_membre'] = str(grp_nb_member)
val_tmp = val_tmp + 1
RetObject.append(mycommon.JSONEncoder().encode(user))
return True, RetObject
@ -612,7 +652,7 @@ def Get_List_Groupe_Inscrit_With_Filter(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 récupérer la liste des metiers de formation "
return False, " Impossible de récupérer la liste des groupes "
"""
@ -1085,6 +1125,159 @@ def Get_Given_Groupe_Membres(diction):
"""
Recuperer les membres d'un groupe, mais pour faire un homogenité avec la fonction
"Get_Accepted_Insription_From_Session_id_Reduice_Fields"
"""
def Get_Given_Groupe_Membres_Linked_To_inscription_Data(diction):
try:
diction = mycommon.strip_dictionary(diction)
"""
Verification des input acceptés
"""
field_list = ['token', '_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', '_id' ]
for val in field_list_obligatoire:
if val not in diction:
mycommon.myprint(
str(inspect.stack()[0][3]) + " - La valeur '" + val + "' n'est pas presente dans la liste des arguments ")
return False, " Les informations fournies sont incorrectes",
"""
Verification de l'identité et autorisation de l'entité qui
appelle cette API
"""
token = ""
if ("token" in diction.keys()):
if diction['token']:
token = diction['token']
local_status, my_partner = mycommon.Check_Connexion_And_Return_Partner_Data(diction)
if (local_status is not True):
return local_status, my_partner
"""
Verifier la validité du groupe
"""
is_groupe_valide = MYSY_GV.dbname['groupe_inscription'].count_documents({'_id':ObjectId(str(diction['_id'])),
'valide': '1',
'locked': '0',
'partner_owner_recid': str(
my_partner['recid'])
})
if( is_groupe_valide != 1):
mycommon.myprint(
str(inspect.stack()[0][
3]) + " L'identifiant du groupe est invalide ")
return False, " L'identifiant du groupe est invalide "
is_groupe_data = MYSY_GV.dbname['groupe_inscription'].find_one({'_id': ObjectId(str(diction['_id'])),
'valide': '1',
'locked': '0',
'partner_owner_recid': str(
my_partner['recid'])
})
groupe_code = ""
if( "code" in is_groupe_data.keys() ):
groupe_code = is_groupe_data['code']
liste_inscription_id_ObjectID = []
for retval_tmp in MYSY_GV.dbname['groupe_inscription_membre'].find({'groupe_inscription_id':str(diction['_id']),
'valide':'1',
'locked':'0',
'partner_owner_recid':str(my_partner['recid'])}):
if( "inscription_id" in retval_tmp.keys() and retval_tmp['inscription_id']):
is_valide_inscription = MYSY_GV.dbname['inscription'].count_documents({'_id':ObjectId(str(retval_tmp['inscription_id'])),
'valide': '1',
'locked': '0',
'partner_owner_recid': str(
my_partner['recid'])
})
if(is_valide_inscription == 1 ):
liste_inscription_id_ObjectID.append(ObjectId(ObjectId(str(retval_tmp['inscription_id']))))
local_qry = {}
local_qry['_id'] = {'$in'}
RetObject = []
val_tmp = 0
for retval in MYSY_GV.dbname['inscription'].find({'_id':{'$in': liste_inscription_id_ObjectID} , 'valide': '1',
'locked': '0',
'partner_owner_recid': str(
my_partner['recid'])},
{'_id': 1, 'email': 1,
'session_id': 1,
'apprenant_id': 1,
'nom': 1,
'prenom': 1,
}).sort([("_id", pymongo.DESCENDING), ]):
val_tmp = val_tmp + 1
user = retval
user['id'] = str(val_tmp)
apprenant_nom = str(retval['nom'])
apprenant_prenom = str(retval['prenom'])
apprenant_email = str(retval['email'])
# Si il a un apprenant_id
# print(" ### retVal = ", retVal )
if ("apprenant_id" in retval.keys()):
if (retval['apprenant_id'] and str(retval['apprenant_id']) != 'undefined'):
apprenant_retval = MYSY_GV.dbname['apprenant'].find_one(
{'_id': ObjectId(retval['apprenant_id']),
'valide': '1', 'locked': '0'})
if (apprenant_retval is not None):
apprenant_nom = apprenant_retval['nom']
apprenant_prenom = apprenant_retval['prenom']
apprenant_email = apprenant_retval['email']
user['apprenant_nom'] = apprenant_nom
user['apprenant_prenom'] = apprenant_prenom
user['apprenant_email'] = apprenant_email
user['groupe'] = str(groupe_code)
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 membres du groupe "
"""
Cette fonction permet de supprimer des inscrits à un groupe (membre d'un groupe)
"""

View File

@ -6774,6 +6774,7 @@ def Create_Jury_Convocation_By_Membre_Email(tab_files, Folder, diction):
if (local_stpm_status is False):
return local_stpm_status, partner_SMTP_COUNT_smtpsrv
msg.attach(html_mime)
msg['From'] = partner_SMTP_COUNT_From_User
msg['Bcc'] = 'contact@mysy-training.com'

38
main.py
View File

@ -11835,6 +11835,21 @@ def Get_Given_Groupe_Membres():
"""
API pour Recuperer les membres d'un groupe, mais pour faire un homogenité avec la fonction
"Get_Accepted_Insription_From_Session_id_Reduice_Fields"
"""
@app.route('/myclass/api/Get_Given_Groupe_Membres_Linked_To_inscription_Data/', methods=['POST','GET'])
@crossdomain(origin='*')
def Get_Given_Groupe_Membres_Linked_To_inscription_Data():
# On recupere le corps (payload) de la requete
payload = mycommon.strip_dictionary (request.form.to_dict())
print(" ### Get_Given_Groupe_Membres_Linked_To_inscription_Data payload = ",payload)
status, retval = groupe_inscrit_mgt.Get_Given_Groupe_Membres_Linked_To_inscription_Data(payload)
return jsonify(status=status, message=retval)
"""
API pour permettre de supprimer des inscrits à un groupe
@ -15702,6 +15717,25 @@ def Get_Synthese_Candidat_Process_Admission():
return jsonify(status=status, message=retval)
"""
API permet d'envoyer un email de relance manuelle
use case : relancer un candidat sur l'envoie d'un document
"""
@app.route('/myclass/api/Candidat_Relance_Given_Document/', methods=['POST','GET'])
@crossdomain(origin='*')
def Candidat_Relance_Given_Document():
# On recupere le corps (payload) de la requete
payload = mycommon.strip_dictionary (request.form.to_dict())
print(" ### Candidat_Relance_Given_Document payload = ")
status, retval = session_admission_fi.Candidat_Relance_Given_Document(payload)
return jsonify(status=status, message=retval)
"""
Cette API permet de Récuperer la liste des partenaires de la plateforme avec des filtres
"""
@ -16359,7 +16393,7 @@ if __name__ == '__main__':
mycommon.myprint("++ FLASK PORT " + str(MYSY_GV.MYSY_PORT_REC) + " ++")
mycommon.myprint("++ LMS_BAS_URL " + str(MYSY_GV.LMS_BAS_URL) + " ++")
"""
scheduler = BackgroundScheduler()
scheduler.start()
@ -16373,7 +16407,7 @@ if __name__ == '__main__':
# WARNING IMPORTANT WARNING : Shut down the scheduler when exiting the app
atexit.register(lambda: scheduler.shutdown())
"""
app.run(host='localhost', port=MYSY_GV.MYSY_PORT_REC, debug=True, threaded=True)

View File

@ -198,6 +198,39 @@ def Add_Evaluation_Planification(diction):
local_mode_animation = diction['mode_animation']
"""
Aller recuperer les criteres de notation : max_note et type_note
class_unite_enseignement_type_evaluation
"""
notation_critere_is_valide = MYSY_GV.dbname['class_unite_enseignement_type_evaluation'].count_documents({'class_id':str(diction['class_id']),
'type_evaluation_id': str(diction['type_eval_id']),
'class_ue_id':str(diction['class_eu_id']),
'partner_owner_recid':
my_partner[
'recid'],
'valide': '1',
'locked': '0'
})
if( notation_critere_is_valide != 1 ):
mycommon.myprint(
str(inspect.stack()[0][
3]) + " Les critères de notation ne sont pas valides. - collection: class_unite_enseignement_type_evaluation")
return False, " Les critères de notation ne sont pas valides."
notation_critere_data = MYSY_GV.dbname['class_unite_enseignement_type_evaluation'].find_one(
{'class_id': str(diction['class_id']),
'type_evaluation_id': str(diction['type_eval_id']),
'class_ue_id': str(diction['class_eu_id']),
'partner_owner_recid':
my_partner[
'recid'],
'valide': '1',
'locked': '0'
})
new_data = diction
mytoken = diction['token']
del diction['token']
@ -212,6 +245,16 @@ def Add_Evaluation_Planification(diction):
if val not in diction.keys():
new_data[str(val)] = ""
if( "max_note" in notation_critere_data.keys() ):
new_data['max_note'] = notation_critere_data['max_note']
else:
new_data['max_note'] = "20"
if ("type_note" in notation_critere_data.keys()):
new_data['type_note'] = notation_critere_data['type_note']
else:
new_data['type_note'] = "num"
new_data['valide'] = "1"
new_data['locked'] = "0"
@ -256,6 +299,10 @@ def Add_Evaluation_Planification(diction):
"""
Mettre à jour une évaluation planifiée
on va recuper et stocker 2 info :
- le max de la note
- le type notation (numerique ou alpha numerique)
"""
def Update_Evaluation_Planification(diction):
try:
@ -414,6 +461,41 @@ def Update_Evaluation_Planification(diction):
if ("mode_animation" in diction.keys() and diction['mode_animation'] not in ['0', '1']):
del diction['mode_animation']
"""
Aller recuperer les criteres de notation : max_note et type_note
class_unite_enseignement_type_evaluation
"""
notation_critere_is_valide = MYSY_GV.dbname['class_unite_enseignement_type_evaluation'].count_documents(
{'class_id': str(diction['class_id']),
'type_evaluation_id': str(diction['type_eval_id']),
'class_ue_id': str(diction['class_eu_id']),
'partner_owner_recid':
my_partner[
'recid'],
'valide': '1',
'locked': '0'
})
if (notation_critere_is_valide != 1):
mycommon.myprint(
str(inspect.stack()[0][
3]) + " Les critères de notation ne sont pas valides. - collection: class_unite_enseignement_type_evaluation")
return False, " Les critères de notation ne sont pas valides."
notation_critere_data = MYSY_GV.dbname['class_unite_enseignement_type_evaluation'].find_one(
{'class_id': str(diction['class_id']),
'type_evaluation_id': str(diction['type_eval_id']),
'class_ue_id': str(diction['class_eu_id']),
'partner_owner_recid':
my_partner[
'recid'],
'valide': '1',
'locked': '0'
})
local_evaluation_id = diction['evaluation_id']
new_data = diction
mytoken = diction['token']
@ -430,6 +512,16 @@ def Update_Evaluation_Planification(diction):
new_data['update_by'] = str(my_partner['_id'])
new_data['partner_owner_recid'] = str(my_partner['recid'])
if ("max_note" in notation_critere_data.keys()):
new_data['max_note'] = notation_critere_data['max_note']
else:
new_data['max_note'] = "20"
if ("type_note" in notation_critere_data.keys()):
new_data['type_note'] = notation_critere_data['type_note']
else:
new_data['type_note'] = "num"
result = MYSY_GV.dbname['note_evaluation'].find_one_and_update(
{'_id': ObjectId(str(local_evaluation_id)),
@ -723,6 +815,12 @@ def Get_List_Evaluation_Planification_No_Filter(diction):
user['id'] = str(val_tmp)
val_tmp = val_tmp + 1
if ("type_notation" not in user.keys()):
user['type_notation'] = "num"
if ("max_note" not in user.keys()):
user['max_note'] = "20"
RetObject.append(mycommon.JSONEncoder().encode(user))
return True, RetObject
@ -875,6 +973,12 @@ def Get_List_Evaluation_Planification_With_Filter(diction):
user['id'] = str(val_tmp)
val_tmp = val_tmp + 1
if ("type_notation" not in user.keys()):
user['type_notation'] = "num"
if ("max_note" not in user.keys()):
user['max_note'] = "20"
RetObject.append(mycommon.JSONEncoder().encode(user))
return True, RetObject

View File

@ -456,7 +456,8 @@ def Add_Class_UE_Evaluation(diction):
"""
Verification des input acceptés
"""
field_list = ['token', 'class_id', 'class_ue_id', 'type_evaluation_id', 'max_note', 'ponderation_type_eval'
field_list = ['token', 'class_id', 'class_ue_id', 'type_evaluation_id', 'max_note', 'ponderation_type_eval',
'type_notation'
]
incom_keys = diction.keys()
@ -491,6 +492,13 @@ def Add_Class_UE_Evaluation(diction):
return local_status, my_partner
if( "type_notation" in diction.keys() and diction['type_notation'] not in ['num', 'alpha']):
mycommon.myprint(
str(inspect.stack()[0][
3]) + "Le type de notation doit être numérique ou alphanumérique. ")
return False, " Le type de notation doit être numérique ou alphanumérique. "
"""
Verifier que class_ue_id est valide
"""
@ -531,6 +539,13 @@ def Add_Class_UE_Evaluation(diction):
new_data['valide'] = "1"
new_data['locked'] = "0"
if( new_data['type_notation'] == ""):
new_data['type_notation'] = "num"
if (new_data['max_note'] == ""):
new_data['max_note'] = "20"
new_data['update_date'] = str(datetime.now())
new_data['update_by'] = str(my_partner['_id'])
new_data['partner_owner_recid'] = str(my_partner['recid'])
@ -560,7 +575,8 @@ def Update_Class_UE_Evaluation(diction):
"""
Verification des input acceptés
"""
field_list = ['token', 'max_note', 'class_ue_evaluation_id', 'ponderation_type_eval']
field_list = ['token', 'max_note', 'class_ue_evaluation_id', 'ponderation_type_eval',
'type_notation']
incom_keys = diction.keys()
for val in incom_keys:
@ -593,6 +609,12 @@ def Update_Class_UE_Evaluation(diction):
if (local_status is not True):
return local_status, my_partner
if ("type_notation" in diction.keys() and diction['type_notation'] not in ['num', 'alpha']):
mycommon.myprint(
str(inspect.stack()[0][
3]) + "Le type de notation doit être numérique ou alphanumérique. ")
return False, " Le type de notation doit être numérique ou alphanumérique. "
"""
Verifier que class_ue_id est valide
@ -736,6 +758,12 @@ def Get_List_Class_Evaluation(diction):
if("ponderation_type_eval" not in user.keys()):
user['ponderation_type_eval'] = "1"
if ("type_notation" not in user.keys()):
user['type_notation'] = "num"
if ("max_note" not in user.keys()):
user['max_note'] = "20"
val_tmp = val_tmp + 1
@ -812,6 +840,12 @@ def Get_List_UE_Evaluation(diction):
user['id'] = str(val_tmp)
val_tmp = val_tmp + 1
if( "type_notation" not in user.keys()):
user['type_notation'] = "num"
if ("max_note" not in user.keys()):
user['max_note'] = "20"
RetObject.append(mycommon.JSONEncoder().encode(user))
return True, RetObject

View File

@ -332,9 +332,14 @@ def Add_Ressource_Materielle(diction):
inserted_id = ""
inserted_id = MYSY_GV.dbname['ressource_materielle'].insert_one(data).inserted_id
if (not inserted_id):
mycommon.myprint(
" Impossible de créer le materiel (2) ")
return False, " Impossible de créer le materiel (2) "
if( diction['code_categorie'] == "salle"):
mycommon.myprint(
" Impossible de créer la salle (2) ")
return False, " Impossible de créer la salle (2) "
else:
mycommon.myprint(
" Impossible de créer le materiel (2) ")
return False, " Impossible de créer le materiel (2) "
"""
# Ajout de l'evenement dans l'historique
@ -351,12 +356,15 @@ def Add_Ressource_Materielle(diction):
mycommon.myprint(
" WARNING : Impossible de logguer l'historique pour la ressource materielle (ref_interne): " + str(diction['ref_interne']))
return True, " Le materiel a été correctement créé"
if (diction['code_categorie'] == "salle"):
return True, " La salle a été correctement créée"
else:
return True, " Le materiel a été correctement créé"
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 d'ajouter le materiel "
return False, " Impossible d'ajouter l'objet "
@ -688,7 +696,7 @@ def Update_Ressource_Materielle(diction):
" WARNING : Impossible de logguer l'historique : " + str(diction['_id']) )
return True, " Le materiel a été correctement mis à jour"
return True, " La mise à jour a été correctement faite"
except Exception as e:
exc_type, exc_obj, exc_tb = sys.exc_info()
@ -800,12 +808,12 @@ def Delete_Ressource_Materielle(diction):
mycommon.myprint(
" WARNING : Impossible de logguer l'historique : " + str(diction['_id']))
return True, " Le materiel a été correctement supprimé"
return True, " La suppression a été correctement faite"
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 supprimer le materiel "
return False, " Impossible d'effectuer la suppression"
"""

View File

@ -974,8 +974,8 @@ def Add_Stagiaire_To_Admission_Session(diction):
inserted_data = MYSY_GV.dbname['admission_session_inscrit'].insert_one(new_data)
if (not inserted_data.inserted_id):
mycommon.myprint(
" Impossible de créer la session d'admission (2) ")
return False, " Impossible de créer la session d'admission (2) "
" Impossible d'ajouter le candidat à la session d'admission (2) ")
return False, " Impossible d'ajouter le candidat à la session d'admission (2) "
@ -998,7 +998,7 @@ def Add_Stagiaire_To_Admission_Session(diction):
except Exception as e:
exc_type, exc_obj, exc_tb = sys.exc_info()
mycommon.myprint(str(inspect.stack()[0][3]) + " -" + str(e) + " - ERRORRRR AT Line : " + str(exc_tb.tb_lineno))
return False, "Impossible d'ajouter le candidat"
return False, "Impossible d'ajouter le candidat à la session d'admission"
"""
@ -1758,8 +1758,8 @@ def Add_Update_Inscrit_Admiss_Session_Image(file_img=None, Folder=None, diction=
'partner_owner_recid':str(my_partner['recid'])})
if( is_inscrit_id_valide_count != 1):
mycommon.myprint(str(inspect.stack()[0][3]) + " L'identifiant de l'inscrit est invalide ")
return False, " L'identifiant de l'inscrit est invalide "
mycommon.myprint(str(inspect.stack()[0][3]) + " L'identifiant du candidat est invalide ")
return False, " L'identifiant du candidat est invalide "
inscrit_id_data = MYSY_GV.dbname['admission_session_inscrit'].find_one(
{'_id': ObjectId(diction['inscrit_id']),
@ -1819,7 +1819,7 @@ def Get_Inscrit_Admiss_Session_Recorded_Image_from_front(diction=None):
if (local_status is not True):
return local_status, my_partner
# Verifier que l'apprenant est valide
# Verifier que le candidat est valide
is_inscrit_id_valide_count = MYSY_GV.dbname['admission_session_inscrit'].count_documents(
{'_id': ObjectId(diction['inscrit_id']),
'valide': '1',
@ -1827,8 +1827,8 @@ def Get_Inscrit_Admiss_Session_Recorded_Image_from_front(diction=None):
'partner_owner_recid': str(my_partner['recid'])})
if (is_inscrit_id_valide_count != 1):
mycommon.myprint(str(inspect.stack()[0][3]) + " L'identifiant de l'inscrit est invalide ")
return False, " L'identifiant de l'inscrit est invalide "
mycommon.myprint(str(inspect.stack()[0][3]) + " L'identifiant du candidat est invalide ")
return False, " L'identifiant du candidat est invalide "
inscrit_id_data = MYSY_GV.dbname['admission_session_inscrit'].find_one(
{'_id': ObjectId(diction['inscrit_id']),
@ -1984,6 +1984,17 @@ def Get_List_Candidat_Document(diction=None):
if (local_status is not True):
return local_status, my_partner
candidat_data = MYSY_GV.dbname['admission_session_inscrit'].find_one(
{'_id': ObjectId(str(diction['inscrit_id'])),
'valide': '1',
'partner_owner_recid': str(my_partner['recid'])})
tab_relance_doc = []
if( "relances_document" in candidat_data.keys()):
tab_relance_doc = candidat_data['relances_document']
print(" ## tab_relance_doc = ", tab_relance_doc)
qry_match = {"partner_owner_recid": str(my_partner['recid']), 'valide': '1', 'locked': '0'}
pipe_qry = ([
@ -2021,15 +2032,34 @@ def Get_List_Candidat_Document(diction=None):
RetObject = []
val_tmp = 0
for New_retVal in MYSY_GV.dbname['admission_setup_document'].aggregate(pipe_qry):
#print(" ## New_retVal = ",New_retVal
#print(" ## New_retVal = ",New_retVal)
if( "collection_download_files" in New_retVal.keys()):
for tmp_data in New_retVal['collection_download_files']:
if( "acceptance_status" not in tmp_data.keys()):
tmp_data['acceptance_status'] = ''
"""
Recuperer la dernière date de relance si il y a déja eu de la relance
"""
last_relance = ""
list_relance = []
for tmp in tab_relance_doc :
if( "document_id" in tmp.keys() and
"document_id" in New_retVal.keys() and
tmp['document_id'] == New_retVal['admission_setup_document_id']):
list_relance.append(tmp)
last_relance = "Dernière relance : "+str(tmp['document_date_relance'])[0:16]+" - Email"
user = New_retVal
user['id'] = str(val_tmp)
user['relances_document'] = list_relance
user['last_relance'] = last_relance
val_tmp = val_tmp + 1
RetObject.append(mycommon.JSONEncoder().encode(user))
@ -2488,3 +2518,231 @@ def Get_Synthese_Candidat_Process_Admission(diction):
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 inscrits"
"""
Cette fonction permet d'envoyer un email de relance manuelle
use case : relancer un candidat sur l'envoie d'un document
"""
def Candidat_Relance_Given_Document(diction=None):
try:
# Dictionnaire des champs utilisables
field_list = ['token', 'inscrit_id', 'admission_setup_document_id' ]
incom_keys = diction.keys()
'''
# Verification que les champs reçus dans l'API sont bien dans la liste des champs autorisés
# Cela evite le cas ou une entité tierce ajouter les valeurs inconnu dans l'API
# Ici on doit mettre tous les champs possible (obligatoire ou non) de la BDD dans la liste
# field_list.
'''
for val in incom_keys:
if str(val).lower() not in str(field_list).lower():
mycommon.myprint(
str(inspect.stack()[0][3]) + " Le champ '" + val + "' n'est pas accepté dans cette API")
return False, " Le champ '" + val + "' n'est pas accepté "
'''
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 = ['token', 'inscrit_id', 'admission_setup_document_id' ]
for val in field_list_obligatoire:
if str(val).lower() not in diction:
mycommon.myprint(
str(inspect.stack()[0][3]) + " La valeur '" + val + "' n'est pas presente dans la liste des arguments des champs")
return False, " La valeur '" + val + "' n'est pas presente dans la liste des arguments "
mydata = {}
mytoken = ""
# recuperation des paramettre
if ("token" in diction.keys()):
if diction['token']:
mytoken = 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 validé de l'inscrit
"""
is_existe_candidat = MYSY_GV.dbname['admission_session_inscrit'].count_documents(
{'_id': ObjectId(str(diction['inscrit_id'])),
'valide': '1',
'partner_owner_recid': str(my_partner['recid'])})
if (is_existe_candidat != 1):
mycommon.myprint(
str(inspect.stack()[0][3]) + " L'identifiant du candidat est invalide ")
return False, " L'identifiant du candidat est invalide "
candidat_data = MYSY_GV.dbname['admission_session_inscrit'].find_one(
{'_id': ObjectId(str(diction['inscrit_id'])),
'valide': '1',
'partner_owner_recid': str(my_partner['recid'])})
"""
verifier la validité du document a relancer
"""
is_valide_admission_setup_document_id = MYSY_GV.dbname['admission_setup_document'].count_documents({'_id':ObjectId(str(diction['admission_setup_document_id'])),
'valide':'1',
'locked':'0',
'partner_owner_recid':str(my_partner['recid'])})
if( is_valide_admission_setup_document_id != 1):
mycommon.myprint(
str(inspect.stack()[0][
3]) + " L'identifiant du document à relancer est invalide ")
return False, " L'identifiant du document à relancer est invalide "
admission_setup_document_data = MYSY_GV.dbname['admission_setup_document'].find_one(
{'_id': ObjectId(str(diction['admission_setup_document_id'])),
'valide': '1',
'locked': '0',
'partner_owner_recid': str(my_partner['recid'])}, {'_id':1, 'code':1, 'description':1, 'type':1})
"""
Recuperer le modèle de document
"""
local_diction = {}
local_diction['ref_interne'] = "ADMISSION_RELANCE_DOCUMENT"
local_diction['type_doc'] = "email"
local_diction['partner_owner_recid'] = str(my_partner['recid'])
courrier_data_status, courrier_data_retval = mycommon.Get_Courrier_Template_Include_Default_Data(local_diction)
if (courrier_data_status is False):
return courrier_data_status, courrier_data_retval
if ("contenu_doc" not in courrier_data_retval.keys() or str(courrier_data_retval['contenu_doc']) == ""):
mycommon.myprint(
str(inspect.stack()[0][
3]) + " Le modèle de courrier 'ADMISSION_RELANCE_DOCUMENT' n'est pas correctement configuré ")
return False, " Le modèle de courrier 'ADMISSION_RELANCE_DOCUMENT' n'est pas correctement configuré "
tab_candidat = []
tab_candidat.append(ObjectId(str(diction['inscrit_id'])))
convention_dictionnary_data = {}
new_diction = {}
new_diction['token'] = str(mytoken)
new_diction['list_stagiaire_id'] = []
new_diction['list_session_id'] = []
new_diction['list_class_id'] = []
new_diction['list_client_id'] = []
new_diction['list_candidat_admission_id'] = tab_candidat
local_status, local_retval = mycommon.Get_Dictionnary_data_For_Template(new_diction)
if (local_status is False):
return local_status, local_retval
local_retval['relance_document'] = admission_setup_document_data
body = {
"params": local_retval,
}
# Recuperation des donnes smtp
local_stpm_status, partner_SMTP_COUNT_smtpsrv, partner_own_smtp_value, partner_SMTP_COUNT_password, partner_SMTP_COUNT_user, partner_SMTP_COUNT_From_User, partner_SMTP_COUNT_port = mycommon.Get_Partner_SMTP_Param(
my_partner['recid'])
if (local_stpm_status is False):
return local_stpm_status, partner_SMTP_COUNT_smtpsrv
## Creation du mail au format email
corps_mail_Template = jinja2.Template(str(courrier_data_retval['contenu_doc']))
sourceHtml = corps_mail_Template.render(params=body["params"])
html_mime = MIMEText(sourceHtml, 'html')
# Traitement du sujet du mail
sujet_mail_Template = jinja2.Template(str(courrier_data_retval['sujet']))
sujetHtml = sujet_mail_Template.render(params=body["params"])
# Creation de l'email à enoyer
msg = MIMEMultipart("alternative")
msg.attach(html_mime)
msg['From'] = partner_SMTP_COUNT_From_User
msg['Bcc'] = 'contact@mysy-training.com'
msg['Subject'] = sujetHtml
# Attacher l'eventuelle pièces jointes
msg['to'] = str(candidat_data['email'])
smtpserver = smtplib.SMTP(partner_SMTP_COUNT_smtpsrv, partner_SMTP_COUNT_port)
smtpserver.ehlo()
smtpserver.starttls()
smtpserver.login(partner_SMTP_COUNT_user, partner_SMTP_COUNT_password)
val = smtpserver.send_message(msg)
smtpserver.close()
print(" Email envoyé " + str(val))
"""
Mettre à jour les relances
"""
node = {}
document_code = ""
document_desc = ""
if( "code" in admission_setup_document_data.keys()):
document_code = admission_setup_document_data['code']
if ("description" in admission_setup_document_data.keys()):
document_desc = admission_setup_document_data['description']
now = str(datetime.now().strftime("%d/%m/%Y %H:%M:%S"))
node['document_id'] = str(admission_setup_document_data['_id'])
node['document_code'] = document_code
node['document_desc'] = document_desc
node['document_date_relance'] = now
node['document_type_relance'] = "email"
node['document_relance_by'] = str(my_partner['_id'])
relance_by_nom = ""
if( "nom" in my_partner.keys()):
relance_by_nom = my_partner['nom']
relance_by_email = ""
if ("email" in my_partner.keys()):
relance_by_email = my_partner['email']
node['relance_by_nom'] = str(relance_by_nom)
node['relance_by_email'] = str(relance_by_email)
update = MYSY_GV.dbname['admission_session_inscrit'].update_one( {'_id': ObjectId(str(diction['inscrit_id'])),
'valide': '1',
'partner_owner_recid': str(my_partner['recid'])},
{
'$push': {
"relances_document": {'$each': [node]},
}
},
)
return True, "L'email de relance a été correctement envoyé "
except Exception as e:
exc_type, exc_obj, exc_tb = sys.exc_info()
print(str(inspect.stack()[0][3]) + " -" + str(e) + " - ERRORRRR AT Line : " + str(exc_tb.tb_lineno))
return False, "Impossible d'envoyer l'email de relance "