01/11/2022 - 19h
parent
990f859d20
commit
db1548554c
|
@ -63,7 +63,7 @@ token_fr_pontuation = []
|
||||||
La taille maximal d'un champs à retourner.
|
La taille maximal d'un champs à retourner.
|
||||||
Au dela de 300 caractère, le système rame
|
Au dela de 300 caractère, le système rame
|
||||||
'''
|
'''
|
||||||
MAX_CARACT = 100
|
MAX_CARACT = 300
|
||||||
MAX_CARACT_DEDUIT = 150
|
MAX_CARACT_DEDUIT = 150
|
||||||
TOKEN_SIZE = 25
|
TOKEN_SIZE = 25
|
||||||
MAX_CARACT_DETAIL = 500
|
MAX_CARACT_DETAIL = 500
|
||||||
|
|
32
class_mgt.py
32
class_mgt.py
|
@ -314,6 +314,8 @@ def add_class(diction):
|
||||||
if diction['date_lieu']:
|
if diction['date_lieu']:
|
||||||
tmp_str2 = str(diction['date_lieu']).lower().replace(",", ";").replace("\r\n", "")
|
tmp_str2 = str(diction['date_lieu']).lower().replace(",", ";").replace("\r\n", "")
|
||||||
|
|
||||||
|
#print(" ### tmp_str2 = "+str(tmp_str2))
|
||||||
|
|
||||||
if (not tmp_str2.endswith(";")):
|
if (not tmp_str2.endswith(";")):
|
||||||
tmp_str2 = tmp_str2 + ";"
|
tmp_str2 = tmp_str2 + ";"
|
||||||
|
|
||||||
|
@ -337,8 +339,9 @@ def add_class(diction):
|
||||||
dl_cpt = 0
|
dl_cpt = 0
|
||||||
tab_dl = []
|
tab_dl = []
|
||||||
for tmp_dl in tmp_str:
|
for tmp_dl in tmp_str:
|
||||||
|
#print(" ##### tmp_dl = "+str(tmp_dl))
|
||||||
if (len(str(tmp_dl)) > 0 and ("-" in tmp_dl)):
|
if (len(str(tmp_dl)) > 0 and ("-" in tmp_dl)):
|
||||||
# print(" ###### DATE LIEU = "+tmp_dl)
|
#print(" ###### DATE LIEU = "+str(tmp_dl))
|
||||||
tab_date_lieu = tmp_dl.split('-')
|
tab_date_lieu = tmp_dl.split('-')
|
||||||
if (len(tab_date_lieu) != 5):
|
if (len(tab_date_lieu) != 5):
|
||||||
return False, "Les Dates et Lieux de la formation " + str(
|
return False, "Les Dates et Lieux de la formation " + str(
|
||||||
|
@ -363,7 +366,7 @@ def add_class(diction):
|
||||||
diction['external_code']) + " sont incorrectes. Le format attendu : " \
|
diction['external_code']) + " sont incorrectes. Le format attendu : " \
|
||||||
"jj/mm/aaaa-jj/mm/aaaa-ville-code_postale-adresse;jj/mm/aaaa-jj/mm/aaaa-ville-code_postale-adresse 2"
|
"jj/mm/aaaa-jj/mm/aaaa-ville-code_postale-adresse;jj/mm/aaaa-jj/mm/aaaa-ville-code_postale-adresse 2"
|
||||||
|
|
||||||
print("### isdate = " + str(tab_date_lieu[0]) + " CM isdate_au = " + str(tab_date_lieu[1]))
|
#print("### isdate = " + str(tab_date_lieu[0]) + " CM isdate_au = " + str(tab_date_lieu[1]))
|
||||||
if (datetime.strptime(str(tab_date_lieu[0]), '%d/%m/%Y') >= datetime.strptime(
|
if (datetime.strptime(str(tab_date_lieu[0]), '%d/%m/%Y') >= datetime.strptime(
|
||||||
str(tab_date_lieu[1]), '%d/%m/%Y')):
|
str(tab_date_lieu[1]), '%d/%m/%Y')):
|
||||||
mycommon.myprint(
|
mycommon.myprint(
|
||||||
|
@ -395,10 +398,19 @@ def add_class(diction):
|
||||||
session_id = mycommon.remove_non_ascii(session_id)
|
session_id = mycommon.remove_non_ascii(session_id)
|
||||||
session_id = re.sub(r'[^a-zA-Z0-9]', '', session_id)
|
session_id = re.sub(r'[^a-zA-Z0-9]', '', session_id)
|
||||||
|
|
||||||
|
## Verifier si le CP n'est composé que de "0", au quel cas il s'agit d'une formation en ligne.
|
||||||
|
local_cp = str(tab_date_lieu[3]).replace("0", "").strip()
|
||||||
|
class_cp = ""
|
||||||
|
if (local_cp == ""):
|
||||||
|
class_cp = "0"
|
||||||
|
else:
|
||||||
|
class_cp = str(tab_date_lieu[3]).strip()
|
||||||
|
|
||||||
|
|
||||||
val_dl = {'date_du': str(tab_date_lieu[0]).strip(), 'date_au': str(tab_date_lieu[1]).strip(),
|
val_dl = {'date_du': str(tab_date_lieu[0]).strip(), 'date_au': str(tab_date_lieu[1]).strip(),
|
||||||
'ville': str(tab_date_lieu[2]).strip(), 'code_postal': str(tab_date_lieu[3]).strip(),
|
'ville': str(tab_date_lieu[2]).strip(), 'code_postal': str(class_cp).strip(),
|
||||||
'adresse': str(tab_date_lieu[4]).strip(), 'session_id': str(session_id).strip()}
|
'adresse': str(tab_date_lieu[4]).strip(), 'session_id': str(session_id).strip()}
|
||||||
tab_dl.append(val_dl)
|
|
||||||
|
|
||||||
tab_dl.append(val_dl)
|
tab_dl.append(val_dl)
|
||||||
# mydata['date_lieu'][dl_cpt] = {'date': str(tab_date_lieu[0]), 'ville': str(tab_date_lieu[1])}
|
# mydata['date_lieu'][dl_cpt] = {'date': str(tab_date_lieu[0]), 'ville': str(tab_date_lieu[1])}
|
||||||
|
@ -792,8 +804,16 @@ def update_class(diction):
|
||||||
session_id = mycommon.remove_non_ascii(session_id)
|
session_id = mycommon.remove_non_ascii(session_id)
|
||||||
session_id = re.sub(r'[^a-zA-Z0-9]', '', session_id)
|
session_id = re.sub(r'[^a-zA-Z0-9]', '', session_id)
|
||||||
|
|
||||||
|
## Verifier si le CP n'est composé que de "0", au quel cas il s'agit d'une formation en ligne.
|
||||||
|
local_cp = str(tab_date_lieu[3]).replace("0", "").strip()
|
||||||
|
class_cp = ""
|
||||||
|
if (local_cp == ""):
|
||||||
|
class_cp = "0"
|
||||||
|
else:
|
||||||
|
class_cp = str(tab_date_lieu[3]).strip()
|
||||||
|
|
||||||
val_dl = {'date_du': str(tab_date_lieu[0]).strip(), 'date_au': str(tab_date_lieu[1]).strip(),
|
val_dl = {'date_du': str(tab_date_lieu[0]).strip(), 'date_au': str(tab_date_lieu[1]).strip(),
|
||||||
'ville': str(tab_date_lieu[2]).strip(), 'code_postal': str(tab_date_lieu[3]).strip(),
|
'ville': str(tab_date_lieu[2]).strip(), 'code_postal': str(class_cp).strip(),
|
||||||
'adresse': str(tab_date_lieu[4]).strip(), 'session_id':str(session_id).strip()}
|
'adresse': str(tab_date_lieu[4]).strip(), 'session_id':str(session_id).strip()}
|
||||||
tab_dl.append(val_dl)
|
tab_dl.append(val_dl)
|
||||||
# mydata['date_lieu'][dl_cpt] = {'date': str(tab_date_lieu[0]), 'ville': str(tab_date_lieu[1])}
|
# mydata['date_lieu'][dl_cpt] = {'date': str(tab_date_lieu[0]), 'ville': str(tab_date_lieu[1])}
|
||||||
|
@ -1657,7 +1677,7 @@ def get_class(diction):
|
||||||
retVal['pedagogie'] = tmp_str[:MYSY_GV.MAX_CARACT_DETAIL] + " ..."
|
retVal['pedagogie'] = tmp_str[:MYSY_GV.MAX_CARACT_DETAIL] + " ..."
|
||||||
|
|
||||||
|
|
||||||
#mycommon.myprint(str(retVal))
|
#mycommon.myprint(" #### "+str(retVal))
|
||||||
user = retVal
|
user = retVal
|
||||||
RetObject.append(JSONEncoder().encode(user))
|
RetObject.append(JSONEncoder().encode(user))
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
,index,mots,occurence,moyenne,id_formation,source_field
|
,index,mots,occurence,moyenne,id_formation,source_field
|
||||||
0,0,effect,1,0.33,VP10619,title
|
0,0,financiere,1,0.33,POT_CL20001,title
|
||||||
1,1,effet,1,0.33,VP10619,title
|
1,1,entreprise,1,0.33,POT_CL20001,title
|
||||||
2,2,after,1,0.33,VP10619,title
|
2,2,analyse,1,0.33,POT_CL20001,title
|
||||||
|
|
|
|
@ -1,4 +1,4 @@
|
||||||
mots occurence moyenne id_formation source_field
|
mots occurence moyenne id_formation source_field
|
||||||
0 effect 1 0.33 VP10619 title
|
0 financiere 1 0.33 POT_CL20001 title
|
||||||
1 effet 1 0.33 VP10619 title
|
1 entreprise 1 0.33 POT_CL20001 title
|
||||||
2 after 1 0.33 VP10619 title
|
2 analyse 1 0.33 POT_CL20001 title
|
|
@ -350,7 +350,7 @@ def get_training_in_user_zone(diction):
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#print("AVANT ==> "+str(x['description']))
|
#print("AVANT 2 ==> "+str(x['description'])+" taille = "+str( len(x['description']) ))
|
||||||
val = x['description']
|
val = x['description']
|
||||||
if( len(x['description']) > MYSY_GV.MAX_CARACT ):
|
if( len(x['description']) > MYSY_GV.MAX_CARACT ):
|
||||||
x['description'] = val[:MYSY_GV.MAX_CARACT]+" ..."
|
x['description'] = val[:MYSY_GV.MAX_CARACT]+" ..."
|
||||||
|
|
Loading…
Reference in New Issue