06/08/23 - 23h

master
cherif 2023-08-06 23:15:01 +02:00
parent eb89038a2e
commit b28d5e2f97
4 changed files with 5032 additions and 12 deletions

View File

@ -1,10 +1,11 @@
<?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="03/08/23 - 19h">
<list default="true" id="c6d0259a-16e1-410d-91a1-830590ee2a08" name="Changes" comment="05/08/23 - 16h">
<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$/partners.py" beforeDir="false" afterPath="$PROJECT_DIR$/partners.py" afterDir="false" />
<change beforePath="$PROJECT_DIR$/Session_Formation.py" beforeDir="false" afterPath="$PROJECT_DIR$/Session_Formation.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" />
@ -68,13 +69,6 @@
<option name="presentableId" value="Default" />
<updated>1680804787304</updated>
</task>
<task id="LOCAL-00010" summary="22/04/23 - 19h">
<created>1682183786097</created>
<option name="number" value="00010" />
<option name="presentableId" value="LOCAL-00010" />
<option name="project" value="LOCAL" />
<updated>1682183786097</updated>
</task>
<task id="LOCAL-00011" summary="23/04/23 - 19h">
<created>1682267594180</created>
<option name="number" value="00011" />
@ -411,7 +405,14 @@
<option name="project" value="LOCAL" />
<updated>1691082545384</updated>
</task>
<option name="localTasksCounter" value="59" />
<task id="LOCAL-00059" summary="05/08/23 - 16h">
<created>1691243556194</created>
<option name="number" value="00059" />
<option name="presentableId" value="LOCAL-00059" />
<option name="project" value="LOCAL" />
<updated>1691243556194</updated>
</task>
<option name="localTasksCounter" value="60" />
<servers />
</component>
<component name="Vcs.Log.Tabs.Properties">
@ -426,7 +427,6 @@
</option>
</component>
<component name="VcsManagerConfiguration">
<MESSAGE value="08/06/23 - 21h" />
<MESSAGE value="13/06/23 - 16h" />
<MESSAGE value="13/06/23 - 21h21" />
<MESSAGE value="04/07/23 - 10h" />
@ -451,6 +451,7 @@
<MESSAGE value="30/07/23 - 17h" />
<MESSAGE value="01/08/230- 21h" />
<MESSAGE value="03/08/23 - 19h" />
<option name="LAST_COMMIT_MESSAGE" value="03/08/23 - 19h" />
<MESSAGE value="05/08/23 - 16h" />
<option name="LAST_COMMIT_MESSAGE" value="05/08/23 - 16h" />
</component>
</project>

File diff suppressed because it is too large Load Diff

View File

@ -513,6 +513,95 @@ def GetAllValideSessionFormation_List(diction):
return False, "Impossible de recuperer la liste des sessions de formation valides et actives."
"""
Cette fonction recupere toutes les sessions de formation d'un partenaire
"""
def GetAllValideSessionPartner_List(diction):
try:
field_list = ['token']
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
coll_session = MYSY_GV.dbname['session_formation']
query = [
{'$lookup':
{
'from': 'myclass',
'localField': 'class_internal_url',
'foreignField':'internal_url',
'as': 'myclass_collection'
}
}
]
#print("#### query = ", query)
RetObject = []
cpt = 1
for retVal in MYSY_GV.dbname['session_formation'].aggregate(query):
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."
"""
Cette fonction crée les sessions de formation en mass
par exemple avec l'import d'un fichier csv

12
main.py
View File

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