09/12/2022 - 19h00
parent
b44cb928b8
commit
e0f4fa3056
|
@ -6,23 +6,12 @@
|
||||||
<change beforePath="$PROJECT_DIR$/GlobalVariable.py" beforeDir="false" afterPath="$PROJECT_DIR$/GlobalVariable.py" afterDir="false" />
|
<change beforePath="$PROJECT_DIR$/GlobalVariable.py" beforeDir="false" afterPath="$PROJECT_DIR$/GlobalVariable.py" 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$/Template/MySy_Create_PRO_account_tpl.html" beforeDir="false" afterPath="$PROJECT_DIR$/Template/MySy_Create_PRO_account_tpl.html" afterDir="false" />
|
<change beforePath="$PROJECT_DIR$/Session_Formation.py" beforeDir="false" afterPath="$PROJECT_DIR$/Session_Formation.py" afterDir="false" />
|
||||||
<change beforePath="$PROJECT_DIR$/Template/MySy_Create_User_account_tpl.html" beforeDir="false" afterPath="$PROJECT_DIR$/Template/MySy_Create_User_account_tpl.html" afterDir="false" />
|
|
||||||
<change beforePath="$PROJECT_DIR$/Template/MySy_Demande_Info_Class_tpl.html" beforeDir="false" afterPath="$PROJECT_DIR$/Template/MySy_Demande_Info_Class_tpl.html" afterDir="false" />
|
|
||||||
<change beforePath="$PROJECT_DIR$/Template/MySy_Invoice_tpl.html" beforeDir="false" afterPath="$PROJECT_DIR$/Template/MySy_Invoice_tpl.html" afterDir="false" />
|
|
||||||
<change beforePath="$PROJECT_DIR$/Template/MySy_Sales_Order_tpl.html" beforeDir="false" afterPath="$PROJECT_DIR$/Template/MySy_Sales_Order_tpl.html" afterDir="false" />
|
|
||||||
<change beforePath="$PROJECT_DIR$/Template/MySy_User_account_change_pwd_tpl.html" beforeDir="false" afterPath="$PROJECT_DIR$/Template/MySy_User_account_change_pwd_tpl.html" afterDir="false" />
|
|
||||||
<change beforePath="$PROJECT_DIR$/Template/MySy_User_account_enabled_tpl.html" beforeDir="false" afterPath="$PROJECT_DIR$/Template/MySy_User_account_enabled_tpl.html" afterDir="false" />
|
|
||||||
<change beforePath="$PROJECT_DIR$/Template/MySy_account_pro_enabled_tpl.html" beforeDir="false" afterPath="$PROJECT_DIR$/Template/MySy_account_pro_enabled_tpl.html" afterDir="false" />
|
|
||||||
<change beforePath="$PROJECT_DIR$/Template/MySy_confirmation_inscription_formation_tpl.html" beforeDir="false" afterPath="$PROJECT_DIR$/Template/MySy_confirmation_inscription_formation_tpl.html" afterDir="false" />
|
|
||||||
<change beforePath="$PROJECT_DIR$/Template/invoice.html" beforeDir="false" afterPath="$PROJECT_DIR$/Template/invoice.html" afterDir="false" />
|
|
||||||
<change beforePath="$PROJECT_DIR$/class_mgt.py" beforeDir="false" afterPath="$PROJECT_DIR$/class_mgt.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$/data_indexees.csv" beforeDir="false" afterPath="$PROJECT_DIR$/data_indexees.csv" afterDir="false" />
|
||||||
<change beforePath="$PROJECT_DIR$/ela_factures_mgt.py" beforeDir="false" afterPath="$PROJECT_DIR$/ela_factures_mgt.py" 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$/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$/email_inscription_mgt.py" beforeDir="false" afterPath="$PROJECT_DIR$/email_inscription_mgt.py" afterDir="false" />
|
|
||||||
<change beforePath="$PROJECT_DIR$/email_mgt.py" beforeDir="false" afterPath="$PROJECT_DIR$/email_mgt.py" afterDir="false" />
|
|
||||||
<change beforePath="$PROJECT_DIR$/main.py" beforeDir="false" afterPath="$PROJECT_DIR$/main.py" 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>
|
</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" />
|
||||||
|
@ -45,7 +34,7 @@
|
||||||
"ASKED_ADD_EXTERNAL_FILES": "true",
|
"ASKED_ADD_EXTERNAL_FILES": "true",
|
||||||
"RunOnceActivity.OpenProjectViewOnStart": "true",
|
"RunOnceActivity.OpenProjectViewOnStart": "true",
|
||||||
"RunOnceActivity.ShowReadmeOnStart": "true",
|
"RunOnceActivity.ShowReadmeOnStart": "true",
|
||||||
"last_opened_file_path": "C:/Users/cheri/Documents/myclass.com/Siteweb/Production/Ela_back/MySy_Back_Office",
|
"last_opened_file_path": "C:/Users/cheri/Documents/myclass.com/Siteweb/Branche_design/Ela_back/Back_Office",
|
||||||
"settings.editor.selected.configurable": "com.jetbrains.python.configuration.PyActiveSdkModuleConfigurable"
|
"settings.editor.selected.configurable": "com.jetbrains.python.configuration.PyActiveSdkModuleConfigurable"
|
||||||
}
|
}
|
||||||
}</component>
|
}</component>
|
||||||
|
@ -177,6 +166,11 @@
|
||||||
<line>251</line>
|
<line>251</line>
|
||||||
<option name="timeStamp" value="1" />
|
<option name="timeStamp" value="1" />
|
||||||
</line-breakpoint>
|
</line-breakpoint>
|
||||||
|
<line-breakpoint enabled="true" suspend="THREAD" type="python-line">
|
||||||
|
<url>file://$PROJECT_DIR$/Session_Formation.py</url>
|
||||||
|
<line>4</line>
|
||||||
|
<option name="timeStamp" value="2" />
|
||||||
|
</line-breakpoint>
|
||||||
</breakpoints>
|
</breakpoints>
|
||||||
</breakpoint-manager>
|
</breakpoint-manager>
|
||||||
</component>
|
</component>
|
||||||
|
|
|
@ -232,4 +232,10 @@ O365_SMTP_COUNT_port = 587
|
||||||
"""
|
"""
|
||||||
Repertoire temporaire de telechargement ou de creation de fichier
|
Repertoire temporaire de telechargement ou de creation de fichier
|
||||||
"""
|
"""
|
||||||
TEMPORARY_DIRECTORY = "./temp_direct"
|
TEMPORARY_DIRECTORY = "./temp_direct"
|
||||||
|
|
||||||
|
|
||||||
|
"""
|
||||||
|
Nombre maximum de participants importable par csv
|
||||||
|
"""
|
||||||
|
MAX_PARTICIPANT_BY_CSV = 50
|
|
@ -772,4 +772,174 @@ def DownloadParticipantsList(diction):
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
exc_type, exc_obj, exc_tb = sys.exc_info()
|
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))
|
mycommon.myprint(str(inspect.stack()[0][3]) + " -" + str(e) + " - ERRORRRR AT Line : " + str(exc_tb.tb_lineno))
|
||||||
return False, "Impossible d'envoyer la confirmation d'inscription"
|
return False, "Impossible d'envoyer la confirmation d'inscription"
|
||||||
|
|
||||||
|
|
||||||
|
""" Import des inscriptions en masse
|
||||||
|
Avec l'import d'un fichier csv
|
||||||
|
"""
|
||||||
|
def AddStagiairetoClass_mass(file=None, Folder=None, diction=None):
|
||||||
|
try:
|
||||||
|
|
||||||
|
'''
|
||||||
|
# Verification que les champs reçus dans l'API sont bien dans la liste des champs autorisés
|
||||||
|
# Cela evite le cas ou une entité tierce ajouter les valeurs inconnu dans l'API
|
||||||
|
# Ici on doit mettre tous les champs possible (obligatoire ou non) de la BDD dans la liste
|
||||||
|
# field_list.
|
||||||
|
'''
|
||||||
|
field_list = ['token','session_id']
|
||||||
|
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'existe pas, Creation formation annulée")
|
||||||
|
return False, " Verifier votre API"
|
||||||
|
|
||||||
|
'''
|
||||||
|
Une fois qu'on a controlé que toutes les clés mise dans l'API sont correcte. etape precedente,
|
||||||
|
On controle que les champs obligatoires sont presents dans la liste
|
||||||
|
'''
|
||||||
|
field_list_obligatoire = ['token', 'session_id']
|
||||||
|
|
||||||
|
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"
|
||||||
|
|
||||||
|
my_token = ""
|
||||||
|
if ("token" in diction.keys()):
|
||||||
|
if diction['token']:
|
||||||
|
my_token = diction['token']
|
||||||
|
|
||||||
|
session_id = ""
|
||||||
|
if ("session_id" in diction.keys()):
|
||||||
|
if diction['session_id']:
|
||||||
|
session_id = diction['session_id']
|
||||||
|
|
||||||
|
if(len(str(session_id).strip()) <= 0 ):
|
||||||
|
mycommon.myprint(
|
||||||
|
str(inspect.stack()[0][3]) + " La session de formation est vide : Impossible d'importer la liste des participants ")
|
||||||
|
return False, "la session de formation est incorrecte. Impossible d'importer la liste des participants"
|
||||||
|
|
||||||
|
|
||||||
|
partner_recid = mycommon.get_parnter_recid_from_token(my_token)
|
||||||
|
if (partner_recid is False):
|
||||||
|
mycommon.myprint(str(inspect.stack()[0][3]) + " - partner_recid KO : Impossible d'importer la liste des participants ")
|
||||||
|
return False, "les information de connexion sont incorrectes. Impossible d'importer la liste des participants"
|
||||||
|
|
||||||
|
status, saved_file = mycommon.Upload_Save_CSV_File(file, Folder)
|
||||||
|
if (status == False):
|
||||||
|
return False, "Impossible d'importer la liste des participants, le nom du fichier est incorrect "
|
||||||
|
|
||||||
|
#" Lecture du fichier "
|
||||||
|
#print(" Lecture du fichier : "+saved_file)
|
||||||
|
nb_line = 0
|
||||||
|
|
||||||
|
df = pd.read_csv(saved_file, encoding='utf8', on_bad_lines='skip', sep=';')
|
||||||
|
|
||||||
|
# Dictionnaire des champs utilisables
|
||||||
|
'''
|
||||||
|
# Verification que les noms des colonne sont bien corrects"
|
||||||
|
'''
|
||||||
|
field_list = ['prenom', 'nom', 'employeur', 'telephone', 'email', 'modefinancement',
|
||||||
|
'opco', 'status', 'prix']
|
||||||
|
|
||||||
|
|
||||||
|
# Controle du nombre de lignes dans le fichier.
|
||||||
|
total_rows = len(df)
|
||||||
|
if( total_rows > MYSY_GV.MAX_PARTICIPANT_BY_CSV ):
|
||||||
|
mycommon.myprint(
|
||||||
|
str(inspect.stack()[0][3]) + " Le fichier comporte plus de "+str(MYSY_GV.MAX_PARTICIPANT_BY_CSV)+" lignes.")
|
||||||
|
return False, " Le fichier comporte plus de "+str(MYSY_GV.MAX_PARTICIPANT_BY_CSV)+" lignes."
|
||||||
|
|
||||||
|
|
||||||
|
#print(df.columns)
|
||||||
|
for val in df.columns:
|
||||||
|
if str(val).lower() not in field_list:
|
||||||
|
mycommon.myprint(
|
||||||
|
str(inspect.stack()[0][3])+" : entete du fichier csv. '" + val + "' n'est pas acceptée")
|
||||||
|
return False, " Entete du fichier csv. '" + val + "' n'est pas acceptée"
|
||||||
|
|
||||||
|
# Recuperation des info de la session.
|
||||||
|
session_data = MYSY_GV.dbname['session_formation'].find({'formation_session_id':str(session_id)})
|
||||||
|
if( session_data is None ):
|
||||||
|
mycommon.myprint(
|
||||||
|
str(inspect.stack()[0][
|
||||||
|
3]) + " La session de formation n'existe pas : Impossible d'importer la liste des participants ")
|
||||||
|
return False, "la session de formation n'existe pas. Impossible d'importer la liste des participants"
|
||||||
|
|
||||||
|
|
||||||
|
x = range(0, total_rows)
|
||||||
|
for n in x:
|
||||||
|
mydata = {}
|
||||||
|
mydata['prenom'] = str(df['prenom'].values[n])
|
||||||
|
mydata['nom'] = str(df['nom'].values[n])
|
||||||
|
mydata['employeur'] = str(df['employeur'].values[n])
|
||||||
|
mydata['telephone'] = str(df['telephone'].values[n])
|
||||||
|
mydata['email'] = str(df['email'].values[n])
|
||||||
|
|
||||||
|
modefinancement = ""
|
||||||
|
if ("modefinancement" in df.keys()):
|
||||||
|
if (str(df['modefinancement'].values[n])):
|
||||||
|
modefinancement = str(df['modefinancement'].values[n])
|
||||||
|
mydata['modefinancement'] = modefinancement
|
||||||
|
|
||||||
|
|
||||||
|
opco = ""
|
||||||
|
if ("opco" in df.keys()):
|
||||||
|
if (str(df['opco'].values[n])):
|
||||||
|
opco = str(df['opco'].values[n])
|
||||||
|
mydata['opco'] = opco
|
||||||
|
|
||||||
|
|
||||||
|
local_status = str(df['status'].values[n]).strip()
|
||||||
|
if( local_status != "0" and local_status != "1" and local_status != "2"):
|
||||||
|
mycommon.myprint(
|
||||||
|
str(inspect.stack()[0][
|
||||||
|
3]) + " Le champs 'status' de ligne "+str(n)+" est incorrecte. les valeurs acceptées sont : 0,1,2")
|
||||||
|
return False, " Le champs 'status' de ligne "+str(n)+" est incorrecte. les valeurs acceptées sont : 0,1,2"
|
||||||
|
|
||||||
|
mydata['status'] = float(local_status)
|
||||||
|
|
||||||
|
local_price = str(df['prix'].values[n]).strip()
|
||||||
|
local_status, new_price = mycommon.IsFloat(local_price)
|
||||||
|
if( local_status is False ):
|
||||||
|
mycommon.myprint(
|
||||||
|
str(inspect.stack()[0][ 3]) + " Le champs 'prix' de ligne " + str( n) + " est incorrecte.")
|
||||||
|
return False, " Le champs status de ligne " + str(n) + " est incorrecte. "
|
||||||
|
|
||||||
|
mydata['price'] = local_price
|
||||||
|
|
||||||
|
|
||||||
|
mydata['session_id'] = str(session_data['formation_session_id'])
|
||||||
|
|
||||||
|
tab_date_du = str(session_data['date_debut']).split(" ")
|
||||||
|
mydata['date_du'] = str(tab_date_du[0])
|
||||||
|
|
||||||
|
tab_date_au = str(session_data['date_fin']).split(" ")
|
||||||
|
mydata['date_au'] = str(tab_date_au[0])
|
||||||
|
|
||||||
|
|
||||||
|
mydata['ville'] = str(session_data['ville'])
|
||||||
|
|
||||||
|
mydata['code_postal'] = str(session_data['code_postal'])
|
||||||
|
mydata['adresse'] = str(session_data['adresse'])
|
||||||
|
mydata['class_internal_url'] = str(session_data['class_internal_url'])
|
||||||
|
|
||||||
|
|
||||||
|
clean_dict = {k: mydata[k] for k in mydata if ( str(mydata[k]) != "nan") }
|
||||||
|
|
||||||
|
print( "#### clean_dict ", clean_dict)
|
||||||
|
"""status, retval = add_class(clean_dict)
|
||||||
|
|
||||||
|
if( status is False ):
|
||||||
|
return status, retval
|
||||||
|
"""
|
||||||
|
print(str(total_rows)+" formations ont été inserées")
|
||||||
|
|
||||||
|
return True, str(total_rows)+" formations ont été inserées / Mises à jour"
|
||||||
|
|
||||||
|
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 "
|
||||||
|
|
||||||
|
|
3726
Log/log_file.log
3726
Log/log_file.log
File diff suppressed because one or more lines are too long
|
@ -19,6 +19,7 @@ import GlobalVariable as MYSY_GV
|
||||||
from math import isnan
|
from math import isnan
|
||||||
import GlobalVariable as MYSY_GV
|
import GlobalVariable as MYSY_GV
|
||||||
from datetime import timedelta
|
from datetime import timedelta
|
||||||
|
from datetime import timedelta
|
||||||
|
|
||||||
|
|
||||||
"""
|
"""
|
||||||
|
@ -266,14 +267,27 @@ def GetActiveSessionFormation_List(diction):
|
||||||
myquery['class_internal_url'] = class_internal_url
|
myquery['class_internal_url'] = class_internal_url
|
||||||
myquery['valide'] = "1"
|
myquery['valide'] = "1"
|
||||||
myquery['session_status'] = "true"
|
myquery['session_status'] = "true"
|
||||||
|
|
||||||
|
|
||||||
#print(" ##### myquery = "+str(myquery))
|
|
||||||
RetObject = []
|
RetObject = []
|
||||||
|
|
||||||
for retval in coll_session.find(myquery):
|
for retval in coll_session.find(myquery):
|
||||||
#print(" ##### retval = " + str(retval))
|
|
||||||
RetObject.append(mycommon.JSONEncoder().encode(retval))
|
local_tmp = retval
|
||||||
|
## Verification des conditions supplementaires :
|
||||||
|
# en realité c'est parce que c'est chaud de le faire avec pymongo
|
||||||
|
tmp_debut_inscritp = str(local_tmp['date_debut_inscription']).strip().split(" ")
|
||||||
|
tmp_fin_inscritp = str(local_tmp['date_fin_inscription']).strip().split(" ")
|
||||||
|
|
||||||
|
debut_inscr = datetime.strptime(str(tmp_debut_inscritp[0]).strip(), '%d/%m/%Y')
|
||||||
|
fin_inscr = datetime.strptime(str(tmp_fin_inscritp[0]).strip(), '%d/%m/%Y')
|
||||||
|
|
||||||
|
#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))
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#print("####RetObject = "+str(RetObject))
|
#print("####RetObject = "+str(RetObject))
|
||||||
return True, RetObject
|
return True, RetObject
|
||||||
|
|
90
class_mgt.py
90
class_mgt.py
|
@ -2486,18 +2486,83 @@ def add_class_mass(file=None, Folder=None, diction=None):
|
||||||
mydata['title'] = str(df['titre'].values[n])
|
mydata['title'] = str(df['titre'].values[n])
|
||||||
mydata['domaine'] = str(df['domaine'].values[n])
|
mydata['domaine'] = str(df['domaine'].values[n])
|
||||||
mydata['description'] = str(df['description'].values[n])
|
mydata['description'] = str(df['description'].values[n])
|
||||||
mydata['trainer'] = str(df['formateur'].values[n])
|
|
||||||
mydata['institut_formation'] = str(df['institut_formation'].values[n])
|
|
||||||
#mydata['distantiel'] = str(df['presentiel'].values[n])
|
formateur = ""
|
||||||
mydata['url'] = str(df['url'].values[n])
|
if ("formateur" in df.keys()):
|
||||||
mydata['duration'] = float(str(df['duree'].values[n]))
|
if (str(df['formateur'].values[n])):
|
||||||
mydata['plus_produit'] = str(df['plus_produit'].values[n])
|
formateur = str(df['formateur'].values[n])
|
||||||
mydata['mots_cle'] = str(df['mots_cle'].values[n])
|
mydata['trainer'] = formateur
|
||||||
mydata['presentiel'] = str(df['presentiel'].values[n])
|
|
||||||
mydata['distantiel'] = str(df['distantiel'].values[n])
|
|
||||||
mydata['price'] = str(df['prix'].values[n])
|
institut_formation = ""
|
||||||
mydata['metier'] = str(df['metier'].values[n])
|
if ("institut_formation" in df.keys()):
|
||||||
mydata['published'] = str(df['publie'].values[n])
|
if (str(df['institut_formation'].values[n])):
|
||||||
|
institut_formation = str(df['institut_formation'].values[n])
|
||||||
|
mydata['institut_formation'] = institut_formation
|
||||||
|
|
||||||
|
|
||||||
|
#mydata['duration'] = float(str(df['duree'].values[n]))
|
||||||
|
|
||||||
|
url = ""
|
||||||
|
if ("url" in df.keys()):
|
||||||
|
if (str(df['url'].values[n])):
|
||||||
|
url = str(df['url'].values[n])
|
||||||
|
mydata['url'] = url
|
||||||
|
|
||||||
|
duration = 0
|
||||||
|
if ("duree" in df.keys()):
|
||||||
|
if (str(df['duree'].values[n])):
|
||||||
|
plus_produit = str(df['duree'].values[n])
|
||||||
|
mydata['duration'] = duration
|
||||||
|
|
||||||
|
|
||||||
|
plus_produit = ""
|
||||||
|
if ("plus_produit" in df.keys()):
|
||||||
|
if (str(df['plus_produit'].values[n])):
|
||||||
|
plus_produit = str(df['plus_produit'].values[n])
|
||||||
|
mydata['plus_produit'] = plus_produit
|
||||||
|
|
||||||
|
mots_cle = ""
|
||||||
|
if ("mots_cle" in df.keys()):
|
||||||
|
if (str(df['mots_cle'].values[n])):
|
||||||
|
presentiel = str(df['mots_cle'].values[n])
|
||||||
|
mydata['mots_cle'] = mots_cle
|
||||||
|
|
||||||
|
|
||||||
|
presentiel = "0"
|
||||||
|
if ("presentiel" in df.keys()):
|
||||||
|
if (str(df['presentiel'].values[n])):
|
||||||
|
presentiel = str(df['presentiel'].values[n])
|
||||||
|
mydata['presentiel'] = presentiel
|
||||||
|
|
||||||
|
distantiel = "0"
|
||||||
|
if ("distantiel" in df.keys()):
|
||||||
|
if (str(df['distantiel'].values[n])):
|
||||||
|
distantiel = str(df['distantiel'].values[n])
|
||||||
|
mydata['distantiel'] = distantiel
|
||||||
|
|
||||||
|
|
||||||
|
price = "0"
|
||||||
|
if ("prix" in df.keys()):
|
||||||
|
if (str(df['prix'].values[n])):
|
||||||
|
price = str(df['prix'].values[n])
|
||||||
|
mydata['price'] = price
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
metier = "1"
|
||||||
|
if ("metier" in df.keys()):
|
||||||
|
if (str(df['metier'].values[n])):
|
||||||
|
metier = str(df['metier'].values[n])
|
||||||
|
mydata['metier'] = metier
|
||||||
|
|
||||||
|
published = "1"
|
||||||
|
if ("published" in df.keys()):
|
||||||
|
if (str(df['published'].values[n])):
|
||||||
|
published = str(df['published'].values[n])
|
||||||
|
mydata['published'] = published
|
||||||
|
|
||||||
|
|
||||||
if ("cpf" in df.keys()):
|
if ("cpf" in df.keys()):
|
||||||
if (str(df['cpf'].values[n])):
|
if (str(df['cpf'].values[n])):
|
||||||
|
@ -2608,6 +2673,7 @@ def add_class_mass(file=None, Folder=None, diction=None):
|
||||||
return False, "Impossible d'inserer les formation en masse "
|
return False, "Impossible d'inserer les formation en masse "
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
'''
|
'''
|
||||||
Cette fonction retourne les formation par metier
|
Cette fonction retourne les formation par metier
|
||||||
- la thématique est defini par un nouveau champ appelé "metier"
|
- la thématique est defini par un nouveau champ appelé "metier"
|
||||||
|
|
|
@ -1,5 +1,4 @@
|
||||||
,index,mots,occurence,moyenne,id_formation,source_field
|
,index,mots,occurence,moyenne,id_formation,source_field
|
||||||
0,0,framework,1,0.25,3IL_10004,keyword
|
0,0,prise,1,0.33,3IL_10006,title
|
||||||
1,1,php,1,0.25,3IL_10004,keyword
|
1,1,parole,1,0.33,3IL_10006,title
|
||||||
2,2,mobile,1,0.25,3IL_10004,keyword
|
2,2,public,1,0.33,3IL_10006,title
|
||||||
3,3,p,1,0.25,3IL_10004,keyword
|
|
||||||
|
|
|
|
@ -1,5 +1,3 @@
|
||||||
mots occurence moyenne id_formation source_field
|
Empty DataFrame
|
||||||
0 framework 1 0.25 3IL_10004 keyword
|
Columns: [mots, occurence, moyenne, id_formation, source_field]
|
||||||
1 php 1 0.25 3IL_10004 keyword
|
Index: []
|
||||||
2 mobile 1 0.25 3IL_10004 keyword
|
|
||||||
3 p 1 0.25 3IL_10004 keyword
|
|
13
main.py
13
main.py
|
@ -2077,6 +2077,19 @@ def DownloadParticipantsList(sessionid, token):
|
||||||
return local_file
|
return local_file
|
||||||
|
|
||||||
|
|
||||||
|
"""
|
||||||
|
API d'import des stagaires en masse avec un fichier csv
|
||||||
|
"""
|
||||||
|
|
||||||
|
@app.route('/myclass/api/AddStagiairetoClass_mass/', methods=['POST','GET'])
|
||||||
|
@crossdomain(origin='*')
|
||||||
|
def AddStagiairetoClass_mass():
|
||||||
|
# On recupere le corps (payload) de la requete
|
||||||
|
payload = request.form.to_dict()
|
||||||
|
print(" ### AddStagiairetoClass_mass : payload = ",str(payload))
|
||||||
|
localStatus, message= inscription.AddStagiairetoClass_mass(payload)
|
||||||
|
return jsonify(status=localStatus, message=message )
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
|
|
|
@ -450,6 +450,18 @@ def tryFloat(val):
|
||||||
except ValueError:
|
except ValueError:
|
||||||
return 0
|
return 0
|
||||||
|
|
||||||
|
"""
|
||||||
|
Verifie si c'est un float.
|
||||||
|
returl status et la valeur
|
||||||
|
"""
|
||||||
|
def IsFloat(val):
|
||||||
|
try:
|
||||||
|
val = str(val).replace(",",".")
|
||||||
|
myfloat = float(val)
|
||||||
|
return True, myfloat
|
||||||
|
except ValueError:
|
||||||
|
return False, 0
|
||||||
|
|
||||||
|
|
||||||
'''
|
'''
|
||||||
Check if string is Int and convert.
|
Check if string is Int and convert.
|
||||||
|
|
Loading…
Reference in New Issue