17/10/2023 - 22h45
parent
10dd3fd91a
commit
8c4bf436d4
|
@ -1,16 +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="08/10/2023 - 22h40">
|
||||
<list default="true" id="c6d0259a-16e1-410d-91a1-830590ee2a08" name="Changes" comment="17/10/2023 - 22h40">
|
||||
<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$/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$/data_indexees.csv" beforeDir="false" afterPath="$PROJECT_DIR$/data_indexees.csv" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/ela_output_test_file_pandas_2.txt" beforeDir="false" afterPath="$PROJECT_DIR$/ela_output_test_file_pandas_2.txt" 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" />
|
||||
|
@ -80,13 +77,6 @@
|
|||
<option name="presentableId" value="Default" />
|
||||
<updated>1680804787304</updated>
|
||||
</task>
|
||||
<task id="LOCAL-00080" summary="22/08/23 - 20h">
|
||||
<created>1692727228920</created>
|
||||
<option name="number" value="00080" />
|
||||
<option name="presentableId" value="LOCAL-00080" />
|
||||
<option name="project" value="LOCAL" />
|
||||
<updated>1692727228921</updated>
|
||||
</task>
|
||||
<task id="LOCAL-00081" summary="23/08/23 - 20h">
|
||||
<created>1692815833458</created>
|
||||
<option name="number" value="00081" />
|
||||
|
@ -423,7 +413,14 @@
|
|||
<option name="project" value="LOCAL" />
|
||||
<updated>1696798642666</updated>
|
||||
</task>
|
||||
<option name="localTasksCounter" value="129" />
|
||||
<task id="LOCAL-00129" summary="17/10/2023 - 22h40">
|
||||
<created>1697571685666</created>
|
||||
<option name="number" value="00129" />
|
||||
<option name="presentableId" value="LOCAL-00129" />
|
||||
<option name="project" value="LOCAL" />
|
||||
<updated>1697571685666</updated>
|
||||
</task>
|
||||
<option name="localTasksCounter" value="130" />
|
||||
<servers />
|
||||
</component>
|
||||
<component name="Vcs.Log.Tabs.Properties">
|
||||
|
@ -438,7 +435,6 @@
|
|||
</option>
|
||||
</component>
|
||||
<component name="VcsManagerConfiguration">
|
||||
<MESSAGE value="12/09/2023 - 18h" />
|
||||
<MESSAGE value="13/09/2023 - 18h" />
|
||||
<MESSAGE value="14/09/2023 - 21h" />
|
||||
<MESSAGE value="15/09/2023 - 12h" />
|
||||
|
@ -463,6 +459,7 @@
|
|||
<MESSAGE value="07/10/2023 - 16h40" />
|
||||
<MESSAGE value="07/10/2023 - 22h40" />
|
||||
<MESSAGE value="08/10/2023 - 22h40" />
|
||||
<option name="LAST_COMMIT_MESSAGE" value="08/10/2023 - 22h40" />
|
||||
<MESSAGE value="17/10/2023 - 22h40" />
|
||||
<option name="LAST_COMMIT_MESSAGE" value="17/10/2023 - 22h40" />
|
||||
</component>
|
||||
</project>
|
1870
Log/log_file.log
1870
Log/log_file.log
File diff suppressed because it is too large
Load Diff
|
@ -507,11 +507,13 @@ def GetSessionFormation(diction):
|
|||
return False, "Impossible de récupérer la session de formation"
|
||||
|
||||
|
||||
|
||||
|
||||
"""
|
||||
Cette fonction recupere la liste de toutes les sessions de formation actives et valides
|
||||
d'une formation données ET les sessions "on demande"
|
||||
|
||||
/!\ : Cette fonction est utilisée en mode non connecté et en mode non connecté.
|
||||
/!\ : Cette fonction est utilisée en mode non connecté et en mode connecté.
|
||||
Donc faire attention au controle de la connexion
|
||||
"""
|
||||
def GetActiveSessionFormation_List(diction):
|
||||
|
@ -561,7 +563,7 @@ def GetActiveSessionFormation_List(diction):
|
|||
|
||||
RetObject = []
|
||||
|
||||
#print(" ### GetActiveSessionFormation_List myquery = ", myquery)
|
||||
print(" ### GetActiveSessionFormation_List myquery = ", myquery)
|
||||
for retval in coll_session.find(myquery):
|
||||
|
||||
local_tmp = retval
|
||||
|
@ -3121,3 +3123,139 @@ def Delete_List_SessionFormation(diction):
|
|||
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 supprimer la liste des sessions de formation"
|
||||
|
||||
|
||||
"""
|
||||
Cette fonction verifier des données correspondent à une session :
|
||||
- internal_url
|
||||
- date_debut
|
||||
- date_fin
|
||||
- si presentiel : la ville
|
||||
- si distance, juste le a distance
|
||||
|
||||
"""
|
||||
def Is_Corresponding_SessionFormation(diction):
|
||||
try:
|
||||
|
||||
field_list = ['token', 'class_url', 'date_debut','date_fin', 'distantiel', 'ville' ]
|
||||
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, " Toutes les informations fournies ne sont pas valables"
|
||||
|
||||
"""
|
||||
Verification de la liste des champs obligatoires
|
||||
"""
|
||||
field_list_obligatoire = ['token', 'class_url', 'date_debut','date_fin', 'distantiel', 'ville' ]
|
||||
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, " Toutes les informations necessaires n'ont pas été fournies"
|
||||
|
||||
# Recuperation du recid du partner
|
||||
mydata = {}
|
||||
mytoken = ""
|
||||
if ("token" in diction.keys()):
|
||||
if diction['token']:
|
||||
mytoken = diction['token']
|
||||
|
||||
# Verifier la validité du token
|
||||
retval = mycommon.check_partner_token_validity("", mytoken)
|
||||
if retval is False:
|
||||
return "Err_Connexion", " La session de connexion n'est pas valide"
|
||||
|
||||
partner_recid = mycommon.get_parnter_recid_from_token(mytoken)
|
||||
if (partner_recid is False):
|
||||
mycommon.myprint(str(inspect.stack()[0][3]) + " - Impossible de récupérer la liste des stagiaires, ")
|
||||
return False, " Les informations d'identification sont incorrectes "
|
||||
|
||||
|
||||
class_url = ""
|
||||
if ("class_url" in diction.keys()):
|
||||
if diction['class_url']:
|
||||
class_url = diction['class_url']
|
||||
|
||||
"""
|
||||
Recuperation de l'internal url depuis l'url de la formation
|
||||
"""
|
||||
myclass_data = MYSY_GV.dbname['myclass'].find_one({'valide':"1", 'locked':'0',
|
||||
'url':str(class_url)})
|
||||
|
||||
|
||||
if( myclass_data is None or "internal_url" not in myclass_data.keys()):
|
||||
mycommon.myprint(str(inspect.stack()[0][3]) + " - Impossible de récupérer les données de la formation, ")
|
||||
return False, " Impossible de récupérer les données de la formation, "
|
||||
|
||||
class_internal_url = str(myclass_data['internal_url'])
|
||||
|
||||
session_id = ""
|
||||
if ("session_id" in diction.keys()):
|
||||
if diction['session_id']:
|
||||
session_id = diction['session_id']
|
||||
|
||||
if(str(session_id).strip() == ""):
|
||||
return True, []
|
||||
|
||||
coll_session = MYSY_GV.dbname['session_formation']
|
||||
|
||||
myquery = [{'$match':{'_id':ObjectId(str(session_id)), 'class_internal_url':class_internal_url, 'partner_owner_recid':str(partner_recid)}},
|
||||
{'$lookup':
|
||||
{
|
||||
'from': 'myclass',
|
||||
'localField': 'class_internal_url',
|
||||
'foreignField': 'internal_url',
|
||||
'pipeline': [{'$project': {'title': 1, 'lms_class_code':1}}],
|
||||
'as': 'myclass'
|
||||
}
|
||||
}
|
||||
]
|
||||
|
||||
print(" ##### myquery GetSessionFormation = "+str(myquery))
|
||||
RetObject = []
|
||||
|
||||
nb_val = 0
|
||||
for retval in coll_session.aggregate(myquery):
|
||||
print(" ##### Is_Corresponding_SessionFormation retval a controle = " + str(retval))
|
||||
if (retval['distantiel'] == diction['distantiel'] and str(retval['date_debut'][0:10]) == diction[
|
||||
'date_debut']
|
||||
and str(retval['date_fin'][0:10]) == diction['date_fin'] and retval['ville'] == diction['ville']):
|
||||
user = {}
|
||||
user = retval
|
||||
|
||||
|
||||
user['id'] = str(nb_val)
|
||||
nb_val = nb_val + 1
|
||||
title = ""
|
||||
lms_class_code = ""
|
||||
if ('myclass' in retval.keys() and len(retval['myclass']) > 0):
|
||||
|
||||
if( "title" in retval['myclass'][0].keys()):
|
||||
title = retval['myclass'][0]['title']
|
||||
|
||||
if ("lms_class_code" in retval['myclass'][0].keys()):
|
||||
lms_class_code = retval['myclass'][0]['lms_class_code']
|
||||
|
||||
user['title'] = title
|
||||
user['lms_class_code'] = lms_class_code
|
||||
|
||||
RetObject.append(mycommon.JSONEncoder().encode(user))
|
||||
|
||||
|
||||
|
||||
# Si le nombre de session trouvé est > 1 alors incohérence, retourner une message d'erreur
|
||||
if( nb_val > 1 ):
|
||||
mycommon.myprint(str(inspect.stack()[0][3]) + " - la query "+str(myquery)+" retourne "+str(nb_val)+" session. ceci n'est pas normal. il ne doit pas y avoir plus 1 session")
|
||||
return False, " Les informations de la session "+str(session_id)+" sont incohérentes. Merci de contacter le support"
|
||||
|
||||
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 verifier si la session correspond à une session existante"
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
,index,mots,occurence,moyenne,id_formation,source_field,partner_owner_recid
|
||||
0,0,achat,1,0.33,178,title,dbdd36f3d86a73e2bfac7b3f10f062ce1e7c22f7da37de1bot
|
||||
1,1,negociation,1,0.33,178,title,dbdd36f3d86a73e2bfac7b3f10f062ce1e7c22f7da37de1bot
|
||||
2,2,niveau,1,0.33,178,title,dbdd36f3d86a73e2bfac7b3f10f062ce1e7c22f7da37de1bot
|
||||
1,1,niveau,1,0.33,178,title,dbdd36f3d86a73e2bfac7b3f10f062ce1e7c22f7da37de1bot
|
||||
2,2,negociation,1,0.33,178,title,dbdd36f3d86a73e2bfac7b3f10f062ce1e7c22f7da37de1bot
|
||||
|
|
|
|
@ -1,6 +1,3 @@
|
|||
mots ... partner_owner_recid
|
||||
0 achat ... dbdd36f3d86a73e2bfac7b3f10f062ce1e7c22f7da37de...
|
||||
1 negociation ... dbdd36f3d86a73e2bfac7b3f10f062ce1e7c22f7da37de...
|
||||
2 niveau ... dbdd36f3d86a73e2bfac7b3f10f062ce1e7c22f7da37de...
|
||||
|
||||
[3 rows x 6 columns]
|
||||
Empty DataFrame
|
||||
Columns: [mots, occurence, moyenne, id_formation, source_field, partner_owner_recid]
|
||||
Index: []
|
20
main.py
20
main.py
|
@ -2046,6 +2046,26 @@ def Delete_List_SessionFormation():
|
|||
|
||||
|
||||
|
||||
"""
|
||||
Cette API verifier des données correspondent à une session :
|
||||
- internal_url
|
||||
- date_debut
|
||||
- date_fin
|
||||
- si presentiel : la ville
|
||||
- si distance, juste le a distance
|
||||
|
||||
"""
|
||||
@app.route('/myclass/api/Is_Corresponding_SessionFormation/', methods=['POST','GET'])
|
||||
@crossdomain(origin='*')
|
||||
def Is_Corresponding_SessionFormation():
|
||||
# On recupere le corps (payload) de la requete
|
||||
payload = mycommon.strip_dictionary (request.form.to_dict())
|
||||
print(" ### Is_Corresponding_SessionFormation : payload = ",str(payload))
|
||||
localStatus, message= SF.Is_Corresponding_SessionFormation(payload)
|
||||
return jsonify(status=localStatus, message=message )
|
||||
|
||||
|
||||
|
||||
|
||||
"""
|
||||
API de generation de liste PDF des liste d'emargement
|
||||
|
|
Loading…
Reference in New Issue