18/08/23 - 17h30

master
cherif 2023-08-18 17:29:35 +02:00
parent 655b740fc9
commit d2e732385e
3 changed files with 4888 additions and 39 deletions

View File

@ -1,13 +1,10 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<project version="4"> <project version="4">
<component name="ChangeListManager"> <component name="ChangeListManager">
<list default="true" id="c6d0259a-16e1-410d-91a1-830590ee2a08" name="Changes" comment="16/08/23 - 22h"> <list default="true" id="c6d0259a-16e1-410d-91a1-830590ee2a08" name="Changes" comment="17/08/23 - 17h">
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" /> <change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
<change beforePath="$PROJECT_DIR$/Inscription_mgt.py" beforeDir="false" afterPath="$PROJECT_DIR$/Inscription_mgt.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$/Log/log_file.log" beforeDir="false" afterPath="$PROJECT_DIR$/Log/log_file.log" 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$/partner_client.py" beforeDir="false" afterPath="$PROJECT_DIR$/partner_client.py" afterDir="false" />
</list> </list>
<option name="SHOW_DIALOG" value="false" /> <option name="SHOW_DIALOG" value="false" />
<option name="HIGHLIGHT_CONFLICTS" value="true" /> <option name="HIGHLIGHT_CONFLICTS" value="true" />
@ -71,13 +68,6 @@
<option name="presentableId" value="Default" /> <option name="presentableId" value="Default" />
<updated>1680804787304</updated> <updated>1680804787304</updated>
</task> </task>
<task id="LOCAL-00023" summary="21/05/23 - 10h">
<created>1684655964597</created>
<option name="number" value="00023" />
<option name="presentableId" value="LOCAL-00023" />
<option name="project" value="LOCAL" />
<updated>1684655964597</updated>
</task>
<task id="LOCAL-00024" summary="21/05/23 - 22h"> <task id="LOCAL-00024" summary="21/05/23 - 22h">
<created>1684699348108</created> <created>1684699348108</created>
<option name="number" value="00024" /> <option name="number" value="00024" />
@ -414,7 +404,14 @@
<option name="project" value="LOCAL" /> <option name="project" value="LOCAL" />
<updated>1692218985021</updated> <updated>1692218985021</updated>
</task> </task>
<option name="localTasksCounter" value="72" /> <task id="LOCAL-00072" summary="17/08/23 - 17h">
<created>1692284601884</created>
<option name="number" value="00072" />
<option name="presentableId" value="LOCAL-00072" />
<option name="project" value="LOCAL" />
<updated>1692284601884</updated>
</task>
<option name="localTasksCounter" value="73" />
<servers /> <servers />
</component> </component>
<component name="Vcs.Log.Tabs.Properties"> <component name="Vcs.Log.Tabs.Properties">
@ -429,7 +426,6 @@
</option> </option>
</component> </component>
<component name="VcsManagerConfiguration"> <component name="VcsManagerConfiguration">
<MESSAGE value="16/07/23 - 22h" />
<MESSAGE value="22/07/2023 - 17h" /> <MESSAGE value="22/07/2023 - 17h" />
<MESSAGE value="23/07/2023 - 21h" /> <MESSAGE value="23/07/2023 - 21h" />
<MESSAGE value="24/07/23 - 17h" /> <MESSAGE value="24/07/23 - 17h" />
@ -454,6 +450,7 @@
<MESSAGE value="15/08/23 -14h" /> <MESSAGE value="15/08/23 -14h" />
<MESSAGE value="15/08/23 - 20h" /> <MESSAGE value="15/08/23 - 20h" />
<MESSAGE value="16/08/23 - 22h" /> <MESSAGE value="16/08/23 - 22h" />
<option name="LAST_COMMIT_MESSAGE" value="16/08/23 - 22h" /> <MESSAGE value="17/08/23 - 17h" />
<option name="LAST_COMMIT_MESSAGE" value="17/08/23 - 17h" />
</component> </component>
</project> </project>

View File

@ -277,7 +277,9 @@ def UpdateStagiairetoClass(diction):
return_message = "" return_message = ""
field_list = ['token', 'email', 'nom', 'prenom', 'telephone', 'modefinancement', 'opco', field_list = ['token', 'email', 'nom', 'prenom', 'telephone', 'modefinancement', 'opco',
'status', 'class_internal_url', 'session_id', 'price', 'employeur', 'comment'] 'status', 'class_internal_url', 'session_id', 'price', 'employeur', 'comment',
'_id']
incom_keys = diction.keys() incom_keys = diction.keys()
for val in incom_keys: for val in incom_keys:
if val not in field_list: if val not in field_list:
@ -288,7 +290,7 @@ def UpdateStagiairetoClass(diction):
""" """
Verification de la liste des champs obligatoires Verification de la liste des champs obligatoires
""" """
field_list_obligatoire = ['token', 'email', 'class_internal_url', 'session_id'] field_list_obligatoire = ['token', 'email', 'class_internal_url', 'session_id', '_id']
for val in field_list_obligatoire: for val in field_list_obligatoire:
if val not in diction: if val not in diction:
mycommon.myprint( mycommon.myprint(
@ -312,19 +314,26 @@ def UpdateStagiairetoClass(diction):
if ("email" in diction.keys()): if ("email" in diction.keys()):
if diction['email']: if diction['email']:
myemail = str(diction['email']).strip() myemail = str(diction['email']).strip()
query_key['email'] = str(diction['email']).strip() #query_key['email'] = str(diction['email']).strip()
object_id = ""
if ("_id" in diction.keys()):
if diction['email']:
object_id = str(diction['_id']).strip()
query_key['_id'] = ObjectId (str(diction['_id']).strip())
myinternal_url = "" myinternal_url = ""
if ("class_internal_url" in diction.keys()): if ("class_internal_url" in diction.keys()):
if diction['class_internal_url']: if diction['class_internal_url']:
myinternal_url = str(diction['class_internal_url']).strip() myinternal_url = str(diction['class_internal_url']).strip()
query_key['class_internal_url'] = str(diction['class_internal_url']).strip() #query_key['class_internal_url'] = str(diction['class_internal_url']).strip()
mysession_id = "" mysession_id = ""
if ("session_id" in diction.keys()): if ("session_id" in diction.keys()):
if diction['session_id']: if diction['session_id']:
mysession_id = str(diction['session_id']).strip() mysession_id = str(diction['session_id']).strip()
query_key['session_id'] = str(diction['session_id']).strip() #query_key['session_id'] = str(diction['session_id']).strip()
partner_recid = mycommon.get_parnter_recid_from_token(mytoken) partner_recid = mycommon.get_parnter_recid_from_token(mytoken)
@ -337,6 +346,15 @@ def UpdateStagiairetoClass(diction):
mydata = {} mydata = {}
user_nom = "" user_nom = ""
""""
/!\ : update du 18/08/2023 : On va autoriser le changement le session de formation.
en effet il peut arriver qu'on souhaite deplacer la formation d'une personne à une autre session.
"""
if ("session_id" in diction.keys()):
if diction['session_id']:
mysession_id = str(diction['session_id']).strip()
mydata['session_id'] = str(diction['session_id']).strip()
if ("nom" in diction.keys()): if ("nom" in diction.keys()):
if diction['nom']: if diction['nom']:
mydata['nom'] = str(diction['nom']).strip() mydata['nom'] = str(diction['nom']).strip()
@ -392,18 +410,22 @@ def UpdateStagiairetoClass(diction):
""" """
coll_inscription = MYSY_GV.dbname['inscription'] coll_inscription = MYSY_GV.dbname['inscription']
print(" #### query_key = ", query_key)
local_retval = coll_inscription.find_one(query_key) local_retval = coll_inscription.find_one(query_key)
old_status = local_retval['status']
inscription_line_id = local_retval['_id'] if( local_retval is not None ):
if( "status" in local_retval.keys()):
old_status = local_retval['status']
inscription_line_id = local_retval['_id']
if( new_status != old_status ): if( new_status != old_status ):
# Il y a eu un changement de status # Il y a eu un changement de status
if( new_status == "1"): if( new_status == "1"):
mydata['inscription_validation_date'] = str(datetime.now().strftime("%d/%m/%Y %H:%M:%S")) mydata['inscription_validation_date'] = str(datetime.now().strftime("%d/%m/%Y %H:%M:%S"))
if (new_status == "-1"): if (new_status == "-1"):
mydata['inscription_refuse_date'] = str(datetime.now().strftime("%d/%m/%Y %H:%M:%S")) mydata['inscription_refuse_date'] = str(datetime.now().strftime("%d/%m/%Y %H:%M:%S"))
ret_val2 = coll_inscription.find_one_and_update(query_key, ret_val2 = coll_inscription.find_one_and_update(query_key,
@ -3336,7 +3358,7 @@ On y ajoute la formation concernée
""" """
def Get_Statgaire_List_Partner_with_filter(diction): def Get_Statgaire_List_Partner_with_filter(diction):
try: try:
field_list = ['token', 'class_internal_url', 'session_id', 'status'] field_list = ['token', 'class_internal_url', 'session_id', 'status', 'email', 'nom', 'class_title']
incom_keys = diction.keys() incom_keys = diction.keys()
for val in incom_keys: for val in incom_keys:
if val not in field_list: if val not in field_list:
@ -3373,37 +3395,47 @@ def Get_Statgaire_List_Partner_with_filter(diction):
return False, "Impossible de recuperer la liste des stagiaires, Les informations d'identification sont incorrectes " return False, "Impossible de recuperer la liste des stagiaires, Les informations d'identification sont incorrectes "
filter_qry = {}
class_internal_url = "" filt_class_title = {}
if ("class_title" in diction.keys()):
filt_class_title = {'title': {'$regex': str(diction['class_title']), "$options": "i"}}
filt_class_internal_url = {}
if ("class_internal_url" in diction.keys()): if ("class_internal_url" in diction.keys()):
filter_qry['class_internal_url'] = diction['class_internal_url'] filt_class_internal_url = {
'class_internal_url': {'$regex': str(diction['class_internal_url']), "$options": "i"}}
session_id = "" filt_session_id= {}
if ("session_id" in diction.keys()): if ("session_id" in diction.keys()):
filter_qry['session_id'] = diction['session_id'] filt_session_id = {'session_id': {'$regex': str(diction['session_id']), "$options": "i"}}
filt_email = {}
if ("email" in diction.keys()):
filt_email = {'email': {'$regex': str(diction['email']), "$options": "i"}}
filt_nom = {}
if ("nom" in diction.keys()):
filt_nom = {'nom': {'$regex': str(diction['nom']), "$options": "i"}}
status = ""
if ("status" in diction.keys()):
filter_qry['status'] = diction['status']
filt_class_partner_recid = {'partner_owner_recid': str(partner_recid)} filt_class_partner_recid = {'partner_owner_recid': str(partner_recid)}
query = [{'$match':filter_qry }, query = [{'$match':{ '$and' : [ filt_class_internal_url, filt_session_id, filt_email, filt_nom] } },
{'$lookup': {'$lookup':
{ {
'from': 'myclass', 'from': 'myclass',
'localField': 'class_internal_url', 'localField': 'class_internal_url',
'foreignField': 'internal_url', 'foreignField': 'internal_url',
'pipeline': [{'$match': filt_class_partner_recid}, {'$project': {'title': 1, 'domaine': 1, 'pipeline': [{'$match':{ '$and' : [ filt_class_title, filt_class_partner_recid] } }, {'$project': {'title': 1, 'domaine': 1,
'duration': 1, 'duration': 1,
'duration_unit': 1}}], 'duration_unit': 1}}],
'as': 'myclass_collection' 'as': 'myclass_collection'
} }
} }
] ]
print("#### query = ", query) print("#### Get_Statgaire_List_Partner_with_filter : query = ", query)
RetObject = [] RetObject = []
cpt = 1 cpt = 1
for retVal in MYSY_GV.dbname['inscription'].aggregate(query): for retVal in MYSY_GV.dbname['inscription'].aggregate(query):
@ -3411,6 +3443,7 @@ def Get_Statgaire_List_Partner_with_filter(diction):
val = {} val = {}
val['id'] = str(cpt) val['id'] = str(cpt)
cpt = cpt + 1 cpt = cpt + 1
val['_id'] = retVal['_id']
val['session_id'] = retVal['session_id'] val['session_id'] = retVal['session_id']
val['class_internal_url'] = retVal['class_internal_url'] val['class_internal_url'] = retVal['class_internal_url']

File diff suppressed because it is too large Load Diff