08/01/2023 - 22h00

master
cherif 2023-01-08 21:45:12 +01:00
parent 2617995c0f
commit f720c9eac3
8 changed files with 24480 additions and 19 deletions

View File

@ -8,9 +8,8 @@
<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$/partners.py" beforeDir="false" afterPath="$PROJECT_DIR$/partners.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" />
@ -40,7 +39,7 @@
&quot;ASKED_ADD_EXTERNAL_FILES&quot;: &quot;true&quot;,
&quot;RunOnceActivity.OpenProjectViewOnStart&quot;: &quot;true&quot;,
&quot;RunOnceActivity.ShowReadmeOnStart&quot;: &quot;true&quot;,
&quot;last_opened_file_path&quot;: &quot;C:/Users/cheri/Documents/myclass.com/Siteweb/Branche_design/Ela_back/Back_Office&quot;,
&quot;last_opened_file_path&quot;: &quot;C:/Users/cheri/Documents/myclass.com/Siteweb/Production/Ela_back/Back_Office&quot;,
&quot;settings.editor.selected.configurable&quot;: &quot;com.jetbrains.python.configuration.PyActiveSdkModuleConfigurable&quot;
}
}</component>

View File

@ -1050,8 +1050,44 @@ def PrintAttendeeDetail_perSession(diction):
# Recuperation des infotrmations de la formation
local_formation = MYSY_GV.dbname['myclass'].find_one(
{'internal_url': str(local_Insc_retval['class_internal_url'])})
my_retrun_dict['class_title'] = local_formation['title']
my_retrun_dict['formateur'] = local_formation['trainer']
my_local_title = ""
if ("class_title" in local_formation.keys()):
if local_formation['class_title']:
my_retrun_dict['class_title'] = local_formation['title']
my_local_title = local_formation['title']
"""
if( my_local_title == "" ):
mycommon.myprint(
str(inspect.stack()[0][
3]) + " Impossible d'imprimer la fiche detaillée : le title de session est absent ")
return False, " Impossible d'imprimer la fiche detaillée : le title de session est absent "
"""
# Recuperation du formation depuis la collection "session_formation"
tmp_val = MYSY_GV.dbname['session_formation'].find_one({'formation_session_id':str(local_Insc_retval['session_id']), 'valide':'1'})
if( tmp_val is None):
mycommon.myprint(
str(inspect.stack()[0][
3]) + " Impossible d'imprimer la fiche detaillée : code session erronée ")
return False, " Impossible d'imprimer la fiche detaillée : code session erronée "
my_trainer = ""
if ("formateur" in tmp_val.keys()):
if tmp_val['formateur']:
my_trainer = tmp_val['formateur']
my_retrun_dict['formateur'] = tmp_val['formateur']
if (my_trainer == ""):
mycommon.myprint(
str(inspect.stack()[0][
3]) + " Impossible d'imprimer la fiche detaillée : Aucun formateur designé pour la session")
return False, " Impossible d'imprimer la fiche detaillée : Aucun formateur designé pour la session"
my_retrun_dict['partner'] = local_formation['institut_formation']
my_retrun_dict['img_url'] = local_formation['img_url']

File diff suppressed because one or more lines are too long

View File

@ -40,7 +40,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']
'class_internal_url', 'session_status', 'date_debut_inscription', 'date_fin_inscription',
'attestation_certif', "distantiel", "presentiel"]
incom_keys = diction.keys()
for val in incom_keys:
if val not in field_list:
@ -104,6 +105,15 @@ def Add_Update_SessionFormation(diction):
mydata['date_fin'] = diction['date_fin']
if ("distantiel" in diction.keys()):
if diction['distantiel']:
mydata['distantiel'] = diction['distantiel']
if ("presentiel" in diction.keys()):
if diction['presentiel']:
mydata['presentiel'] = diction['presentiel']
if ("nb_participant" in diction.keys()):
if diction['nb_participant']:
mydata['nb_participant'] = diction['nb_participant']
@ -155,6 +165,77 @@ def Add_Update_SessionFormation(diction):
mydata['date_update'] = str(datetime.now())
mydata['valide'] = "1"
# Controle de cohérence sur les dates
local_status = mycommon.CheckisDate(str(diction['date_debut'])[0:10])
if (local_status is False):
mycommon.myprint(
str(inspect.stack()[0][
3]) + " - Impossible de créer/mettre à jour la session de formation. La date de debut n'est pas au format jj/mm/aaaa ")
return False, " - Impossible de créer/mettre à jour la session de formation. La date de debut n'est pas au format jj/mm/aaaa "
local_status = mycommon.CheckisDate(str(diction['date_fin'])[0:10])
if (local_status is False):
mycommon.myprint(
str(inspect.stack()[0][
3]) + " - Impossible de créer/mettre à jour la session de formation. La date de fin n'est pas au format jj/mm/aaaa ")
return False, " - Impossible de créer/mettre à jour la session de formation. La date de fin n'est pas au format jj/mm/aaaa "
local_status = mycommon.CheckisDate(str(diction['date_debut_inscription'])[0:10])
if (local_status is False):
mycommon.myprint(
str(inspect.stack()[0][
3]) + " - Impossible de créer/mettre à jour la session de formation. La date_debut_inscription n'est pas au format jj/mm/aaaa ")
return False, " - Impossible de créer/mettre à jour la session de formation. La date_debut_inscription n'est pas au format jj/mm/aaaa "
local_status = mycommon.CheckisDate(str(diction['date_fin_inscription'])[0:10])
if (local_status is False):
mycommon.myprint(
str(inspect.stack()[0][
3]) + " - Impossible de créer/mettre à jour la session de formation. La date_fin_inscription n'est pas au format jj/mm/aaaa ")
return False, " - Impossible de créer/mettre à jour la session de formation. La date_fin_inscription n'est pas au format jj/mm/aaaa "
if (datetime.strptime(str(diction['date_debut'])[0:10], '%d/%m/%Y') > datetime.strptime(
str(diction['date_fin'])[0:10], '%d/%m/%Y')):
mycommon.myprint(
str(inspect.stack()[0][
3]) + " - Impossible de créer/mettre à jour la session de formation : La date debut " + str(
diction['date_debut']) +
" est posterieure à la date de fin " + str(diction['date_fin']) )
return False, " Impossible de créer la session de formation : La date debut " + str(diction['date_debut']) + \
" est posterieure à la date de fin " + str(diction['date_fin']) + " "
if (datetime.strptime(str(diction['date_debut_inscription'])[0:10], '%d/%m/%Y') > datetime.strptime(
str(diction['date_fin_inscription'])[0:10], '%d/%m/%Y')):
mycommon.myprint(
str(inspect.stack()[0][
3]) + " - Impossible de créer/mettre à jour la session de formation : La date date_debut_inscription " + str(
diction['date_debut_inscription']) +
" est posterieure à la date de date_fin_inscription " + str(diction['date_fin_inscription']) )
return False, " Impossible de créer /mettre à jour la session de formation : La date_debut_inscription " + str(diction['date_debut_inscription']) + \
" est posterieure à la date_fin_inscription " + str(diction['date_fin_inscription']) + " "
mytoday = datetime.today().strftime("%d/%m/%Y")
if (datetime.strptime(str(diction['date_debut'])[0:10], '%d/%m/%Y') < datetime.strptime(str(mytoday).strip(), '%d/%m/%Y')) :
mycommon.myprint(
str(inspect.stack()[0][
3]) + " - Impossible de créer/mettre à jour la session de formation : La date de debut de sessions " + str(
diction['date_debut']) +" est antirieure à la date du jour ")
return False, " - Impossible de créer/mettre à jour la session de formation : La date de debut de sessions " + str(
diction['date_debut']) +" est antirieure à la date du jour "
# Fin Controle de cohérence sur les dates
print(" ### query_key = ", query_key)
@ -394,7 +475,7 @@ def Add_Update_SessionFormation_mass(file=None, Folder=None, diction=None):
if val not in field_list:
mycommon.myprint(
str(inspect.stack()[0][3]) + " Le champ '" + val + "' n'existe pas, Creation session annulée")
return False, " Verifier votre API"
return False, " Le champ '" + val + "' n'existe pas, Creation session annulée "
'''
Une fois qu'on a controlé que toutes les clés mise dans l'API sont correcte. etape precedente,
@ -406,7 +487,7 @@ def Add_Update_SessionFormation_mass(file=None, Folder=None, diction=None):
if val not in diction:
mycommon.myprint(
str(inspect.stack()[0][3]) + " - La valeur '" + val + "' n'est pas presente dans liste ")
return False, " Verifier votre API"
return False, " La valeur '" + val + "' n'est pas presente dans liste"
my_token = ""
if ("token" in diction.keys()):
@ -446,7 +527,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']
'code_session', "distantiel", "presentiel"]
# Controle du nombre de lignes dans le fichier.
total_rows = len(df)
@ -554,6 +635,18 @@ def Add_Update_SessionFormation_mass(file=None, Folder=None, diction=None):
local_code_postal = str(df['code_postal'].values[n]).strip()
mydata['code_postal'] = local_code_postal
distantiel = ""
if ("distantiel" in df.keys()):
if (str(df['distantiel'].values[n])):
distanciel = str(df['distantiel'].values[n]).strip()
mydata['distantiel'] = distanciel
presentiel = ""
if ("presentiel" in df.keys()):
if (str(df['presentiel'].values[n])):
presentiel = str(df['presentiel'].values[n]).strip()
mydata['presentiel'] = presentiel
#mydata['code_postal'] = str(df['code_postal'].values[n]).strip()
local_ville = ""

View File

@ -53,7 +53,7 @@ def add_class(diction):
for val in incom_keys:
if val not in field_list:
mycommon.myprint(str(inspect.stack()[0][3])+" - Creation formation : Le champ '" + val + "' n'est pas autorisé, Creation formation annulée")
return False, " Verifier votre API"
return False, " Le champ '" + val + "' n'est pas autorisé, Creation formation annulée "
'''
Une fois qu'on a controlé que toutes les clés mise dans l'API sont correcte. etape precedente,
@ -64,7 +64,7 @@ def add_class(diction):
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, " Verifier votre API"
return False, " La valeur '" + val + "' n'est pas presente dans liste"
'''
@ -90,7 +90,7 @@ def add_class(diction):
if retval is False:
mycommon.myprint(str(inspect.stack()[0][3]) + " - Le token n'est pas valide")
return False, "L'email ou le token ne sont pas valident"
return False, "Les informations d'identification ne sont pas valident"
# Recuperation du recid du partenaire
user_recid = mycommon.get_parnter_recid_from_token(str(mydata['token']))
@ -253,7 +253,6 @@ def add_class(diction):
return False, " La formation "+str(mydata['external_code'])+" a plus de "+ str(MYSY_GV.MAX_KEYWORD)+" mots clés"
if ("domaine" in diction.keys()):
if diction['domaine']:
mydata['domaine'] = diction['domaine']
@ -533,7 +532,7 @@ def add_class(diction):
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 d'ajouter la formation"
return False, "Impossible d'ajouter la formation"+ str(e)
'''
@ -2412,7 +2411,7 @@ def add_class_mass(file=None, Folder=None, diction=None):
for val in incom_keys:
if val not in field_list:
mycommon.myprint(str(inspect.stack()[0][3]) + " - Creation formation : Le champ '" + val + "' n'existe pas, Creation formation annulée")
return False, " Verifier votre API"
return False, " Le champ '" + val + "' n'existe pas, Creation formation annulée"
'''
Une fois qu'on a controlé que toutes les clés mise dans l'API sont correcte. etape precedente,
@ -2732,7 +2731,7 @@ def add_class_mass(file=None, Folder=None, diction=None):
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 d'inserer les formation en masse "
return False, "Impossible d'inserer les formation en masse -" + str(e)

View File

@ -1,3 +1,4 @@
,index,mots,occurence,moyenne,id_formation,source_field
0,0,stres,1,0.5,CODE_10009,title
1,1,gestion,1,0.5,CODE_10009,title
0,0,parole,1,0.33,CODE_10006,title
1,1,prise,1,0.33,CODE_10006,title
2,2,public,1,0.33,CODE_10006,title

1 index mots occurence moyenne id_formation source_field
2 0 0 stres parole 1 0.5 0.33 CODE_10009 CODE_10006 title
3 1 1 gestion prise 1 0.5 0.33 CODE_10009 CODE_10006 title
4 2 2 public 1 0.33 CODE_10006 title

13
main.py
View File

@ -2264,6 +2264,19 @@ def GetListEvaluation_Session():
return jsonify(status=localStatus, message=message )
"""
API de recuperation de liste des liste_domaine_metier
"""
@app.route('/myclass/api/get_List_domaine_formation/', methods=['POST','GET'])
@crossdomain(origin='*')
def get_List_domaine_formation():
# On recupere le corps (payload) de la requete
payload = request.form.to_dict()
print(" ### get_List_domaine_formation : payload = ",str(payload))
localStatus, message= mycommon.get_List_domaine_formation()
return jsonify(status=localStatus, message=message )
if __name__ == '__main__':

View File

@ -2570,4 +2570,29 @@ def GetAttendeeDetail_perSession(diction):
except Exception as e:
exc_type, exc_obj, exc_tb = sys.exc_info()
print(str(inspect.stack()[0][3]) + " -" + str(e) + " - ERRORRRR AT Line : " + str(exc_tb.tb_lineno))
return False, " Impossible de recuperer les informations detaillées"
return False, " Impossible de recuperer les informations detaillées"
""" Cette fonction retourne la liste des domaines
de formation
"""
def get_List_domaine_formation():
try:
coll_liste_domaine_metier = MYSY_GV.dbname['liste_domaine_metier']
myquery = {}
myquery['valide'] = "1"
RetObject = []
val_tmp = 1
for retval in coll_liste_domaine_metier.find(myquery).distinct('domaine'):
user = retval
RetObject.append(JSONEncoder().encode(user))
return True, RetObject
except Exception as e:
exc_type, exc_obj, exc_tb = sys.exc_info()
print(str(inspect.stack()[0][3]) + " -" + str(e) + " - ERRORRRR AT Line : " + str(exc_tb.tb_lineno))
return False, " Impossible de recuperer la liste de domaines de formation"