14/05/23 - 17h

master
cherif 2023-05-14 16:34:06 +02:00
parent c4ecc8d3ab
commit a414c61dbd
6 changed files with 1460 additions and 15 deletions

View File

@ -1,9 +1,12 @@
<?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="13/05/23 - 17h">
<list default="true" id="c6d0259a-16e1-410d-91a1-830590ee2a08" name="Changes" comment="13/05/23 - 23h">
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
<change beforePath="$PROJECT_DIR$/class_mgt.py" beforeDir="false" afterPath="$PROJECT_DIR$/class_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$/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$/lms_chamilo/mysy_lms.py" beforeDir="false" afterPath="$PROJECT_DIR$/lms_chamilo/mysy_lms.py" afterDir="false" />
</list>
<option name="SHOW_DIALOG" value="false" />
@ -194,7 +197,14 @@
<option name="project" value="LOCAL" />
<updated>1683991333030</updated>
</task>
<option name="localTasksCounter" value="20" />
<task id="LOCAL-00020" summary="13/05/23 - 23h">
<created>1684015246929</created>
<option name="number" value="00020" />
<option name="presentableId" value="LOCAL-00020" />
<option name="project" value="LOCAL" />
<updated>1684015246929</updated>
</task>
<option name="localTasksCounter" value="21" />
<servers />
</component>
<component name="Vcs.Log.Tabs.Properties">
@ -226,6 +236,7 @@
<MESSAGE value="05/05/23 - 21h" />
<MESSAGE value="12/05/23 - 19h" />
<MESSAGE value="13/05/23 - 17h" />
<option name="LAST_COMMIT_MESSAGE" value="13/05/23 - 17h" />
<MESSAGE value="13/05/23 - 23h" />
<option name="LAST_COMMIT_MESSAGE" value="13/05/23 - 23h" />
</component>
</project>

File diff suppressed because it is too large Load Diff

View File

@ -41,7 +41,8 @@ def Add_Update_SessionFormation(diction):
field_list = ['token', 'date_debut', 'date_fin', 'nb_participant', 'formation_session_id', 'adresse',
'code_postal', 'ville', 'formateur', 'code_session',
'class_internal_url', 'session_status', 'date_debut_inscription', 'date_fin_inscription',
'attestation_certif', "distantiel", "presentiel", "prix_session", 'contenu_ftion', 'lms_class_code']
'attestation_certif', "distantiel", "presentiel", "prix_session", 'contenu_ftion', 'lms_class_code',
'session_ondemande']
incom_keys = diction.keys()
for val in incom_keys:
@ -110,6 +111,10 @@ def Add_Update_SessionFormation(diction):
if ("lms_class_code" in diction.keys()):
mydata['lms_class_code'] = diction['lms_class_code']
if ("session_ondemande" in diction.keys()):
mydata['session_ondemande'] = diction['session_ondemande']
if ("nb_participant" in diction.keys()):
mydata['nb_participant'] = diction['nb_participant']
@ -329,7 +334,7 @@ def GetSessionFormation(diction):
"""
Cette fonction recupere la liste de toutes les sessions de formation actives et valide
d'une formation données.
d'une formation données ET les sessions "on demande"
"""
def GetActiveSessionFormation_List(diction):
try:
@ -384,6 +389,9 @@ def GetActiveSessionFormation_List(diction):
#print(" #### date_debut_inscription = ", debut_inscr, " date_fin_inscription = ", fin_inscr, " NOW = ",datetime.now())
if(debut_inscr <= datetime.now() and fin_inscr >= datetime.now()):
RetObject.append(mycommon.JSONEncoder().encode(retval))
else:
if( str(local_tmp['session_ondemande']).strip() == "1"):
RetObject.append(mycommon.JSONEncoder().encode(retval))
@ -520,7 +528,7 @@ def Add_Update_SessionFormation_mass(file=None, Folder=None, diction=None):
'''
field_list = ['date_debut', 'date_fin', 'nb_participant', 'adresse', 'code_postal', 'ville',
'session_status', 'date_debut_inscription', 'date_fin_inscription', 'attestation', 'formateur',
'code_session', "distanciel", "presentiel", "prix_session", 'contenu_ftion', 'lms_class_code']
'code_session', "distanciel", "presentiel", "prix_session", 'contenu_ftion', 'lms_class_code', 'session_ondemande']
# Controle du nombre de lignes dans le fichier.
total_rows = len(df)
@ -655,6 +663,20 @@ def Add_Update_SessionFormation_mass(file=None, Folder=None, diction=None):
lms_class_code = str(df['lms_class_code'].values[n]).strip()
mydata['lms_class_code'] = lms_class_code
session_ondemande = ""
if ("session_ondemande" in df.keys()):
if (str(df['session_ondemande'].values[n])):
session_ondemande = str(df['session_ondemande'].values[n]).strip()
if( session_ondemande != "1" and session_ondemande != "0"):
mycommon.myprint(
str(inspect.stack()[0][3]) + " Le champs 'session_ondemande' de ligne " + str(
n + 2) + " est incorrecte.")
return False, " Le champs 'session_ondemande' de ligne " + str(n + 2) + " est incorrecte. Les valeurs acceptées sont '1' ou '0' ou vide"
mydata['session_ondemande'] = session_ondemande
local_code_postal = ""
@ -667,12 +689,28 @@ def Add_Update_SessionFormation_mass(file=None, Folder=None, diction=None):
if ("distanciel" in df.keys()):
if (str(df['distanciel'].values[n])):
distanciel = str(df['distanciel'].values[n]).strip()
if (distanciel != "1" and distanciel != "0"):
mycommon.myprint(
str(inspect.stack()[0][3]) + " Le champs 'distanciel' de ligne " + str(
n + 2) + " est incorrecte.")
return False, " Le champs 'distanciel' de ligne " + str(
n + 2) + " est incorrecte. Les valeurs acceptées sont '1' ou '0' ou vide"
mydata['distantiel'] = distanciel
presentiel = ""
if ("presentiel" in df.keys()):
if (str(df['presentiel'].values[n])):
presentiel = str(df['presentiel'].values[n]).strip()
if (presentiel != "1" and presentiel != "0"):
mycommon.myprint(
str(inspect.stack()[0][3]) + " Le champs 'presentiel' de ligne " + str(
n + 2) + " est incorrecte.")
return False, " Le champs 'presentiel' de ligne " + str(
n + 2) + " est incorrecte. Les valeurs acceptées sont '1' ou '0' ou vide"
mydata['presentiel'] = presentiel
#mydata['code_postal'] = str(df['code_postal'].values[n]).strip()

View File

@ -1,4 +1,5 @@
,index,mots,occurence,moyenne,id_formation,source_field
0,0,gestion,1,0.33,MYSY_Demo_001,title
1,1,donne,1,0.33,MYSY_Demo_001,title
2,2,base,1,0.33,MYSY_Demo_001,title
0,0,huile,1,0.25,MYSY_Test_AP,keyword
1,1,aromatherapie,1,0.25,MYSY_Test_AP,keyword
2,2,essentielle,1,0.25,MYSY_Test_AP,keyword
3,3,aroma,1,0.25,MYSY_Test_AP,keyword

1 index mots occurence moyenne id_formation source_field
2 0 0 gestion huile 1 0.33 0.25 MYSY_Demo_001 MYSY_Test_AP title keyword
3 1 1 donne aromatherapie 1 0.33 0.25 MYSY_Demo_001 MYSY_Test_AP title keyword
4 2 2 base essentielle 1 0.33 0.25 MYSY_Demo_001 MYSY_Test_AP title keyword
5 3 3 aroma 1 0.25 MYSY_Test_AP keyword

View File

@ -1,4 +1,5 @@
mots occurence moyenne id_formation source_field
0 gestion 1 0.33 MYSY_Demo_001 title
1 donne 1 0.33 MYSY_Demo_001 title
2 base 1 0.33 MYSY_Demo_001 title
mots occurence moyenne id_formation source_field
0 huile 1 0.25 MYSY_Test_AP keyword
1 aromatherapie 1 0.25 MYSY_Test_AP keyword
2 essentielle 1 0.25 MYSY_Test_AP keyword
3 aroma 1 0.25 MYSY_Test_AP keyword

View File

@ -29,7 +29,7 @@ from pymongo import ReturnDocument
import paramiko
from Levenshtein import distance as lev
import class_mgt as class_mgt
import Session_Formation as Session_Formation
"""
Test connexion SQL sur localhost Phpmyadmin
"""
@ -2976,6 +2976,53 @@ def Create_Update_Class_From_Lms(diction):
conn.close()
"""
Creation de la session de formation associé à la formation.
Pr memo il s'agit d'une formation 'à la demande' par defaut
"""
new_diction_session = {}
new_diction_session['date_debut'] = str(datetime.today().strftime("%d/%m/%Y %H:%M:%S"))
new_diction_session['date_fin'] = str(datetime.today().strftime("%d/%m/%Y %H:%M:%S"))
new_diction_session['date_debut_inscription'] = str(datetime.today().strftime("%d/%m/%Y %H:%M:%S"))
new_diction_session['date_fin_inscription'] = str(datetime.today().strftime("%d/%m/%Y %H:%M:%S"))
new_diction_session['nb_participant'] = "99"
new_diction_session['distantiel'] = "1"
new_diction_session['presentiel'] = "0"
new_diction_session['session_ondemande'] = "1"
new_diction_session['prix_session'] = ""
new_diction_session['adresse'] = ""
new_diction_session['code_postal'] = ""
new_diction_session['ville'] = ""
if ("token" in my_partner.keys()):
if my_partner['token']:
new_diction_session['token'] = my_partner['token']
if ("nom" in my_partner.keys()):
if my_partner['nom']:
new_diction_session['formateur'] = my_partner['nom']
if (local_class_code):
new_diction_session['code_session'] = local_class_code
new_diction_session['formation_session_id'] = local_class_code
new_diction_session['lms_class_code'] = local_class_code
if (local_class_internal_url):
new_diction_session['class_internal_url'] = local_class_internal_url
else:
new_diction_session['class_internal_url'] = class_internal_url
print(" ### new_diction_session = ", new_diction_session)
local_status, local_retval = Session_Formation.Add_Update_SessionFormation(new_diction_session)
if (local_status is False):
return local_status, local_retval
return True, " La formation a bien été créée/mise à jour dans le moteur de recherche"
except Exception as e: