parent
79ca3fb207
commit
020b3b4bbf
|
@ -1,12 +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="14/05/2025 - 20h">
|
||||
<list default="true" id="c6d0259a-16e1-410d-91a1-830590ee2a08" name="Changes" comment="16/05/2025 - 18h">
|
||||
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/Dashbord_queries/inscription_tdb_qries.py" beforeDir="false" afterPath="$PROJECT_DIR$/Dashbord_queries/inscription_tdb_qries.py" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/Log/log_file.log" beforeDir="false" afterPath="$PROJECT_DIR$/Log/log_file.log" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/Session_Formation.py" beforeDir="false" afterPath="$PROJECT_DIR$/Session_Formation.py" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/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$/partner_document_mgt.py" beforeDir="false" afterPath="$PROJECT_DIR$/partner_document_mgt.py" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/prj_common.py" beforeDir="false" afterPath="$PROJECT_DIR$/prj_common.py" afterDir="false" />
|
||||
</list>
|
||||
<option name="SHOW_DIALOG" value="false" />
|
||||
<option name="HIGHLIGHT_CONFLICTS" value="true" />
|
||||
|
@ -83,13 +85,6 @@
|
|||
<option name="presentableId" value="Default" />
|
||||
<updated>1680804787304</updated>
|
||||
</task>
|
||||
<task id="LOCAL-00412" summary="29/10/2024 - 18h30">
|
||||
<created>1730223616262</created>
|
||||
<option name="number" value="00412" />
|
||||
<option name="presentableId" value="LOCAL-00412" />
|
||||
<option name="project" value="LOCAL" />
|
||||
<updated>1730223616262</updated>
|
||||
</task>
|
||||
<task id="LOCAL-00413" summary="qsd">
|
||||
<created>1731268257056</created>
|
||||
<option name="number" value="00413" />
|
||||
|
@ -426,7 +421,14 @@
|
|||
<option name="project" value="LOCAL" />
|
||||
<updated>1747251650255</updated>
|
||||
</task>
|
||||
<option name="localTasksCounter" value="461" />
|
||||
<task id="LOCAL-00461" summary="16/05/2025 - 18h">
|
||||
<created>1747413794844</created>
|
||||
<option name="number" value="00461" />
|
||||
<option name="presentableId" value="LOCAL-00461" />
|
||||
<option name="project" value="LOCAL" />
|
||||
<updated>1747413794844</updated>
|
||||
</task>
|
||||
<option name="localTasksCounter" value="462" />
|
||||
<servers />
|
||||
</component>
|
||||
<component name="Vcs.Log.Tabs.Properties">
|
||||
|
@ -468,7 +470,6 @@
|
|||
</option>
|
||||
</component>
|
||||
<component name="VcsManagerConfiguration">
|
||||
<MESSAGE value="01/02/2025 - 20h" />
|
||||
<MESSAGE value="06-02-2025 - new_design_2025" />
|
||||
<MESSAGE value="08/02/205 - 22h30" />
|
||||
<MESSAGE value="10/02/205 - 21h" />
|
||||
|
@ -493,6 +494,7 @@
|
|||
<MESSAGE value="13/05/2025 - 17h" />
|
||||
<MESSAGE value="13/05/2025 - 20h" />
|
||||
<MESSAGE value="14/05/2025 - 20h" />
|
||||
<option name="LAST_COMMIT_MESSAGE" value="14/05/2025 - 20h" />
|
||||
<MESSAGE value="16/05/2025 - 18h" />
|
||||
<option name="LAST_COMMIT_MESSAGE" value="16/05/2025 - 18h" />
|
||||
</component>
|
||||
</project>
|
1318
Log/log_file.log
1318
Log/log_file.log
File diff suppressed because it is too large
Load Diff
|
@ -6793,7 +6793,6 @@ Depuis la session, l'utilisateur choisi le modele PDF et
|
|||
telecharge les conventions d'entreprise et les conventions individuelles.
|
||||
|
||||
On créé un fichier zip qui sera téléchargé avec toutes les pièces jointes
|
||||
|
||||
"""
|
||||
def Prepare_and_Send_Convocation_From_Session_By_PDF(diction):
|
||||
try:
|
||||
|
@ -6899,14 +6898,12 @@ def Prepare_and_Send_Convocation_From_Session_By_PDF(diction):
|
|||
return True, send_file(zip_file_name, as_attachment=True)
|
||||
|
||||
|
||||
return False, " Impossible de générer les conventions par pdf PDF (1) "
|
||||
|
||||
|
||||
return False, " Impossible de générer les convocations par PDF (1) "
|
||||
|
||||
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 générer les conventions par pdf PDF "
|
||||
return False, " Impossible de générer les convocations par PDF "
|
||||
|
||||
|
||||
"""
|
||||
|
|
435
jury_mgt.py
435
jury_mgt.py
|
@ -24,6 +24,7 @@ from bson import ObjectId
|
|||
import re
|
||||
from datetime import datetime, date
|
||||
|
||||
import module_editique
|
||||
import partner_client
|
||||
import prj_common as mycommon
|
||||
import secrets
|
||||
|
@ -954,7 +955,7 @@ def Delete_Jury_Seance(diction):
|
|||
"""
|
||||
Verification des input acceptés
|
||||
"""
|
||||
field_list = ['token', 'jury_id', 'jury_seance_agenda_id']
|
||||
field_list = ['token', 'jury_id', 'jury_soutenance_id', ]
|
||||
|
||||
incom_keys = diction.keys()
|
||||
for val in incom_keys:
|
||||
|
@ -966,7 +967,7 @@ def Delete_Jury_Seance(diction):
|
|||
"""
|
||||
Verification des champs obligatoires
|
||||
"""
|
||||
field_list_obligatoire = ['token', 'jury_id', 'jury_seance_agenda_id']
|
||||
field_list_obligatoire = ['token', 'jury_id', 'jury_soutenance_id']
|
||||
|
||||
for val in field_list_obligatoire:
|
||||
if val not in diction:
|
||||
|
@ -1001,19 +1002,25 @@ def Delete_Jury_Seance(diction):
|
|||
|
||||
# Supprenant des apprenants associée à cette seance du jury
|
||||
jury_seance_apprenant = MYSY_GV.dbname['jury_apprenant'].delete_many({'jury_id': str(diction['jury_id']),
|
||||
'jury_soutenance_id': str(diction['jury_soutenance_id']),
|
||||
'partner_owner_recid': str(
|
||||
my_partner['recid']),
|
||||
}, )
|
||||
|
||||
# Suppression de l'entrée agenda associée
|
||||
jury_seance_agenda_data = MYSY_GV.dbname['agenda'].find_one({'related_collection': 'jury',
|
||||
'related_collection_recid': str(diction['jury_id']),
|
||||
jury_seance_agenda_data = MYSY_GV.dbname['agenda'].find_one({'related_collection': 'jury_soutenance',
|
||||
'related_collection_recid': str(diction['jury_soutenance_id']),
|
||||
'partner_owner_recid': str(my_partner['recid']),
|
||||
}, )
|
||||
|
||||
|
||||
jury_seance_agenda = MYSY_GV.dbname['agenda'].delete_one({'related_collection':'jury',
|
||||
'related_collection_recid': str(diction['jury_id']),
|
||||
jury_seance_agenda = MYSY_GV.dbname['agenda'].delete_one({'related_collection':'jury_soutenance',
|
||||
'related_collection_recid': str(diction['jury_soutenance_id']),
|
||||
'partner_owner_recid': str( my_partner['recid']),
|
||||
}, )
|
||||
|
||||
jury_soutenance = MYSY_GV.dbname['jury_soutenance'].delete_one({'_id': ObjectId(str(diction['jury_soutenance_id'])),
|
||||
'jury_id': str(diction['jury_id']),
|
||||
'partner_owner_recid': str(my_partner['recid']),
|
||||
}, )
|
||||
|
||||
|
@ -1032,7 +1039,7 @@ def Delete_Jury_Seance(diction):
|
|||
history_event_dict['action_date'] = str(now)
|
||||
|
||||
|
||||
history_event_dict['action_description'] = "Suppression de la séance du jury Titre : "+str(jury_seance_agenda_data['event_title'])+" du " + str(jury_seance_agenda_data['event_start'])+", au = "+ str(jury_seance_agenda_data['event_end'])
|
||||
history_event_dict['action_description'] = "Suppression de la soutenance du jury du " + str(jury_seance_agenda_data['event_start'])+", au = "+ str(jury_seance_agenda_data['event_end'])
|
||||
|
||||
local_status, local_retval = mycommon.Collection_Historique.Add_Historique_Event(history_event_dict)
|
||||
if (local_status is False):
|
||||
|
@ -1527,6 +1534,13 @@ def Get_List_jury_With_Filter(diction):
|
|||
|
||||
|
||||
"""
|
||||
|
||||
principe de base :
|
||||
- Si l'agenda_id et jury_soutenance_id = "new", alors on souhaite créer 3 choses en meme tmps :
|
||||
=> la soutenance
|
||||
=> l'agenda
|
||||
=> inscrire en meme tps les personnes
|
||||
|
||||
Cette fonction permet d'inscrire un apprenant 'inscrit_id' à un jury
|
||||
|
||||
/!\ : A un jury peux etre inscrit un apprenant dont l'inscription n'est pas totalement validé
|
||||
|
@ -1546,25 +1560,25 @@ def Add_Update_Apprenant_To_Jury(diction):
|
|||
Verification des input acceptés
|
||||
"""
|
||||
field_list = ['token', '_id', 'tab_inscriptions_ids', 'agenda_id', 'jury_seance_ue_id',
|
||||
'event_start', 'event_end']
|
||||
'event_start', 'event_end', 'jury_soutenance_id']
|
||||
|
||||
incom_keys = diction.keys()
|
||||
for val in incom_keys:
|
||||
if val not in field_list and val.startswith('my_') is False:
|
||||
mycommon.myprint(str(
|
||||
inspect.stack()[0][3]) + " Le champ '" + val + "' n'est pas autorisé")
|
||||
return False, " Les informations fournies sont incorrectes", False
|
||||
return False, " Les informations fournies sont incorrectes", False, False
|
||||
|
||||
"""
|
||||
Verification des champs obligatoires
|
||||
"""
|
||||
field_list_obligatoire = ['token', '_id',]
|
||||
field_list_obligatoire = ['token', '_id', 'agenda_id', 'jury_soutenance_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", False
|
||||
return False, " Les informations fournies sont incorrectes", False, False
|
||||
|
||||
"""
|
||||
Verification de l'identité et autorisation de l'entité qui
|
||||
|
@ -1577,12 +1591,11 @@ def Add_Update_Apprenant_To_Jury(diction):
|
|||
|
||||
local_status, my_partner = mycommon.Check_Connexion_And_Return_Partner_Data(diction)
|
||||
if (local_status is not True):
|
||||
return local_status, my_partner, False
|
||||
return local_status, my_partner, False, False
|
||||
|
||||
new_data = diction
|
||||
|
||||
# Verifier que le groupe existe et est valide
|
||||
|
||||
qry = {'_id': ObjectId(str(diction['_id'])),
|
||||
'valide': '1',
|
||||
'partner_owner_recid': str(my_partner['recid'])}
|
||||
|
@ -1597,7 +1610,7 @@ def Add_Update_Apprenant_To_Jury(diction):
|
|||
if (is_existe_groupe != 1):
|
||||
mycommon.myprint(
|
||||
str(inspect.stack()[0][3]) + " L'identifiant du jury est invalide ")
|
||||
return False, " L'identifiant du jury est invalide ", False
|
||||
return False, " L'identifiant du jury est invalide ", False, False
|
||||
|
||||
jury_data = MYSY_GV.dbname['jury'].find_one(
|
||||
{'_id': ObjectId(str(diction['_id'])),
|
||||
|
@ -1620,13 +1633,79 @@ def Add_Update_Apprenant_To_Jury(diction):
|
|||
if (my_inscription_is_valide != 1):
|
||||
mycommon.myprint(
|
||||
str(inspect.stack()[0][3]) + " L'inscription_id '" + my_inscription + "' est invalide ")
|
||||
return False, " L'inscription_id '" + my_inscription + "' est invalide ", False
|
||||
|
||||
return False, " L'inscription_id '" + my_inscription + "' est invalide ", False, False
|
||||
|
||||
soutenance_inserted_id = str(diction['jury_soutenance_id'])
|
||||
agenda_inserted_id = str(diction['agenda_id'])
|
||||
|
||||
is_fisrt_aganda_creation = ""
|
||||
# Verfifier la validité de l'agenda
|
||||
|
||||
if( "agenda_id" in diction.keys() and diction['agenda_id']):
|
||||
|
||||
if( str(diction['agenda_id']).lower() == "new" and str(diction['jury_soutenance_id']).lower() == "new" ):
|
||||
is_fisrt_aganda_creation = "1"
|
||||
|
||||
# Il s'agit d'un primo creation, il faut créer l'agenda et la soutenance
|
||||
new_soutenance_data = {}
|
||||
new_soutenance_data['jury_id'] = str(diction['_id'])
|
||||
new_soutenance_data['locked'] = "0"
|
||||
new_soutenance_data['valide'] = "1"
|
||||
new_soutenance_data['partner_owner_recid'] = str(my_partner['recid'])
|
||||
new_soutenance_data['sujet'] = ""
|
||||
new_soutenance_data['observation'] = ""
|
||||
new_soutenance_data['note'] = ""
|
||||
new_soutenance_data['create_date'] = str(datetime.now())
|
||||
new_soutenance_data['created_by'] = str(my_partner['_id'])
|
||||
|
||||
|
||||
soutenance_inserted_id = MYSY_GV.dbname['jury_soutenance'].insert_one(new_soutenance_data).inserted_id
|
||||
if (not soutenance_inserted_id):
|
||||
mycommon.myprint(
|
||||
" Impossible de créer la soutenance (2) ")
|
||||
return False, " Impossible de créer la soutenance (2) ", False, False
|
||||
|
||||
# Creation de l'entrée agenda
|
||||
if (datetime.strptime(str(diction['event_start'])[0:16], '%Y-%m-%dT%H:%M') >= datetime.strptime(
|
||||
str(diction['event_end'])[0:16],
|
||||
'%Y-%m-%dT%H:%M')):
|
||||
mycommon.myprint(
|
||||
str(inspect.stack()[0][
|
||||
3]) + " La date de fin " + str(
|
||||
diction['event_end']) + " doit être postérieure à la date de début " + str(
|
||||
diction['event_start']) + " ")
|
||||
return False, " La date de fin " + str(
|
||||
diction['event_end']) + " doit être postérieure à la date de début " + str(
|
||||
diction['event_start']) + " ", False, False
|
||||
|
||||
my_even_data = {}
|
||||
my_even_data['related_collection'] = "jury_soutenance"
|
||||
my_even_data['related_collection_recid'] = str(soutenance_inserted_id)
|
||||
my_even_data['event_title'] = "Jury : " + str(jury_data['code'])
|
||||
my_even_data['event_start'] = str(diction['event_start'])
|
||||
my_even_data['event_end'] = str(diction['event_end'])
|
||||
|
||||
my_even_data['valide'] = "1"
|
||||
my_even_data['locked'] = "0"
|
||||
my_even_data['partner_owner_recid'] = str(my_partner['recid'])
|
||||
|
||||
|
||||
my_even_data['create_date'] = str(datetime.now())
|
||||
my_even_data['created_by'] = str(my_partner['_id'])
|
||||
agenda_inserted_id = MYSY_GV.dbname['agenda'].insert_one(my_even_data).inserted_id
|
||||
|
||||
|
||||
### Mettre à jour la soutenance avec l'id de l'agenda
|
||||
|
||||
|
||||
MYSY_GV.dbname['jury_soutenance'].find_one_and_update({'_id':ObjectId(soutenance_inserted_id), 'partner_owner_recid':str(my_partner['recid'])},
|
||||
{"$set": {'agenda_id': str( agenda_inserted_id), }},
|
||||
return_document=ReturnDocument.AFTER,
|
||||
upsert=False,
|
||||
)
|
||||
|
||||
|
||||
else:
|
||||
|
||||
is_agenda_valide = MYSY_GV.dbname['agenda'].count_documents(
|
||||
{'_id': ObjectId(str(diction['agenda_id'])),
|
||||
'partner_owner_recid': str(my_partner['recid'])})
|
||||
|
@ -1634,7 +1713,16 @@ def Add_Update_Apprenant_To_Jury(diction):
|
|||
if (is_agenda_valide != 1):
|
||||
mycommon.myprint(
|
||||
str(inspect.stack()[0][3]) + " L'identifiant de l'agenda est invalide ")
|
||||
return False, " L'identifiant de l'agenda est invalide ", False
|
||||
return False, " L'identifiant de l'agenda est invalide ", False, False
|
||||
|
||||
is_soutenance_valide = MYSY_GV.dbname['jury_soutenance'].count_documents(
|
||||
{'_id': ObjectId(str(diction['jury_soutenance_id'])),
|
||||
'partner_owner_recid': str(my_partner['recid'])})
|
||||
|
||||
if (is_soutenance_valide != 1):
|
||||
mycommon.myprint(
|
||||
str(inspect.stack()[0][3]) + " L'identifiant de la soutenance est invalide ")
|
||||
return False, " L'identifiant de la soutenance est invalide ", False, False
|
||||
|
||||
|
||||
|
||||
|
@ -1649,12 +1737,13 @@ def Add_Update_Apprenant_To_Jury(diction):
|
|||
if (is_ue_valide != 1):
|
||||
mycommon.myprint(
|
||||
str(inspect.stack()[0][3]) + " L'identifiant de l'unité d'enseignement est invalide ")
|
||||
return False, " L'identifiant de l'unité d'enseignement est invalide ", False
|
||||
return False, " L'identifiant de l'unité d'enseignement est invalide ", False, False
|
||||
|
||||
final_agenda_id = ""
|
||||
|
||||
|
||||
# Vu que l'ID de l'agenda est valide, on va faire une mise à jour du creneau (on le fait dans tous les cas)
|
||||
if( is_fisrt_aganda_creation != "1"):
|
||||
if (datetime.strptime(str(diction['event_start'])[0:16], '%Y-%m-%dT%H:%M') >= datetime.strptime(
|
||||
str(diction['event_end'])[0:16],
|
||||
'%Y-%m-%dT%H:%M')):
|
||||
|
@ -1691,19 +1780,13 @@ def Add_Update_Apprenant_To_Jury(diction):
|
|||
final_agenda_id = str(diction['agenda_id'])
|
||||
|
||||
|
||||
else:
|
||||
my_even_data['create_date'] = str(datetime.now())
|
||||
my_even_data['created_by'] = str(my_partner['_id'])
|
||||
inserted_id = MYSY_GV.dbname['agenda'].insert_one(my_even_data).inserted_id
|
||||
final_agenda_id = str(inserted_id)
|
||||
|
||||
cpt = 0
|
||||
for my_inscription in tab_inscriptions_ids_splited:
|
||||
new_data = {}
|
||||
new_data['jury_id'] = str(diction['_id'])
|
||||
new_data['inscription_id'] = str(my_inscription)
|
||||
new_data['agenda_id'] = str(final_agenda_id)
|
||||
new_data['jury_seance_ue_id'] = str(diction['jury_seance_ue_id'])
|
||||
new_data['agenda_id'] = str(agenda_inserted_id)
|
||||
new_data['jury_soutenance_id'] = str(soutenance_inserted_id)
|
||||
|
||||
now = str(datetime.now())
|
||||
mytoday = datetime.today()
|
||||
|
@ -1734,19 +1817,19 @@ def Add_Update_Apprenant_To_Jury(diction):
|
|||
|
||||
if (result is None or "_id" not in result.keys()):
|
||||
mycommon.myprint(
|
||||
" Impossible d'inscrire les personnes au groupe (2) ")
|
||||
return False, " Impossible d'inscrire les personnes au groupe (2) ", False
|
||||
" Impossible créer la soutenance et/ou inscrire les personnes (2) ")
|
||||
return False, " Impossible créer la soutenance et/ou inscrire les personnes (2) ", False, False
|
||||
|
||||
|
||||
cpt = cpt + 1
|
||||
|
||||
return True, str(cpt)+ " Membre(s) inscrit(s)", str(final_agenda_id)
|
||||
return True, str(cpt)+ " Membre(s) inscrit(s)", str(agenda_inserted_id), str(soutenance_inserted_id)
|
||||
|
||||
|
||||
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'inscrire les personnes au jury ", False
|
||||
return False, " Impossible créer la soutenance et/ou inscrire les personnes ", False , False
|
||||
|
||||
|
||||
|
||||
|
@ -1760,7 +1843,7 @@ def Get_Given_Jury_Apprenant_With_Filter(diction):
|
|||
"""
|
||||
Verification des input acceptés
|
||||
"""
|
||||
field_list = ['token', '_id', 'agenda_id', 'ue_id']
|
||||
field_list = ['token', '_id', 'agenda_id', 'ue_id', 'jury_soutenance_id']
|
||||
|
||||
incom_keys = diction.keys()
|
||||
for val in incom_keys:
|
||||
|
@ -1805,6 +1888,9 @@ def Get_Given_Jury_Apprenant_With_Filter(diction):
|
|||
if ("ue_id" in diction.keys() and diction['ue_id']):
|
||||
qry["ue_id"] = str(diction['ue_id'])
|
||||
|
||||
if ("jury_soutenance_id" in diction.keys() and diction['jury_soutenance_id']):
|
||||
qry["jury_soutenance_id"] = str(diction['jury_soutenance_id'])
|
||||
|
||||
|
||||
|
||||
#print(" ### Get_Given_Jury_Apprenant_With_Filter QRY = ",qry )
|
||||
|
@ -2127,13 +2213,42 @@ def Get_List_Jury_Soutenenace(diction):
|
|||
data_cle['partner_owner_recid'] = str(my_partner['recid'])
|
||||
data_cle['valide'] = "1"
|
||||
data_cle['locked'] = "0"
|
||||
data_cle['jury_id'] = str(diction['jury_id'])
|
||||
|
||||
print(" ## data cle = ", data_cle)
|
||||
|
||||
RetObject = []
|
||||
val_tmp = 0
|
||||
|
||||
for retval in MYSY_GV.dbname['jury_soutenance'].find(data_cle).sort([("_id", pymongo.DESCENDING), ]):
|
||||
user = retval
|
||||
|
||||
# Recuperation des agenda associés
|
||||
soutenance_agenda_id = ""
|
||||
soutenance_agenda_event_title = ""
|
||||
soutenance_agenda_event_start = ""
|
||||
soutenance_agenda_event_end = ""
|
||||
if( "agenda_id" in retval.keys() and retval['agenda_id'] ):
|
||||
agenda_data = MYSY_GV.dbname['agenda'].find_one({'_id':ObjectId(str(retval['agenda_id'])),
|
||||
'valide':'1',
|
||||
'locked':'0',
|
||||
'partner_owner_recid':str(my_partner['recid'])},
|
||||
{'_id':1, 'event_start':1, 'event_end':1, 'event_title':1})
|
||||
|
||||
|
||||
|
||||
soutenance_agenda_id = str(agenda_data['_id'])
|
||||
soutenance_agenda_event_start = str(agenda_data['event_start'])
|
||||
soutenance_agenda_event_end = str(agenda_data['event_end'])
|
||||
soutenance_agenda_event_title = str(agenda_data['event_title'])
|
||||
|
||||
user['soutenance_agenda_id'] = soutenance_agenda_id
|
||||
user['soutenance_agenda_event_start'] = soutenance_agenda_event_start
|
||||
user['soutenance_agenda_event_end'] = soutenance_agenda_event_end
|
||||
user['soutenance_agenda_event_title'] = soutenance_agenda_event_title
|
||||
|
||||
|
||||
|
||||
user['id'] = str(val_tmp)
|
||||
val_tmp = val_tmp + 1
|
||||
|
||||
|
@ -2166,6 +2281,8 @@ def Get_List_Jury_Soutenenace(diction):
|
|||
user['list_inscrit'] = jury_apprenant
|
||||
|
||||
|
||||
|
||||
|
||||
RetObject.append(mycommon.JSONEncoder().encode(user))
|
||||
|
||||
return True, RetObject
|
||||
|
@ -2339,3 +2456,257 @@ def Delete_Given_Jury_Soutenenace(diction):
|
|||
mycommon.myprint(str(inspect.stack()[0][3]) + " -" + str(e) + " - Line : " + str(exc_tb.tb_lineno))
|
||||
return False, " Impossible de supprimer la soutenance"
|
||||
|
||||
|
||||
"""
|
||||
Cette fonction permet de telecharger (PDF) la convocation des apprenants concernés
|
||||
par une soutenance du jury
|
||||
"""
|
||||
def Send_Jury_Apprenant_Soutenance_Convocation_By_PDF(diction):
|
||||
try:
|
||||
field_list_obligatoire = ['token', 'jury_id', 'jury_soutenance_id', 'courrier_template_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, " La valeur '" + val + "' n'est pas presente dans la liste des arguments"
|
||||
|
||||
my_token = ""
|
||||
if ("token" in diction.keys()):
|
||||
if diction['token']:
|
||||
my_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 que la jury_soutenance_id et jury_id sont valides
|
||||
is_jury_soutenance_valide = MYSY_GV.dbname['jury_soutenance'].count_documents(
|
||||
{'_id': ObjectId(str(diction['jury_soutenance'])),
|
||||
'valide': '1',
|
||||
'locked':'0',
|
||||
'jury_id':str(diction['jury_id']),
|
||||
'partner_owner_recid': str(my_partner['recid'])})
|
||||
|
||||
if (is_jury_soutenance_valide != 1):
|
||||
mycommon.myprint(
|
||||
str(inspect.stack()[0][
|
||||
3]) + " L'identifiant de la soutenance est invalide ")
|
||||
return False, " L'identifiant de la soutenance est invalide "
|
||||
|
||||
jury_soutenance_data = MYSY_GV.dbname['jury_soutenance'].find_one(
|
||||
{'_id': ObjectId(str(diction['jury_soutenance'])),
|
||||
'valide': '1',
|
||||
'locked': '0',
|
||||
'jury_id': str(diction['jury_id']),
|
||||
'partner_owner_recid': str(my_partner['recid'])})
|
||||
|
||||
|
||||
# Recupération des données du modèle de document
|
||||
is_convention_by_client = "0"
|
||||
courrier_template_data = MYSY_GV.dbname['courrier_template'].find_one(
|
||||
{'_id': ObjectId(str(diction['courrier_template_id'])),
|
||||
'valide': '1',
|
||||
'locked': '0',
|
||||
'partner_owner_recid': str(my_partner['recid'])}
|
||||
)
|
||||
|
||||
if(courrier_template_data is None ):
|
||||
mycommon.myprint(
|
||||
str(inspect.stack()[0][
|
||||
3]) + " L'identifiant du modèle de courrier est invalide ")
|
||||
return False, " L'identifiant du modèle de courrier est invalide "
|
||||
|
||||
|
||||
if("contenu_doc" not in courrier_template_data.keys() or len(str(courrier_template_data['contenu_doc'])) <= 0 ):
|
||||
mycommon.myprint(
|
||||
str(inspect.stack()[0][
|
||||
3]) + " contenu_doc : La configuration du modèle de courrier est invalide ")
|
||||
return False, " contenu_doc : La configuration du modèle de courrier est invalide "
|
||||
|
||||
|
||||
"""
|
||||
Recuperer la liste des inscrits concernés par la soutenance
|
||||
"""
|
||||
tab_soutenance_inscrit = []
|
||||
for tmp in MYSY_GV.dbname['jury_apprenant'].find({'jury_id':str(diction['jury_id']),
|
||||
'valide':'1',
|
||||
'locked':'0',
|
||||
'agenda_id':str(jury_soutenance_data['agenda_id']),
|
||||
'partner_owner_recid':str(my_partner['recid'])}):
|
||||
tab_soutenance_inscrit.append(str(tmp['inscription_id']))
|
||||
|
||||
|
||||
# Stokage des nom de fichier à zipper
|
||||
list_file_name_to_zip = []
|
||||
|
||||
for val in tab_soutenance_inscrit:
|
||||
local_diction = {}
|
||||
# field_list_obligatoire = ['token', 'session_id', 'courrier_template_id', 'client_id']
|
||||
local_diction['token'] = diction['token']
|
||||
local_diction['jury_soutenance_id'] = diction['jury_soutenance_id']
|
||||
local_diction['courrier_template_id'] = diction['courrier_template_id']
|
||||
local_diction['inscription_id'] = str(val['inscription_id'])
|
||||
|
||||
#print(" #### Traitemnt de local_diction bb = ", local_diction)
|
||||
local_status, local_full_file_name = Create_Jury_Soutenance_Convocation_By_Inscrit_PDF(local_diction)
|
||||
if( local_status is False):
|
||||
return local_status, local_full_file_name
|
||||
else:
|
||||
list_file_name_to_zip.append(str(local_full_file_name))
|
||||
|
||||
|
||||
# Create a ZipFile Object
|
||||
todays_date = str(date.today().strftime("%d/%m/%Y"))
|
||||
ts = datetime.now().timestamp()
|
||||
ts = str(ts).replace(".", "").replace(",", "")[-3:]
|
||||
zip_file_name = str(MYSY_GV.TEMPORARY_DIRECTORY_V2) + "List_Convocation_Jury_" + str(ts) + ".zip"
|
||||
|
||||
if os.path.exists(zip_file_name):
|
||||
# print(" ### ok os.path.exists(outputFilename) "+str(outputFilename))
|
||||
|
||||
return True, send_file(zip_file_name, as_attachment=True)
|
||||
|
||||
|
||||
return False, " Impossible de générer les convocations jury par PDF (1) "
|
||||
|
||||
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 générer les convocations jury par PDF"
|
||||
|
||||
|
||||
"""
|
||||
Cette fonction créer une convocation à une soutenance de Jury PDF pour un inscrit et retourne le document
|
||||
"""
|
||||
def Create_Jury_Soutenance_Convocation_By_Inscrit_PDF(diction):
|
||||
try:
|
||||
field_list_obligatoire = ['token', 'jury_soutenance_id', 'courrier_template_id', 'inscription_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, " La valeur '" + val + "' n'est pas presente dans la liste des arguments"
|
||||
|
||||
my_token = ""
|
||||
if ("token" in diction.keys()):
|
||||
if diction['token']:
|
||||
my_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
|
||||
|
||||
qry = {'_id':ObjectId(str(diction['courrier_template_id'])),
|
||||
'valide':'1',
|
||||
'locked':'0',
|
||||
'ref_interne': 'JURY_CONVOCATION_APPRENANT',
|
||||
'partner_owner_recid':str(my_partner['recid'])}
|
||||
|
||||
#print(" ##### qry = ", qry)
|
||||
|
||||
# 1 - Verifier que le modele de courrier est bien editable par individu
|
||||
template_courrier_data = MYSY_GV.dbname['courrier_template'].find_one({'_id':ObjectId(str(diction['courrier_template_id'])),
|
||||
'valide':'1',
|
||||
'locked':'0',
|
||||
'ref_interne': 'JURY_CONVOCATION_APPRENANT',
|
||||
'partner_owner_recid':str(my_partner['recid'])})
|
||||
|
||||
if( template_courrier_data is None ):
|
||||
mycommon.myprint(
|
||||
str(inspect.stack()[0][
|
||||
3]) + " L'identifiant du modèle de courrier est invalide ")
|
||||
return False, " L'identifiant du modèle de courrier est invalide "
|
||||
|
||||
|
||||
|
||||
|
||||
# Verifier que l'inscrit est valide
|
||||
local_qry = {'_id':ObjectId(str(diction['inscription_id'])), 'status':'1',
|
||||
'partner_owner_recid':str(my_partner['recid'])}
|
||||
|
||||
statgiaire_data = MYSY_GV.dbname['inscription'].find_one({'_id':ObjectId(str(diction['inscription_id'])), 'status':'1',
|
||||
'partner_owner_recid':str(my_partner['recid'])})
|
||||
|
||||
if (statgiaire_data is None ):
|
||||
mycommon.myprint(
|
||||
str(inspect.stack()[0][
|
||||
3]) + " L'identifiant du stagiaire est invalide ")
|
||||
return False, " L'identifiant du stagiaire est invalide "
|
||||
|
||||
tab_stagiaire = []
|
||||
tab_stagiaire.append(statgiaire_data['_id'])
|
||||
|
||||
|
||||
# Verifier que la soutenance est valide
|
||||
jury_soutenance_data = MYSY_GV.dbname['jury_soutenance'].find_one(
|
||||
{'_id': ObjectId(str(diction['jury_soutenance_id'])), 'valide': '1', 'partner_owner_recid': str(my_partner['recid'])})
|
||||
|
||||
if (jury_soutenance_data is None):
|
||||
mycommon.myprint(
|
||||
str(inspect.stack()[0][
|
||||
3]) + " L'identifiant de la soutenance est invalide ")
|
||||
return False, " L'identifiant de la soutenance est invalide "
|
||||
|
||||
tab_soutenance = []
|
||||
tab_soutenance.append(jury_soutenance_data['_id'])
|
||||
|
||||
|
||||
|
||||
# Creation du dictionnaire d'information à utiliser pour la creation du doc
|
||||
convention_dictionnary_data = {}
|
||||
new_diction = {}
|
||||
new_diction['token'] = diction['token']
|
||||
new_diction['list_stagiaire_id'] = tab_stagiaire
|
||||
new_diction['list_session_id'] = []
|
||||
new_diction['list_class_id'] = []
|
||||
new_diction['list_client_id'] = []
|
||||
new_diction['list_apprenant_id'] = []
|
||||
new_diction['list_jury_soutenance_id'] = tab_soutenance
|
||||
|
||||
local_status, local_retval = mycommon.Get_Dictionnary_data_For_Template(new_diction)
|
||||
|
||||
if (local_status is False):
|
||||
return local_status, local_retval
|
||||
|
||||
convention_dictionnary_data = local_retval
|
||||
|
||||
body = {
|
||||
"params": convention_dictionnary_data,
|
||||
}
|
||||
|
||||
"""
|
||||
Creation du ficier PDF
|
||||
"""
|
||||
contenu_doc_Template = jinja2.Template(str(template_courrier_data['contenu_doc']))
|
||||
|
||||
sourceHtml = contenu_doc_Template.render(params=body["params"])
|
||||
|
||||
todays_date = str(date.today().strftime("%d/%m/%Y"))
|
||||
ts = datetime.now().timestamp()
|
||||
ts = str(ts).replace(".", "").replace(",", "")[-5:]
|
||||
|
||||
orig_file_name = "Convocation_" + str(my_partner['recid'])[0:5] + "_" + str(ts) + ".pdf"
|
||||
outputFilename = str(MYSY_GV.TEMPORARY_DIRECTORY) + "/" + str(orig_file_name)
|
||||
|
||||
# open output file for writing (truncated binary)
|
||||
resultFile = open(outputFilename, "w+b")
|
||||
|
||||
# convert HTML to PDF
|
||||
pisaStatus = pisa.CreatePDF(
|
||||
src=sourceHtml, # the HTML to convert
|
||||
dest=resultFile) # file handle to receive result
|
||||
|
||||
# close output file
|
||||
resultFile.close()
|
||||
|
||||
return True, outputFilename
|
||||
|
||||
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 créer le fichier pdf de convocation du jury "
|
||||
|
||||
|
|
51
main.py
51
main.py
|
@ -6585,6 +6585,27 @@ def Get_List_Partner_Document_with_filter():
|
|||
|
||||
|
||||
|
||||
|
||||
"""
|
||||
API qui permet de récupérer la liste des documents personnalisables d'un partenaire avec filtre
|
||||
SANS retourner les champs :
|
||||
- contenu_doc
|
||||
- corps_mail
|
||||
"""
|
||||
@app.route('/myclass/api/Get_List_Partner_Document_with_filter_No_HTML_Fields/', methods=['POST','GET'])
|
||||
@crossdomain(origin='*')
|
||||
def Get_List_Partner_Document_with_filter_No_HTML_Fields():
|
||||
# On recupere le corps (payload) de la requete
|
||||
payload = mycommon.strip_dictionary (request.form.to_dict())
|
||||
print(" ### Get_List_Partner_Document_with_filter_No_HTML_Fields payload = ",payload)
|
||||
status, retval = partner_document_mgt.Get_List_Partner_Document_with_filter_No_HTML_Fields(payload)
|
||||
return jsonify(status=status, message=retval)
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
"""
|
||||
API qui permet de récupérer la liste des documents personnalisables d'un partenaire avec filtre en mode Super ADMIN
|
||||
"""
|
||||
|
@ -12508,8 +12529,8 @@ def Add_Update_Apprenant_To_Jury():
|
|||
# On recupere le corps (payload) de la requete
|
||||
payload = mycommon.strip_dictionary (request.form.to_dict())
|
||||
print(" ### Add_Update_Apprenant_To_Jury : payload = ",payload)
|
||||
localStatus, message, agenda_id= jury_mgt.Add_Update_Apprenant_To_Jury(payload)
|
||||
return jsonify(status=localStatus, message=message, agenda_id=agenda_id )
|
||||
localStatus, message, agenda_id, soutenance_id = jury_mgt.Add_Update_Apprenant_To_Jury(payload)
|
||||
return jsonify(status=localStatus, message=message, agenda_id=agenda_id, soutenance_id=soutenance_id )
|
||||
|
||||
|
||||
|
||||
|
@ -12598,6 +12619,32 @@ def Delete_Given_Jury_Soutenenace():
|
|||
return jsonify(status=localStatus, message=message )
|
||||
|
||||
|
||||
|
||||
"""
|
||||
API pour generer les convocation jury soutenance par PDF
|
||||
"""
|
||||
@app.route('/myclass/api/Send_Jury_Apprenant_Soutenance_Convocation_By_PDF/<token>/<jury_soutenance_id>/<courrier_template_id>', methods=['POST','GET'])
|
||||
@crossdomain(origin='*')
|
||||
def Send_Jury_Apprenant_Soutenance_Convocation_By_PDF(token, jury_soutenance_id, courrier_template_id):
|
||||
# On recupere le corps (payload) de la requete
|
||||
payload = mycommon.strip_dictionary (request.form.to_dict())
|
||||
payload = {}
|
||||
payload['token'] = str(token)
|
||||
if( str(jury_soutenance_id) != "-"):
|
||||
payload['jury_soutenance_id'] = str(jury_soutenance_id)
|
||||
|
||||
if (str(courrier_template_id) != "-"):
|
||||
payload['courrier_template_id'] = str(courrier_template_id)
|
||||
|
||||
print(" ### Send_Jury_Apprenant_Soutenance_Convocation_By_PDF : payload = ",str(payload))
|
||||
|
||||
localStatus, response= jury_mgt.Send_Jury_Apprenant_Soutenance_Convocation_By_PDF(payload)
|
||||
if(localStatus ):
|
||||
return response
|
||||
else:
|
||||
return False
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
print(" debut api")
|
||||
context = SSL.Context(SSL.SSLv23_METHOD)
|
||||
|
|
|
@ -1435,7 +1435,7 @@ def Get_List_Partner_Document_with_filter(diction):
|
|||
"""
|
||||
Verification des input acceptés
|
||||
"""
|
||||
field_list = ['token', 'nom', 'ref_interne', ]
|
||||
field_list = ['token', 'nom', 'ref_interne', 'type_doc' ]
|
||||
|
||||
incom_keys = diction.keys()
|
||||
for val in incom_keys:
|
||||
|
@ -1476,6 +1476,11 @@ def Get_List_Partner_Document_with_filter(diction):
|
|||
filt_ref_interne = {
|
||||
'ref_interne': {'$regex': str(diction['ref_interne']), "$options": "i"}}
|
||||
|
||||
filt_type_document = {}
|
||||
if ("type_doc" in diction.keys()):
|
||||
filt_type_document = {
|
||||
'type_doc': {'$regex': str(diction['type_document']), "$options": "i"}}
|
||||
|
||||
|
||||
|
||||
"""
|
||||
|
@ -1489,9 +1494,10 @@ def Get_List_Partner_Document_with_filter(diction):
|
|||
|
||||
|
||||
find_qry = {'$and': [ {'partner_owner_recid': str(my_partner['recid']), 'valide':'1', 'locked':'0' }, filt_nom,
|
||||
filt_ref_interne, ]}
|
||||
filt_ref_interne, filt_type_document]}
|
||||
|
||||
#print(" ### find_qry document = ", find_qry)
|
||||
|
||||
#print(" ### materiel find_qry = ", find_qry)
|
||||
RetObject = []
|
||||
val_tmp = 1
|
||||
|
||||
|
@ -1513,12 +1519,107 @@ def Get_List_Partner_Document_with_filter(diction):
|
|||
return False, " Impossible de récupérer la liste des modèles de document "
|
||||
|
||||
|
||||
|
||||
"""
|
||||
Recherche de la liste des modèles de document avec des .
|
||||
SANS retourner les champs :
|
||||
- contenu_doc
|
||||
- corps_mail
|
||||
"""
|
||||
def Get_List_Partner_Document_with_filter_No_HTML_Fields(diction):
|
||||
try:
|
||||
diction = mycommon.strip_dictionary(diction)
|
||||
|
||||
"""
|
||||
Verification des input acceptés
|
||||
"""
|
||||
field_list = ['token', 'nom', 'ref_interne', 'type_doc' ]
|
||||
|
||||
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 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
|
||||
|
||||
filt_nom = {}
|
||||
if ("nom" in diction.keys()):
|
||||
filt_nom = {'nom': {'$regex': str(diction['nom']), "$options": "i"}}
|
||||
|
||||
filt_ref_interne = {}
|
||||
if ("ref_interne" in diction.keys()):
|
||||
filt_ref_interne = {
|
||||
'ref_interne': {'$regex': str(diction['ref_interne']), "$options": "i"}}
|
||||
|
||||
filt_type_document = {}
|
||||
if ("type_doc" in diction.keys()):
|
||||
filt_type_document = {
|
||||
'type_doc': {'$regex': str(diction['type_doc']), "$options": "i"}}
|
||||
|
||||
"""
|
||||
Clés de mise à jour
|
||||
"""
|
||||
data_cle = {}
|
||||
data_cle['partner_owner_recid'] = str(my_partner['recid'])
|
||||
|
||||
data_cle['locked'] = "0"
|
||||
data_cle['valide'] = "1"
|
||||
|
||||
|
||||
find_qry = {'$and': [ {'partner_owner_recid': str(my_partner['recid']), 'valide':'1', 'locked':'0' }, filt_nom,
|
||||
filt_ref_interne, filt_type_document]}
|
||||
|
||||
#print(" ### find_qry document = ", find_qry)
|
||||
|
||||
RetObject = []
|
||||
val_tmp = 1
|
||||
|
||||
for retval in MYSY_GV.dbname['courrier_template'].find(find_qry, {'contenu_doc':0, 'corps_mail':0}).sort([("_id", pymongo.DESCENDING)]):
|
||||
user = retval
|
||||
user['id'] = str(val_tmp)
|
||||
val_tmp = val_tmp + 1
|
||||
if( "duplicate" not in retval.keys()):
|
||||
user['duplicate'] = "0"
|
||||
|
||||
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 modèles de document "
|
||||
|
||||
|
||||
|
||||
"""
|
||||
Recherche d'un document avec filter pour en mode super Admin
|
||||
"""
|
||||
"""
|
||||
Recherche de la liste des modèles de document avec des filter
|
||||
"""
|
||||
|
||||
def Get_List_Partner_Document_with_filter_Admin(diction):
|
||||
try:
|
||||
diction = mycommon.strip_dictionary(diction)
|
||||
|
|
116
prj_common.py
116
prj_common.py
|
@ -4637,7 +4637,7 @@ def clean_session_dates():
|
|||
"""
|
||||
Cette fonction retourne les champs a utiliser pour les template de document/
|
||||
|
||||
/!\ : Les tables en paramettres contiennent des valeurs du type ObjectId("idddd")
|
||||
/!\ : Les tables en paramettre contiennent des valeurs du type ObjectId("idddd")
|
||||
Cette fonction retour un json de ce type :
|
||||
|
||||
convention_dictionnary_data =
|
||||
|
@ -4664,7 +4664,7 @@ def Get_Dictionnary_data_For_Template(diction):
|
|||
Verification des input acceptés
|
||||
"""
|
||||
field_list = ['token', 'list_stagiaire_id', 'list_session_id', 'list_class_id', 'list_client_id',
|
||||
'list_apprenant_id', 'list_sequence_session_id']
|
||||
'list_apprenant_id', 'list_sequence_session_id', 'list_jury_soutenance_id']
|
||||
|
||||
incom_keys = diction.keys()
|
||||
for val in incom_keys:
|
||||
|
@ -5124,6 +5124,118 @@ def Get_Dictionnary_data_For_Template(diction):
|
|||
dictionnary_data['list_sequence_session_data'] = list_sequence_session_data
|
||||
|
||||
|
||||
|
||||
"""
|
||||
Recuperartion des champs de la soutenance de jury
|
||||
"""
|
||||
list_jury_soutenance_data = []
|
||||
if( "list_jury_soutenance_id" in diction.keys() and diction['list_jury_soutenance_id'] ):
|
||||
tab_jury_soutenance_id = diction['list_jury_soutenance_id']
|
||||
|
||||
|
||||
|
||||
query_soutenance_match = {'_id': {'$in': tab_jury_soutenance_id, }, 'valide': '1', 'locked':'0',
|
||||
'partner_owner_recid': str(my_partner['recid'])}
|
||||
|
||||
query_soutenance = [{'$match': query_soutenance_match},
|
||||
{'$lookup': {
|
||||
'from': 'jury',
|
||||
"let": {'jury_id': "$jury_id", 'partner_owner_recid': '$partner_owner_recid'},
|
||||
'pipeline': [
|
||||
{'$match':
|
||||
{'$expr':
|
||||
{'$and':
|
||||
[
|
||||
|
||||
{'$eq': ["$_id", {'$convert': {
|
||||
'input': "$$jury_id",
|
||||
'to': "objectId",
|
||||
'onError': {'error': 'true'},
|
||||
'onNull': {'isnull': 'true'}
|
||||
}}]},
|
||||
|
||||
{'$eq': ["$valide", "1"]},
|
||||
{'$eq': ["$partner_owner_recid", '$$partner_owner_recid']}
|
||||
|
||||
]
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
],
|
||||
'as': 'jury_collection'
|
||||
}
|
||||
},
|
||||
{'$lookup': {
|
||||
'from': 'agenda',
|
||||
"let": {'agenda_id': "$agenda_id", 'partner_owner_recid': '$partner_owner_recid'},
|
||||
'pipeline': [
|
||||
{'$match':
|
||||
{'$expr':
|
||||
{'$and':
|
||||
[
|
||||
|
||||
{'$eq': ["$_id", {'$convert': {
|
||||
'input': "$$agenda_id",
|
||||
'to': "objectId",
|
||||
'onError': {'error': 'true'},
|
||||
'onNull': {'isnull': 'true'}
|
||||
}}]},
|
||||
|
||||
{'$eq': ["$valide", "1"]},
|
||||
{'$eq': ["$partner_owner_recid", '$$partner_owner_recid']}
|
||||
|
||||
]
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
],
|
||||
'as': 'agenda_collection'
|
||||
}
|
||||
},
|
||||
]
|
||||
|
||||
|
||||
for jury_soutenance_data in MYSY_GV.dbname['jury_soutenance'].aggregate(query_soutenance):
|
||||
|
||||
|
||||
new_jury_soutenance_data = {}
|
||||
|
||||
if( "_id" in jury_soutenance_data.keys() ):
|
||||
new_jury_soutenance_data['jury_soutenance_id'] = jury_soutenance_data['_id']
|
||||
|
||||
if ("sujet" in jury_soutenance_data.keys()):
|
||||
new_jury_soutenance_data['jury_soutenance_sujet'] = jury_soutenance_data['sujet']
|
||||
|
||||
if ("observation" in jury_soutenance_data.keys()):
|
||||
new_jury_soutenance_data['jury_soutenance_observation'] = jury_soutenance_data['observation']
|
||||
|
||||
if ("note" in jury_soutenance_data.keys()):
|
||||
new_jury_soutenance_data['jury_soutenance_note'] = jury_soutenance_data['note']
|
||||
|
||||
if( "jury_collection" in jury_soutenance_data.keys() ):
|
||||
if( "code" in jury_soutenance_data["jury_collection"][0].keys() ):
|
||||
new_jury_soutenance_data['jury_code'] = jury_soutenance_data["jury_collection"][0]['code']
|
||||
|
||||
if ("description" in jury_soutenance_data["jury_collection"][0].keys()):
|
||||
new_jury_soutenance_data['jury_description'] = jury_soutenance_data["jury_collection"][0]['description']
|
||||
|
||||
if ("agenda_collection" in jury_soutenance_data.keys()):
|
||||
if ("event_start" in jury_soutenance_data["agenda_collection"][0].keys()):
|
||||
new_jury_soutenance_data['jury_soutenance_event_start'] = jury_soutenance_data["agenda_collection"][0]['event_start']
|
||||
|
||||
if ("event_end" in jury_soutenance_data["agenda_collection"][0].keys()):
|
||||
new_jury_soutenance_data['jury_soutenance_event_end'] = jury_soutenance_data["agenda_collection"][0]['event_end']
|
||||
|
||||
|
||||
|
||||
list_jury_soutenance_data.append(new_jury_soutenance_data)
|
||||
|
||||
dictionnary_data['list_jury_soutenance_data'] = list_jury_soutenance_data
|
||||
|
||||
|
||||
|
||||
# Recuperation des données système
|
||||
# Ajout des champs système comme la date du jour
|
||||
systeme_data = {}
|
||||
|
|
Loading…
Reference in New Issue