13/08/23 - 14h

master
cherif 2023-08-13 13:54:11 +02:00
parent bfb3df993d
commit 5940214906
6 changed files with 2519 additions and 24 deletions

View File

@ -1,10 +1,13 @@
<?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="11/08/23 - 16h">
<list default="true" id="c6d0259a-16e1-410d-91a1-830590ee2a08" name="Changes" comment="13/08/23 - 14h">
<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$/Session_Formation.py" beforeDir="false" afterPath="$PROJECT_DIR$/Session_Formation.py" afterDir="false" />
<change beforePath="$PROJECT_DIR$/class_mgt.py" beforeDir="false" afterPath="$PROJECT_DIR$/class_mgt.py" afterDir="false" />
<change beforePath="$PROJECT_DIR$/main.py" beforeDir="false" afterPath="$PROJECT_DIR$/main.py" afterDir="false" />
<change beforePath="$PROJECT_DIR$/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" />
@ -68,13 +71,6 @@
<option name="presentableId" value="Default" />
<updated>1680804787304</updated>
</task>
<task id="LOCAL-00016" summary="29/04/23 - 21h">
<created>1682792543419</created>
<option name="number" value="00016" />
<option name="presentableId" value="LOCAL-00016" />
<option name="project" value="LOCAL" />
<updated>1682792543419</updated>
</task>
<task id="LOCAL-00017" summary="05/05/23 - 21h">
<created>1683317311855</created>
<option name="number" value="00017" />
@ -411,7 +407,14 @@
<option name="project" value="LOCAL" />
<updated>1691772404815</updated>
</task>
<option name="localTasksCounter" value="65" />
<task id="LOCAL-00065" summary="12/08/23 - 12h">
<created>1691835820504</created>
<option name="number" value="00065" />
<option name="presentableId" value="LOCAL-00065" />
<option name="project" value="LOCAL" />
<updated>1691835820505</updated>
</task>
<option name="localTasksCounter" value="66" />
<servers />
</component>
<component name="Vcs.Log.Tabs.Properties">
@ -426,8 +429,6 @@
</option>
</component>
<component name="VcsManagerConfiguration">
<MESSAGE value="05/07/23 - 20h" />
<MESSAGE value="08/07/23 - 20h" />
<MESSAGE value="09/07/23 - 16h" />
<MESSAGE value="09/07/23 - 21h" />
<MESSAGE value="10/07/23 - 22h" />
@ -451,6 +452,8 @@
<MESSAGE value="09/08/2023 - 21h" />
<MESSAGE value="10/08/23 - 16h" />
<MESSAGE value="11/08/23 - 16h" />
<option name="LAST_COMMIT_MESSAGE" value="11/08/23 - 16h" />
<MESSAGE value="12/08/23 - 12h" />
<MESSAGE value="13/08/23 - 14h" />
<option name="LAST_COMMIT_MESSAGE" value="13/08/23 - 14h" />
</component>
</project>

File diff suppressed because it is too large Load Diff

View File

@ -674,6 +674,104 @@ def GetAllValideSessionPartner_List(diction):
return False, "Impossible de recuperer la liste des sessions de formation valides et actives."
"""
Recuperation de la liste avec des filter du type like
"""
def GetAllValideSessionPartner_List_filter_like(diction):
try:
field_list = ['token','class_title', 'code_session']
incom_keys = diction.keys()
for val in incom_keys:
if val not in field_list:
mycommon.myprint(str(inspect.stack()[0][
3]) + " - Le champ '" + val + "' n'est pas autorisé, Creation partenaire annulée")
return False, " Impossible de recuperer la liste des session de formation"
"""
Verification de la liste des champs obligatoires
"""
field_list_obligatoire = ['token', ]
for val in field_list_obligatoire:
if val not in diction:
mycommon.myprint(
str(inspect.stack()[0][3]) + " - : La valeur '" + val + "' n'est pas presente dans liste ")
return False, "Impossible de recuperer la liste des session de formation"
# Recuperation du recid du partner
mydata = {}
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_class_title = {}
if ("class_title" in diction.keys()):
filt_class_title = {'title': {'$regex': str(diction['class_title']),"$options": "i"}}
filt_code_session = {}
if ("code_session" in diction.keys()):
filt_code_session = {'code_session': {'$regex': str(diction['code_session']), "$options": "i"}}
coll_session = MYSY_GV.dbname['session_formation']
query = [{'$match':filt_code_session },
{'$lookup':
{
'from': 'myclass',
'localField': 'class_internal_url',
'foreignField': 'internal_url',
'pipeline': [{'$match': filt_class_title}, {'$project': {'title': 1, 'domaine':1,
'duration':1, 'duration_unit':1}}],
'as': 'myclass_collection'
}
}
]
print("#### GetAllValideSessionPartner_List_filter_likequery = ", query)
RetObject = []
cpt = 1
for retVal in MYSY_GV.dbname['session_formation'].aggregate(query):
if( 'myclass_collection' in retVal.keys() and len(retVal['myclass_collection']) > 0 ):
val = {}
val['id'] = str(cpt)
cpt = cpt + 1
val['class_internal_url'] = retVal['class_internal_url']
val['code_session'] = retVal['code_session']
val['date_debut'] = retVal['date_debut'][0:10]
val['date_fin'] = retVal['date_fin'][0:10]
val['date_debut_inscription'] = retVal['date_debut_inscription'][0:10]
val['date_fin_inscription'] = retVal['date_fin_inscription'][0:10]
val['distantiel'] = retVal['distantiel']
val['formateur'] = retVal['formateur']
val['nb_participant'] = retVal['nb_participant']
val['presentiel'] = retVal['presentiel']
val['prix_session'] = retVal['prix_session']
val['title'] = retVal['myclass_collection'][0]['title']
val['domaine'] = retVal['myclass_collection'][0]['domaine']
val['duration'] = retVal['myclass_collection'][0]['duration']
val['duration_unit'] = retVal['myclass_collection'][0]['duration_unit']
RetObject.append(mycommon.JSONEncoder().encode(val))
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) + " - ERRORRRR AT Line : " + str(exc_tb.tb_lineno))
return False, "Impossible de recuperer la liste des sessions de formation valides et actives."
"""

View File

@ -1775,7 +1775,7 @@ def get_class(diction):
filt_title = {}
if ("title" in diction.keys()):
filt_title = {'title': {'$regex': str(diction['title'])}}
filt_title = {'title': {'$regex': str(diction['title']), "$options": "i"}}
print(" #### avant requete get partner_owner_recid laa ="+str(user_recid)+
@ -2204,15 +2204,16 @@ def get_partner_class(diction):
filt_external_code= {}
if ("external_code" in diction.keys()):
filt_external_code = {'external_code':str(diction['external_code'])}
#print(" GRRRRRRRRRRRRR "+str(filt_external_code))
filt_title = {}
if ("title" in diction.keys()):
filt_title = {'title': {'$regex': str(diction['title'])}}
filt_title = {'title': {'$regex': str(diction['title']), "$options": "i"}}
filt_internal_url = {}
if ("internal_url" in diction.keys()):
filt_internal_url = {'internal_url': {'$regex': str(diction['internal_url'])}}
filt_internal_url = {'internal_url': {'$regex': str(diction['internal_url']), "$options": "i"}}
#print(" filt_internal_url GRRRRRRRRRRRRRRRRRRRRrr "+str(filt_internal_url))
@ -2361,16 +2362,16 @@ def find_partner_class_like(diction):
RetObject = []
filt_external_code = {}
if ("external_code" in diction.keys()):
filt_external_code = {'external_code':{'$regex': str(diction['external_code'])}}
filt_external_code = {'external_code':{'$regex': str(diction['external_code']), "$options": "i"}}
# print(" GRRRRRRRRRRRRR "+str(filt_external_code))
filt_title = {}
if ("title" in diction.keys()):
filt_title = {'title': {'$regex': str(diction['title'])}}
filt_title = {'title': {'$regex': str(diction['title']), "$options": "i"}}
filt_internal_url = {}
if ("internal_url" in diction.keys()):
filt_internal_url = {'internal_url': {'$regex': str(diction['internal_url'])}}
filt_internal_url = {'internal_url': {'$regex': str(diction['internal_url']), "$options": "i"}}
# print(" filt_internal_url GRRRRRRRRRRRRRRRRRRRRrr "+str(filt_internal_url))
print(
@ -2524,16 +2525,16 @@ def get_partner_class_external_code(diction):
RetObject = []
filt_external_code = {}
if ("external_code" in diction.keys()):
filt_external_code = {'external_code': str(diction['external_code'])}
filt_external_code = {'external_code': str(diction['external_code']), "$options": "i"}
# print(" GRRRRRRRRRRRRR "+str(filt_external_code))
filt_title = {}
if ("title" in diction.keys()):
filt_title = {'title': {'$regex': str(diction['title'])}}
filt_title = {'title': {'$regex': str(diction['title']), "$options": "i"}}
filt_internal_url = {}
if ("internal_url" in diction.keys()):
filt_internal_url = {'internal_url': {'$regex': str(diction['internal_url'])}}
filt_internal_url = {'internal_url': {'$regex': str(diction['internal_url']), "$options": "i"}}
# print(" filt_internal_url GRRRRRRRRRRRRRRRRRRRRrr "+str(filt_internal_url))
print(
@ -3308,7 +3309,7 @@ def get_associated_class_of_partnair(diction):
filt_title = {}
if ("title" in diction.keys()):
filt_title = {'title': {'$regex': str(diction['title'])}}
filt_title = {'title': {'$regex': str(diction['title']), "$options": "i"}}
print(" #### avant requete get partner_owner_recid laa ="+str(partner_recid)+

11
main.py
View File

@ -1964,6 +1964,17 @@ def GetAllValideSessionPartner_List():
localStatus, message= SF.GetAllValideSessionPartner_List(payload)
return jsonify(status=localStatus, message=message )
"""
Cette API recupere toutes les sessions de formation d'un partneaire avec des filtres de type like
"""
@app.route('/myclass/api/GetAllValideSessionPartner_List_filter_like/', methods=['POST','GET'])
@crossdomain(origin='*')
def GetAllValideSessionPartner_List_filter_like():
# On recupere le corps (payload) de la requete
payload = mycommon.strip_dictionary (request.form.to_dict())
print(" ### GetAllValideSessionPartner_List_filter_like : payload = ",str(payload))
localStatus, message= SF.GetAllValideSessionPartner_List_filter_like(payload)
return jsonify(status=localStatus, message=message )
"""

View File

@ -2849,7 +2849,7 @@ puis retourne toutes les informations relatif au couple (personne / session form
"""
def GetAttendeeDetail_perSession(diction):
try:
field_list_obligatoire = ['session_id', 'token', 'attendee_email']
field_list_obligatoire = ['session_id', 'token', 'attendee_email', 'internal_url']
for val in field_list_obligatoire:
if val not in diction:
@ -2877,9 +2877,19 @@ def GetAttendeeDetail_perSession(diction):
RetObject = []
qry = {'session_id':str(diction['session_id']),'email':str(diction['attendee_email']),
'class_internal_url':str(diction['internal_url']),}
print(" ici qry = ",qry)
# Recuperation des infos de la formation
local_Insc_retval = MYSY_GV.dbname['inscription'].find_one({'session_id':str(diction['session_id']),
'email':str(diction['attendee_email'])})
'email':str(diction['attendee_email']),
'class_internal_url':str(diction['internal_url']),})
if( local_Insc_retval is None):
myprint(str(inspect.stack()[0][3]) + " - Impossible de recuperer le recid du partenaire (2)")
return False, " Les informations d'identifier la session (2) "
my_retrun_dict = {}
if ("session_id" in local_Insc_retval.keys()):