20/05/2025 - 21dhu

Signed-off-by: cherif <cherif.balde@yahoo.fr>
master
cherif 2025-05-22 17:41:41 +02:00
parent 9771528040
commit 24f6f6caca
4 changed files with 1680 additions and 137 deletions

View File

@ -5,6 +5,7 @@
<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$/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" />
</list>
<option name="SHOW_DIALOG" value="false" />
<option name="HIGHLIGHT_CONFLICTS" value="true" />
@ -81,13 +82,6 @@
<option name="presentableId" value="Default" />
<updated>1680804787304</updated>
</task>
<task id="LOCAL-00418" summary="14/12/2024 - 14h">
<created>1734181586199</created>
<option name="number" value="00418" />
<option name="presentableId" value="LOCAL-00418" />
<option name="project" value="LOCAL" />
<updated>1734181586200</updated>
</task>
<task id="LOCAL-00419" summary="24/12/2024 - 22h">
<created>1735075121021</created>
<option name="number" value="00419" />
@ -424,7 +418,14 @@
<option name="project" value="LOCAL" />
<updated>1747851722821</updated>
</task>
<option name="localTasksCounter" value="467" />
<task id="LOCAL-00467" summary="20/05/2025 - 21hu">
<created>1747856760930</created>
<option name="number" value="00467" />
<option name="presentableId" value="LOCAL-00467" />
<option name="project" value="LOCAL" />
<updated>1747856760931</updated>
</task>
<option name="localTasksCounter" value="468" />
<servers />
</component>
<component name="Vcs.Log.Tabs.Properties">

File diff suppressed because it is too large Load Diff

View File

@ -494,7 +494,8 @@ def Delete_Jury_Membre(diction):
tab_jury_membre_ids_splited_ObjectID = []
for tmp in tab_jury_membre_ids_splited:
tab_jury_membre_ids_splited_ObjectID.append(ObjectId(str(tmp)))
if( tmp ):
tab_jury_membre_ids_splited_ObjectID.append(ObjectId(str(tmp)))
qery_delete = {'_id': {'$in': tab_jury_membre_ids_splited_ObjectID},
'jury_id': str(diction['jury_id']),
@ -2119,10 +2120,6 @@ def Delete_Jury_Apprenant_Membres(diction):
new_data = diction
# Verifier que le groupe existe et est valide
print(" QR ", {'_id': ObjectId(str(diction['jury_id'])),
'valide': '1',
'partner_owner_recid': str(my_partner['recid'])})
is_existe_groupe = MYSY_GV.dbname['jury'].count_documents(
{'_id': ObjectId(str(diction['jury_id'])),
@ -2143,7 +2140,8 @@ def Delete_Jury_Apprenant_Membres(diction):
tab_inscriptions_ids_splited_ObjectID = []
for tmp in tab_inscriptions_ids_splited :
tab_inscriptions_ids_splited_ObjectID.append(ObjectId(str(tmp)))
if( tmp ):
tab_inscriptions_ids_splited_ObjectID.append(ObjectId(str(tmp)))
qery_delete = {'_id': {'$in': tab_inscriptions_ids_splited_ObjectID},
'jury_id':str(diction['jury_id']),
@ -2469,43 +2467,9 @@ def Get_List_Jury_Soutenenace(diction):
"""
Recuperation de la liste des soutenances avec des filtre sur
- sur la salle
- l'inscrit
- l'apprenant
- l'inscrit (list)
- l'apprenant (list)
qry :
db.jury_apprenant.aggregate([
{'$lookup': {
'from': 'jury_soutenance',
"let": {'jury_soutenance_id': "$jury_soutenance_id", 'partner_owner_recid': '$partner_owner_recid'},
'pipeline': [
{'$match':
{'$expr':
{'$and':
[
{'$eq': ["$_id", {'$convert': {
'input': "$$jury_soutenance_id",
'to': "objectId",
'onError': {'error': 'true'},
'onNull': {'isnull': 'true'}
}}]},
{'$eq': ["$valide", "1"]},
{'$eq': ["$partner_owner_recid", '$$partner_owner_recid']}
]
}
}
},
],
'as': 'jury_soutenance_collection'
}
},
{
'$unwind': '$jury_soutenance_collection'
},
])
"""
def Get_List_Jury_Soutenenace_With_Filter(diction):
try:
@ -2514,9 +2478,10 @@ def Get_List_Jury_Soutenenace_With_Filter(diction):
"""
Verification des input acceptés
"""
field_list = ['token', 'jury_id', 'nom_salle',
'inscrit_id', 'inscrit_email',
'apprenant_id', 'apprenant_email' ]
field_list = ['token', 'jury_id', 'jury_salle_nom',
'tab_inscrit_ids', 'inscrit_email',
'tab_apprenant_ids', 'apprenant_email',
'session_id']
incom_keys = diction.keys()
for val in incom_keys:
@ -2528,7 +2493,7 @@ def Get_List_Jury_Soutenenace_With_Filter(diction):
"""
Verification des champs obligatoires
"""
field_list_obligatoire = ['token', 'jury_id']
field_list_obligatoire = ['token',]
for val in field_list_obligatoire:
if val not in diction:
mycommon.myprint(
@ -2548,109 +2513,284 @@ def Get_List_Jury_Soutenenace_With_Filter(diction):
if (local_status is not True):
return local_status, my_partner
is_jury_valide = MYSY_GV.dbname['jury'].count_documents({'_id':ObjectId(str(diction['jury_id'])),
'valide':'1',
'locked':'0',
'partner_owner_recid':str(my_partner['recid'])})
filt_jury_apprenant_inscrit_ids = {}
tab_inscriptions_ids = ""
if ("tab_inscrit_ids" in diction.keys()):
if diction['tab_inscrit_ids']:
tab_inscriptions_ids = diction['tab_inscrit_ids']
if( is_jury_valide != 1 ):
mycommon.myprint(
str(inspect.stack()[0][
3]) + " L'identifiant du jury est invalide ")
return False, " L'identifiant du jury est invalide ",
tab_inscriptions_ids_splited_work = str(tab_inscriptions_ids).split(",")
jury_data = MYSY_GV.dbname['jury'].find_one({'_id': ObjectId(str(diction['jury_id'])),
'valide': '1',
'locked': '0',
'partner_owner_recid': str(my_partner['recid'])})
tab_inscriptions_ids_splited = []
for tmp in tab_inscriptions_ids_splited_work :
if( tmp ):
tab_inscriptions_ids_splited.append(str(tmp))
filt_jury_apprenant_inscrit_ids = {'inscription_id': {'$in': tab_inscriptions_ids_splited},}
#------------
filt_jury_apprenant_apprenant_ids = {}
tab_apprenant_ids = ""
if ("tab_apprenant_ids" in diction.keys()):
if diction['tab_apprenant_ids']:
tab_apprenant_ids = diction['tab_apprenant_ids']
tab_apprenant_ids_splited_work = str(tab_apprenant_ids).split(",")
tab_apprenant_ids_splited = []
for tmp in tab_apprenant_ids_splited_work:
if (tmp):
tab_apprenant_ids_splited.append(str(tmp))
tab_inscription_apprenant = []
# Recuperer la liste des inscription_id associé à cet apprenant
for val in MYSY_GV.dbname['inscription'].find({'partner_owner_recid':str(my_partner['recid']),
'apprenant_id':{'$in':tab_apprenant_ids_splited} }):
tab_inscription_apprenant.append(str(val['_id']))
filt_jury_apprenant_apprenant_ids = {'inscription_id': {'$in': tab_inscription_apprenant},}
filt_final_on_inscription = {}
if(len(tab_inscription_apprenant) > 0 and len(tab_inscriptions_ids_splited) > 0):
filt_final_on_inscription = {}
tab_work = []
for tmp in tab_inscription_apprenant:
if( tmp and tmp not in tab_work):
tab_work.append(tmp)
for tmp in tab_inscriptions_ids_splited:
if( tmp and tmp not in tab_work):
tab_work.append(tmp)
filt_final_on_inscription = {'inscription_id': {'$in': tab_work},}
elif ( len(tab_inscription_apprenant) > 0 ):
filt_final_on_inscription = filt_jury_apprenant_apprenant_ids
elif ( len(tab_inscriptions_ids_splited) > 0 ):
filt_final_on_inscription = filt_jury_apprenant_inscrit_ids
#print(" ### filt_final_on_inscription = ", filt_final_on_inscription)
#-----------
"""
filt_jury_apprenant_inscription_apprenant_id = {}
tab_apprenant_id = ""
if ("apprenant_id" in diction.keys() and diction['apprenant_id']):
filt_jury_apprenant_inscription_apprenant_id = {'$eq': ["$apprenant_id", str(diction['apprenant_id'])]},
"""
Clés de mise à jour
"""
data_cle = {}
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'])
filt_jury_salle_nom = {}
if ("jury_salle_nom" in diction.keys() and diction['jury_salle_nom']):
filt_jury_salle_nom = {'jury_salle': {'$regex': str(diction['jury_salle_nom']), "$options": "i"}}
filt_session_id = {}
if( 'session_id' in diction.keys() and diction['session_id']):
filt_session_id = {'$eq': ["$session_id", str(diction['session_id'])]},
qry_filter = {'$and': [{'partner_owner_recid': str(my_partner['recid']), 'valide': '1', 'locked': '0'}, filt_jury_salle_nom,
filt_final_on_inscription]}
pipe_qry = [{'$match': qry_filter},
{'$lookup': {
'from': 'jury_soutenance',
"let": {'jury_soutenance_id': "$jury_soutenance_id",
'partner_owner_recid': '$partner_owner_recid'},
'pipeline': [
{'$match':
{'$expr':
{'$and':
[
{'$eq': ["$_id", {'$convert': {
'input': "$$jury_soutenance_id",
'to': "objectId",
'onError': {'error': 'true'},
'onNull': {'isnull': 'true'}
}}]},
{'$eq': ["$valide", "1"]},
{'$eq': ["$partner_owner_recid", '$$partner_owner_recid']}
]
}
}
},
],
'as': 'jury_soutenance_collection'
}
},
{'$lookup': {
'from': 'inscription',
"let": {'inscription_id': "$inscription_id", 'partner_owner_recid': '$partner_owner_recid',
},
'pipeline': [
{'$match':
{'$expr':
{'$and':
[
{'$eq': ["$_id", {'$convert': {
'input': "$$inscription_id",
'to': "objectId",
'onError': {'error': 'true'},
'onNull': {'isnull': 'true'}
}}]},
{'$eq': ["$partner_owner_recid", '$$partner_owner_recid']},
{'$eq': ["$valide", '1']},
filt_session_id
]
}
}
},
],
'as': 'inscription_collection'
}
},
]
print(" ### pipe_qry = ", pipe_qry)
RetObject = []
val_tmp = 0
for New_retVal in MYSY_GV.dbname['jury_apprenant'].aggregate(pipe_qry):
new_node = {}
new_node['_id'] = New_retVal['_id']
new_node['agenda_id'] = New_retVal['agenda_id']
new_node['inscription_id'] = New_retVal['inscription_id']
new_node['jury_id'] = New_retVal['jury_id']
new_node['jury_soutenance_id'] = New_retVal['jury_soutenance_id']
for retval in MYSY_GV.dbname['jury_soutenance'].find(data_cle).sort([("_id", pymongo.DESCENDING), ]):
user = retval
soutenance_sujet = ""
soutenance_note = ""
soutenance_observation = ""
soutenance_adresse = ""
soutenance_code_postal = ""
soutenance_ville = ""
soutenance_pays = ""
soutenance_convocation_apprenant_date_sending = ""
soutenance_convocation_apprenant_send = ""
if( "session_id" in jury_data.keys() ):
user['session_id'] = jury_data['session_id']
else:
user['session_id'] = ""
if( "jury_soutenance_collection" in New_retVal.keys() and len(New_retVal["jury_soutenance_collection"]) > 0 ):
if( "sujet" in New_retVal["jury_soutenance_collection"][0].keys()):
soutenance_sujet = New_retVal["jury_soutenance_collection"][0]['sujet']
if( "convocation_apprenant_send" not in retval.keys() ):
user["convocation_apprenant_send"] = ""
if ("note" in New_retVal["jury_soutenance_collection"][0].keys()):
soutenance_note = New_retVal["jury_soutenance_collection"][0]['note']
if ("convocation_apprenant_date_sending" not in retval.keys()):
user["convocation_apprenant_date_sending"] = ""
if ("observation" in New_retVal["jury_soutenance_collection"][0].keys()):
soutenance_observation = New_retVal["jury_soutenance_collection"][0]['observation']
if ("adresse" in New_retVal["jury_soutenance_collection"][0].keys()):
soutenance_adresse = New_retVal["jury_soutenance_collection"][0]['adresse']
if ("code_postal" in New_retVal["jury_soutenance_collection"][0].keys()):
soutenance_code_postal = New_retVal["jury_soutenance_collection"][0]['code_postal']
if ("ville" in New_retVal["jury_soutenance_collection"][0].keys()):
soutenance_ville = New_retVal["jury_soutenance_collection"][0]['ville']
if ("pays" in New_retVal["jury_soutenance_collection"][0].keys()):
soutenance_pays = New_retVal["jury_soutenance_collection"][0]['pays']
if ("convocation_apprenant_date_sending" in New_retVal["jury_soutenance_collection"][0].keys()):
soutenance_convocation_apprenant_date_sending = New_retVal["jury_soutenance_collection"][0]['convocation_apprenant_date_sending']
if ("convocation_apprenant_send" in New_retVal["jury_soutenance_collection"][0].keys()):
soutenance_convocation_apprenant_send = New_retVal["jury_soutenance_collection"][0]['convocation_apprenant_send']
new_node['soutenance_sujet'] = str(soutenance_sujet)
new_node['soutenance_note'] = str(soutenance_note)
new_node['soutenance_observation'] = str(soutenance_observation)
new_node['soutenance_adresse'] = str(soutenance_adresse)
new_node['soutenance_code_postal'] = str(soutenance_code_postal)
new_node['soutenance_ville'] = str(soutenance_ville)
new_node['soutenance_pays'] = str(soutenance_pays)
new_node['soutenance_convocation_apprenant_date_sending'] = str(soutenance_convocation_apprenant_date_sending)
new_node['soutenance_convocation_apprenant_send'] = str(soutenance_convocation_apprenant_send)
# Recuperation des agenda associés
soutenance_agenda_id = ""
soutenance_agenda_event_title = ""
inscrit_nom = ""
inscrit_prenom = ""
inscrit_email = ""
if ("inscription_collection" in New_retVal.keys() and len( New_retVal["inscription_collection"]) > 0):
if ("nom" in New_retVal["jury_soutenance_collection"][0].keys()):
inscrit_nom = New_retVal["jury_soutenance_collection"][0]['nom']
if ("prenom" in New_retVal["jury_soutenance_collection"][0].keys()):
inscrit_prenom = New_retVal["jury_soutenance_collection"][0]['prenom']
if ("email" in New_retVal["jury_soutenance_collection"][0].keys()):
inscrit_email = New_retVal["jury_soutenance_collection"][0]['email']
new_node['inscrit_nom'] = str(inscrit_nom)
new_node['inscrit_prenom'] = str(inscrit_prenom)
new_node['inscrit_email'] = str(inscrit_email)
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})
if ("agenda_id" in New_retVal.keys() and New_retVal['agenda_id']):
agenda_data = MYSY_GV.dbname['agenda'].find_one({'_id': ObjectId(str(New_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})
local_date = str(agenda_data['event_start'])[0:16]
new_date = datetime.strptime(str(local_date), '%Y-%m-%dT%H:%M').strftime("%d/%m/%Y %H:%M")
soutenance_agenda_event_start = str(new_date)
local_date = str(agenda_data['event_end'])[0:16]
new_date = datetime.strptime(str(local_date), '%Y-%m-%dT%H:%M').strftime("%d/%m/%Y %H:%M")
soutenance_agenda_event_end = str(new_date)
new_node['soutenance_agenda_event_start'] = str(soutenance_agenda_event_start)
new_node['soutenance_agenda_event_end'] = str(soutenance_agenda_event_end)
soutenance_agenda_ue_code = ""
if ("jury_id" in New_retVal.keys() and New_retVal['jury_id']):
jury_data = MYSY_GV.dbname['jury'].find_one({'_id': ObjectId(str(New_retVal['jury_id'])),
'valide': '1',
'locked': '0',
'partner_owner_recid': str(my_partner['recid'])},
{'_id': 1, 'ue_id': 1,})
if( jury_data and 'ue_id' in jury_data.keys() and jury_data['ue_id']):
ue_id_data = MYSY_GV.dbname['unite_enseignement'].find_one({'_id': ObjectId(str(jury_data['ue_id'])),
'valide': '1',
'locked': '0',
'partner_owner_recid': str(my_partner['recid'])},
{'_id': 1, 'code': 1, }
)
if( ue_id_data and "code" in ue_id_data.keys() ):
soutenance_agenda_ue_code = ue_id_data['code']
new_node['soutenance_code'] = str(soutenance_agenda_ue_code)
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'])
RetObject.append(mycommon.JSONEncoder().encode(new_node))
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
jury_apprenant = []
# Recuperer le nombre de membre
nb_jury_apprenant = MYSY_GV.dbname['jury_apprenant'].count_documents({'partner_owner_recid':str(my_partner['recid']),
'valide':'1',
'locked':'0',
'jury_id':str(retval['jury_id'])})
user['nb_apprenant'] = str(nb_jury_apprenant)
for inscrit in MYSY_GV.dbname['jury_apprenant'].find({'partner_owner_recid': str(my_partner['recid']),
'valide': '1',
'locked': '0',
'jury_id': str(retval['jury_id'])}):
if( inscrit and "inscription_id" in inscrit.keys() and inscrit['inscription_id']):
jury_inscri_data = MYSY_GV.dbname['inscription'].find_one({'_id':ObjectId(str(inscrit['inscription_id'])),
'valide':'1',
'partner_owner_recid':str(my_partner['recid'])},
{'email':1,
'nom':1,
'prenom':1})
jury_apprenant.append(jury_inscri_data)
user['list_inscrit'] = jury_apprenant
RetObject.append(mycommon.JSONEncoder().encode(user))
return True, RetObject

17
main.py
View File

@ -12605,6 +12605,23 @@ def Get_Given_Jury_Soutenenace():
"""
API pour Recuperation de la liste des soutenances avec des filtre sur
- sur la salle
- l'inscrit (list)
- l'apprenant (ICI Pas de list)
"""
@app.route('/myclass/api/Get_List_Jury_Soutenenace_With_Filter/', methods=['POST','GET'])
@crossdomain(origin='*')
def Get_List_Jury_Soutenenace_With_Filter():
# On recupere le corps (payload) de la requete
payload = mycommon.strip_dictionary (request.form.to_dict())
print(" ### Get_List_Jury_Soutenenace_With_Filter : payload = ",payload)
localStatus, message= jury_mgt.Get_List_Jury_Soutenenace_With_Filter(payload)
return jsonify(status=localStatus, message=message )
"""
API pour supprimer la soutenances de jury donnée