22/09/2023 - 12h53

master
cherif 2023-09-22 12:53:41 +02:00
parent 4cf794fc2a
commit aa2f2d2cdf
7 changed files with 2457 additions and 64 deletions

View File

@ -3,41 +3,12 @@
<component name="ChangeListManager"> <component name="ChangeListManager">
<list default="true" id="c6d0259a-16e1-410d-91a1-830590ee2a08" name="Changes" comment="15/09/2023 - 18h"> <list default="true" id="c6d0259a-16e1-410d-91a1-830590ee2a08" name="Changes" comment="15/09/2023 - 18h">
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" /> <change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
<change beforePath="$PROJECT_DIR$/Activite.py" beforeDir="false" afterPath="$PROJECT_DIR$/Activite.py" afterDir="false" /> <change beforePath="$PROJECT_DIR$/Ela_Spacy.py" beforeDir="false" afterPath="$PROJECT_DIR$/Ela_Spacy.py" afterDir="false" />
<change beforePath="$PROJECT_DIR$/Attestation_Certificat.py" beforeDir="false" afterPath="$PROJECT_DIR$/Attestation_Certificat.py" afterDir="false" />
<change beforePath="$PROJECT_DIR$/Contact.py" beforeDir="false" afterPath="$PROJECT_DIR$/Contact.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$/Session_Formation.py" beforeDir="false" afterPath="$PROJECT_DIR$/Session_Formation.py" afterDir="false" /> <change beforePath="$PROJECT_DIR$/Session_Formation.py" beforeDir="false" afterPath="$PROJECT_DIR$/Session_Formation.py" afterDir="false" />
<change beforePath="$PROJECT_DIR$/abonnement_mgt.py" beforeDir="false" afterPath="$PROJECT_DIR$/abonnement_mgt.py" afterDir="false" />
<change beforePath="$PROJECT_DIR$/appel_offre.py" beforeDir="false" afterPath="$PROJECT_DIR$/appel_offre.py" afterDir="false" />
<change beforePath="$PROJECT_DIR$/articles_avis.py" beforeDir="false" afterPath="$PROJECT_DIR$/articles_avis.py" afterDir="false" />
<change beforePath="$PROJECT_DIR$/business_prices.py" beforeDir="false" afterPath="$PROJECT_DIR$/business_prices.py" afterDir="false" />
<change beforePath="$PROJECT_DIR$/chat_mgt.py" beforeDir="false" afterPath="$PROJECT_DIR$/chat_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$/class_mgt.py" beforeDir="false" afterPath="$PROJECT_DIR$/class_mgt.py" afterDir="false" />
<change beforePath="$PROJECT_DIR$/code_promo_mgt.py" beforeDir="false" afterPath="$PROJECT_DIR$/code_promo_mgt.py" 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_index_bdd_classes.py" beforeDir="false" afterPath="$PROJECT_DIR$/ela_index_bdd_classes.py" afterDir="false" /> <change beforePath="$PROJECT_DIR$/ela_index_bdd_classes.py" beforeDir="false" afterPath="$PROJECT_DIR$/ela_index_bdd_classes.py" afterDir="false" />
<change beforePath="$PROJECT_DIR$/ela_user_account.py" beforeDir="false" afterPath="$PROJECT_DIR$/ela_user_account.py" 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$/emargement.py" beforeDir="false" afterPath="$PROJECT_DIR$/emargement.py" afterDir="false" />
<change beforePath="$PROJECT_DIR$/lms_chamilo/mysy_lms.py" beforeDir="false" afterPath="$PROJECT_DIR$/lms_chamilo/mysy_lms.py" afterDir="false" />
<change beforePath="$PROJECT_DIR$/main.py" beforeDir="false" afterPath="$PROJECT_DIR$/main.py" afterDir="false" />
<change beforePath="$PROJECT_DIR$/opco.py" beforeDir="false" afterPath="$PROJECT_DIR$/opco.py" afterDir="false" />
<change beforePath="$PROJECT_DIR$/partner_client.py" beforeDir="false" afterPath="$PROJECT_DIR$/partner_client.py" afterDir="false" />
<change beforePath="$PROJECT_DIR$/partner_document_mgt.py" beforeDir="false" afterPath="$PROJECT_DIR$/partner_document_mgt.py" afterDir="false" />
<change beforePath="$PROJECT_DIR$/partner_order.py" beforeDir="false" afterPath="$PROJECT_DIR$/partner_order.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" />
<change beforePath="$PROJECT_DIR$/product_service.py" beforeDir="false" afterPath="$PROJECT_DIR$/product_service.py" afterDir="false" />
<change beforePath="$PROJECT_DIR$/ressources_humaines.py" beforeDir="false" afterPath="$PROJECT_DIR$/ressources_humaines.py" afterDir="false" />
<change beforePath="$PROJECT_DIR$/ressources_materiels.py" beforeDir="false" afterPath="$PROJECT_DIR$/ressources_materiels.py" afterDir="false" />
<change beforePath="$PROJECT_DIR$/statistics.py" beforeDir="false" afterPath="$PROJECT_DIR$/statistics.py" afterDir="false" />
<change beforePath="$PROJECT_DIR$/strype_payement.py" beforeDir="false" afterPath="$PROJECT_DIR$/strype_payement.py" afterDir="false" />
<change beforePath="$PROJECT_DIR$/tools_cherif/tools_cherif.py" beforeDir="false" afterPath="$PROJECT_DIR$/tools_cherif/tools_cherif.py" afterDir="false" />
<change beforePath="$PROJECT_DIR$/user_message_mgt.py" beforeDir="false" afterPath="$PROJECT_DIR$/user_message_mgt.py" afterDir="false" />
<change beforePath="$PROJECT_DIR$/wrapper.py" beforeDir="false" afterPath="$PROJECT_DIR$/wrapper.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" />

View File

@ -425,9 +425,13 @@ IMPORTANT : Pour mutualiser le process entre l'indexation des tous les champs ou
ex : indexation du champ 'title' ou du champ 'objectif', je vais introduitre la notion de 'source_fied' ex : indexation du champ 'title' ou du champ 'objectif', je vais introduitre la notion de 'source_fied'
pour l'indexation title, 'source_fied' = 'title' pour l'indexation title, 'source_fied' = 'title'
pour l'indexation objectif, 'source_fied' = 'objectif' pour l'indexation objectif, 'source_fied' = 'objectif'
Update du 21/09/2023 :
Ajout dans la collection 'elaindex' du partner_owner_recid pour pouvoir identifier le dataareid plus tard si besoin.
''' '''
def ela_index_record_field(lines, class_id, source_field = ""): def ela_index_record_field(lines, class_id, source_field = "", partner_owner_recid=""):
try: try:
''' '''
@ -437,6 +441,17 @@ def ela_index_record_field(lines, class_id, source_field = ""):
coll_name = MYSY_GV.dbname['elaindex'] coll_name = MYSY_GV.dbname['elaindex']
coll_name_StopWord = MYSY_GV.dbname['mysystopwords'] coll_name_StopWord = MYSY_GV.dbname['mysystopwords']
"""
update du 21/09/2023
Verifier la validé du 'partner_owner_recid'. Il doit appartenir à un 'partnair_account' valide
"""
is_Valide_partner_owner_recid_count = MYSY_GV.dbname['partnair_account'].count_documents({'recid':str(partner_owner_recid), 'valide':'1', 'locked':'0'})
if( is_Valide_partner_owner_recid_count != 1 ):
mycommon.myprint(
" ela_index_record_field - INDEXATION IMPOSSIBLE. 'is_Valide_partner_owner_recid_count' est invalide ")
return False
# check default value of parameter : source_field # check default value of parameter : source_field
if len(str(source_field)) == 0 : if len(str(source_field)) == 0 :
source_field = 'default' source_field = 'default'
@ -499,7 +514,7 @@ def ela_index_record_field(lines, class_id, source_field = ""):
#tab_tokens4 = Ela_remove_ponct(tab_tokens4) #tab_tokens4 = Ela_remove_ponct(tab_tokens4)
# Enregistrement dans la base mongodb # Enregistrement dans la base mongodb
Ela_list_to_mongo(tab_tokens3_unicode,class_id, source_field) Ela_list_to_mongo(tab_tokens3_unicode,class_id, source_field, partner_owner_recid)
size_tab = len(tab_tokens4) size_tab = len(tab_tokens4)
#print("size_tab = " + str(size_tab)) #print("size_tab = " + str(size_tab))
@ -623,7 +638,7 @@ def Ela_ntlk(mysentence, traning_id):
return tab_tokens4.sort() return tab_tokens4.sort()
''' '''
def Ela_list_to_mongo(tab_tokens, traning_id, source_field): def Ela_list_to_mongo(tab_tokens, traning_id, source_field, partner_owner_recid):
try: try:
# clear / truncate elaindex # clear / truncate elaindex
#db.elaindex.remove({}) #db.elaindex.remove({})
@ -646,6 +661,7 @@ def Ela_list_to_mongo(tab_tokens, traning_id, source_field):
print("final_lists to record = "+str(final_lists)) print("final_lists to record = "+str(final_lists))
data = pd.DataFrame(final_lists, columns=('mots', "occurence", 'moyenne', 'id_formation', 'source_field')) data = pd.DataFrame(final_lists, columns=('mots', "occurence", 'moyenne', 'id_formation', 'source_field'))
data['partner_owner_recid'] = str(partner_owner_recid)
my_file.write(str(data)) my_file.write(str(data))
my_file.close() my_file.close()

View File

@ -1902,7 +1902,7 @@ def AddStagiairetoClass_mass(file=None, Folder=None, diction=None):
if( local_status is False ): if( local_status is False ):
mycommon.myprint( mycommon.myprint(
str(inspect.stack()[0][ 3]) + " Le champ 'prix' de ligne " + str( n) + " est incorrecte.") str(inspect.stack()[0][ 3]) + " Le champ 'prix' de ligne " + str( n) + " est incorrecte.")
return False, " Le champ prix de ligne " + str(n) + " est incorrecte. " return False, " Le champ prix de la ligne " + str(n) + " est incorrecte. "
mydata['price'] = local_price mydata['price'] = local_price
@ -2225,10 +2225,19 @@ def Controle_AddStagiairetoClass_mass(saved_file=None, Folder=None, diction=None
if (local_status is False): if (local_status is False):
mycommon.myprint( mycommon.myprint(
str(inspect.stack()[0][3]) + " Le champ 'prix' de ligne " + str(n) + " est incorrecte.") str(inspect.stack()[0][3]) + " Le champ 'prix' de ligne " + str(n) + " est incorrecte.")
return False, " Le champ prix de ligne " + str(n) + " est incorrecte. " return False, " Le champ prix de la ligne " + str(n) + " est incorrecte. "
mydata['price'] = local_price mydata['price'] = local_price
## Verifier que le stagiaire n'est pas deja inscrit à cette formation.
qry_count = {'email': str(mydata['email']), 'session_id': str(session_id), 'partner_owner_recid':str(partner_recid) }
qry_count_result = MYSY_GV.dbname['inscription'].count_documents(qry_count)
if( qry_count_result > 0 ):
mycommon.myprint(
str(inspect.stack()[0][3]) + " Ligne " + str(n) + " : L'adresse email "+str()+" est déjà inscrite à la session :"+str(code_session)+". ")
return False, " Ligne " + str(n) + " : L'adresse email "+str(mydata['email'])+" est déjà inscrite à la session de formation :"+str(code_session)+". "
return True, str(total_rows) + " participants lus dans le fichier excel" return True, str(total_rows) + " participants lus dans le fichier excel"
@ -2563,7 +2572,7 @@ def AddStagiairetoClass_mass_for_many_session(file=None, Folder=None, diction=No
if( local_status is False ): if( local_status is False ):
mycommon.myprint( mycommon.myprint(
str(inspect.stack()[0][ 3]) + " Le champ 'prix' de ligne " + str( n) + " est incorrecte.") str(inspect.stack()[0][ 3]) + " Le champ 'prix' de ligne " + str( n) + " est incorrecte.")
return False, " Le champ prix de ligne " + str(n) + " est incorrecte. " return False, " Le champ prix de la ligne " + str(n) + " est incorrecte. "
mydata['price'] = local_price mydata['price'] = local_price
@ -2852,7 +2861,7 @@ def Controle_AddStagiairetoClass_mass_for_many_session(saved_file=None, Folder=N
if( local_status is False ): if( local_status is False ):
mycommon.myprint( mycommon.myprint(
str(inspect.stack()[0][ 3]) + " Le champ 'prix' de ligne " + str( n) + " est incorrecte.") str(inspect.stack()[0][ 3]) + " Le champ 'prix' de ligne " + str( n) + " est incorrecte.")
return False, " Le champ prix de ligne " + str(n) + " est incorrecte. " return False, " Le champ prix de la ligne " + str(n) + " est incorrecte. "
mydata['price'] = local_price mydata['price'] = local_price

File diff suppressed because it is too large Load Diff

View File

@ -666,7 +666,7 @@ def GetAllValideSessionPartner_List(diction):
'localField': 'class_internal_url', 'localField': 'class_internal_url',
'foreignField':'internal_url', 'foreignField':'internal_url',
'pipeline': [{'$match': filt_class_partner_recid}, {'$project': {'title': 1, 'domaine': 1, 'pipeline': [{'$match': filt_class_partner_recid}, {'$project': {'title': 1, 'domaine': 1,
'duration': 1, 'duration_unit': 1}}], 'duration': 1, 'duration_unit': 1, 'external_code':1}}],
'as': 'myclass_collection' 'as': 'myclass_collection'
} }
} }
@ -714,6 +714,7 @@ def GetAllValideSessionPartner_List(diction):
val['title'] = retVal['myclass_collection'][0]['title'] val['title'] = retVal['myclass_collection'][0]['title']
val['domaine'] = retVal['myclass_collection'][0]['domaine'] val['domaine'] = retVal['myclass_collection'][0]['domaine']
val['class_external_code'] = retVal['myclass_collection'][0]['external_code']
if( str(retVal['myclass_collection'][0]['duration_unit']) == "heure"): if( str(retVal['myclass_collection'][0]['duration_unit']) == "heure"):
val['duration_concat'] = str(retVal['myclass_collection'][0]['duration'])+" h" val['duration_concat'] = str(retVal['myclass_collection'][0]['duration'])+" h"
@ -824,7 +825,7 @@ def GetAllValideSessionPartner_List_filter_like(diction):
'localField': 'class_internal_url', 'localField': 'class_internal_url',
'foreignField': 'internal_url', 'foreignField': 'internal_url',
'pipeline': [{'$match': { '$and' : [ filt_class_title, {'partner_owner_recid':str(my_partner['recid'])} ]} }, {'$project': {'title': 1, 'domaine':1, 'pipeline': [{'$match': { '$and' : [ filt_class_title, {'partner_owner_recid':str(my_partner['recid'])} ]} }, {'$project': {'title': 1, 'domaine':1,
'duration':1, 'duration_unit':1}}], 'duration':1, 'duration_unit':1, 'external_code':1}}],
'as': 'myclass_collection' 'as': 'myclass_collection'
} }
} }
@ -884,6 +885,7 @@ def GetAllValideSessionPartner_List_filter_like(diction):
val['title'] = retVal['myclass_collection'][0]['title'] val['title'] = retVal['myclass_collection'][0]['title']
val['domaine'] = retVal['myclass_collection'][0]['domaine'] val['domaine'] = retVal['myclass_collection'][0]['domaine']
val['class_external_code'] = retVal['myclass_collection'][0]['external_code']
if (str(retVal['myclass_collection'][0]['duration_unit']) == "heure"): if (str(retVal['myclass_collection'][0]['duration_unit']) == "heure"):
val['duration_concat'] = str(retVal['myclass_collection'][0]['duration']) + " h" val['duration_concat'] = str(retVal['myclass_collection'][0]['duration']) + " h"
@ -988,7 +990,7 @@ def GetAllValideSessionPartner_List_no_filter(diction):
'foreignField': 'internal_url', 'foreignField': 'internal_url',
'pipeline': [{'$match': {'partner_owner_recid': str(my_partner['recid'])} }, 'pipeline': [{'$match': {'partner_owner_recid': str(my_partner['recid'])} },
{'$project': {'title': 1, 'domaine': 1, {'$project': {'title': 1, 'domaine': 1,
'duration': 1, 'duration_unit': 1}}], 'duration': 1, 'duration_unit': 1, 'external_code':1}}],
'as': 'myclass_collection' 'as': 'myclass_collection'
} }
} }
@ -1048,6 +1050,7 @@ def GetAllValideSessionPartner_List_no_filter(diction):
val['title'] = retVal['myclass_collection'][0]['title'] val['title'] = retVal['myclass_collection'][0]['title']
val['domaine'] = retVal['myclass_collection'][0]['domaine'] val['domaine'] = retVal['myclass_collection'][0]['domaine']
val['class_external_code'] = retVal['myclass_collection'][0]['external_code']
if (str(retVal['myclass_collection'][0]['duration_unit']) == "heure"): if (str(retVal['myclass_collection'][0]['duration_unit']) == "heure"):
val['duration_concat'] = str(retVal['myclass_collection'][0]['duration']) + " h" val['duration_concat'] = str(retVal['myclass_collection'][0]['duration']) + " h"

View File

@ -499,12 +499,13 @@ def add_class(diction):
training_to_index_title = {} training_to_index_title = {}
training_to_index_title['internal_url'] = mydata['internal_url'] training_to_index_title['internal_url'] = mydata['internal_url']
training_to_index_title['reindex_all'] = '0' training_to_index_title['reindex_all'] = '0'
training_to_index_title['partner_owner_recid'] = str(user_recid)
eibdd.ela_index_given_classes_title(training_to_index_title) eibdd.ela_index_given_classes_title(training_to_index_title)
# Indexation Title des mots clées # Indexation Title des mots clées
if( local_mots_cle.strip() != ""): if( local_mots_cle.strip() != ""):
print(" ### DEBUT indexation mot clée", ) print(" ### DEBUT indexation mot clée", )
eibdd.ela_index_class_key_word(mydata['external_code'], "keyword") eibdd.ela_index_class_key_word(mydata['external_code'], "keyword", user_recid)
return True, "La formation a bien été ajoutée" return True, "La formation a bien été ajoutée"
@ -996,6 +997,7 @@ def update_class(diction):
training_to_index_title = {} training_to_index_title = {}
training_to_index_title['internal_url'] = ret_val['internal_url'] training_to_index_title['internal_url'] = ret_val['internal_url']
training_to_index_title['reindex'] = '1' training_to_index_title['reindex'] = '1'
training_to_index_title['partner_owner_recid'] = str(partner_recid)
eibdd.ela_index_given_classes_title(training_to_index_title) eibdd.ela_index_given_classes_title(training_to_index_title)
# Indexation Title des mots clées # Indexation Title des mots clées

View File

@ -16,7 +16,7 @@ Par defaut sont pris en compte :
- la description - la description
''' '''
def ela_index_class(external_code="", source_field = ""): def ela_index_class(external_code="", source_field = "", partner_owner_recid = ""):
try: try:
collection = MYSY_GV.dbname["myclass"] collection = MYSY_GV.dbname["myclass"]
@ -31,7 +31,7 @@ def ela_index_class(external_code="", source_field = ""):
chaine = doc["title"]+" - "+doc["description"] chaine = doc["title"]+" - "+doc["description"]
chaine = mycommon.cleanhtml(chaine) chaine = mycommon.cleanhtml(chaine)
#mycommon.myprint(" external_code = "+str(doc["external_code"])+" ==> "+str(chaine)) #mycommon.myprint(" external_code = "+str(doc["external_code"])+" ==> "+str(chaine))
retval = ls.ela_index_record_field(chaine, str(doc["external_code"]), source_field) retval = ls.ela_index_record_field(chaine, str(doc["external_code"]), source_field, partner_owner_recid)
''' '''
# Apres indexation, on met a jour la formation pour # Apres indexation, on met a jour la formation pour
@ -58,7 +58,7 @@ def ela_index_class(external_code="", source_field = ""):
chaine = doc["title"] chaine = doc["title"]
chaine = mycommon.cleanhtml(chaine) chaine = mycommon.cleanhtml(chaine)
# mycommon.myprint(" external_code = "+str(doc["external_code"])+" ==> "+str(chaine)) # mycommon.myprint(" external_code = "+str(doc["external_code"])+" ==> "+str(chaine))
retval = ls.ela_index_record_field(chaine, str(doc["external_code"]), source_field) retval = ls.ela_index_record_field(chaine, str(doc["external_code"]), source_field, partner_owner_recid)
''' '''
# Apres indexation, on met a jour la formation pour # Apres indexation, on met a jour la formation pour
@ -85,7 +85,7 @@ def ela_index_class(external_code="", source_field = ""):
chaine = doc["description"] chaine = doc["description"]
chaine = mycommon.cleanhtml(chaine) chaine = mycommon.cleanhtml(chaine)
# mycommon.myprint(" external_code = "+str(doc["external_code"])+" ==> "+str(chaine)) # mycommon.myprint(" external_code = "+str(doc["external_code"])+" ==> "+str(chaine))
retval = ls.ela_index_record_field(chaine, str(doc["external_code"]), source_field) retval = ls.ela_index_record_field(chaine, str(doc["external_code"]), source_field, partner_owner_recid)
''' '''
# Apres indexation, on met a jour la formation pour # Apres indexation, on met a jour la formation pour
@ -113,7 +113,7 @@ def ela_index_class(external_code="", source_field = ""):
chaine = doc["objectif"] chaine = doc["objectif"]
chaine = mycommon.cleanhtml(chaine) chaine = mycommon.cleanhtml(chaine)
# mycommon.myprint(" external_code = "+str(doc["external_code"])+" ==> "+str(chaine)) # mycommon.myprint(" external_code = "+str(doc["external_code"])+" ==> "+str(chaine))
retval = ls.ela_index_record_field(chaine, str(doc["external_code"]), source_field) retval = ls.ela_index_record_field(chaine, str(doc["external_code"]), source_field, partner_owner_recid)
''' '''
# Apres indexation, on met a jour la formation pour # Apres indexation, on met a jour la formation pour
@ -141,7 +141,7 @@ def ela_index_class(external_code="", source_field = ""):
chaine = doc["mots_cle"] chaine = doc["mots_cle"]
chaine = mycommon.cleanhtml(chaine) chaine = mycommon.cleanhtml(chaine)
# mycommon.myprint(" external_code = "+str(doc["external_code"])+" ==> "+str(chaine)) # mycommon.myprint(" external_code = "+str(doc["external_code"])+" ==> "+str(chaine))
retval = ls.ela_index_record_field(chaine, str(doc["external_code"]), source_field) retval = ls.ela_index_record_field(chaine, str(doc["external_code"]), source_field, partner_owner_recid)
''' '''
# Apres indexation, on met a jour la formation pour # Apres indexation, on met a jour la formation pour
@ -168,7 +168,7 @@ def ela_index_class(external_code="", source_field = ""):
chaine = doc["video_text"] chaine = doc["video_text"]
chaine = mycommon.cleanhtml(chaine) chaine = mycommon.cleanhtml(chaine)
# mycommon.myprint(" external_code = "+str(doc["external_code"])+" ==> "+str(chaine)) # mycommon.myprint(" external_code = "+str(doc["external_code"])+" ==> "+str(chaine))
retval = ls.ela_index_record_field(chaine, str(doc["external_code"]), source_field) retval = ls.ela_index_record_field(chaine, str(doc["external_code"]), source_field, partner_owner_recid)
''' '''
# Apres indexation, on met a jour la formation pour # Apres indexation, on met a jour la formation pour
@ -277,7 +277,7 @@ def ela_index_class_key_word(external_code="", source_field = ""):
La fonction "ela_index_all_classes" va aller chercher chaque cours dans la BDD La fonction "ela_index_all_classes" va aller chercher chaque cours dans la BDD
et créer les mots clées qui sont ensuite enregister dans la table "elaindex" et créer les mots clées qui sont ensuite enregister dans la table "elaindex"
''' '''
def ela_index_all_classes(): def ela_index_all_classes(partner_owner_recid):
# Making a Connection with MongoClient # Making a Connection with MongoClient
try: try:
# collection # collection
@ -305,7 +305,7 @@ def ela_index_all_classes():
if ("title" in doc.keys() and "description" in doc.keys() ): if ("title" in doc.keys() and "description" in doc.keys() ):
chaine = doc["title"]+" - "+doc["description"] chaine = doc["title"]+" - "+doc["description"]
mycommon.myprint(" external_code = "+str(doc["external_code"])+" ==> "+str(chaine)) mycommon.myprint(" external_code = "+str(doc["external_code"])+" ==> "+str(chaine))
retval = ela_index_class(str(doc["external_code"])) retval = ela_index_class(str(doc["external_code"]), partner_owner_recid)
print(" apres : ela_index_class retval = "+str(retval)) print(" apres : ela_index_class retval = "+str(retval))
if( retval is False): if( retval is False):
@ -330,7 +330,7 @@ Par defaut, seul 3 mots clés sont acceptés par formation.
les mots clés sont separés par des ";". les mots clés sont separés par des ";".
ex : mot1;mot2;mot3 ex : mot1;mot2;mot3
''' '''
def ela_index_all_classes_keywords(): def ela_index_all_classes_keywords(partner_owner_recid):
try: try:
collection = MYSY_GV.dbname["myclass"] collection = MYSY_GV.dbname["myclass"]
nb_class_indexed = 0 nb_class_indexed = 0
@ -338,7 +338,7 @@ def ela_index_all_classes_keywords():
if ("mots_cle" in doc.keys()): if ("mots_cle" in doc.keys()):
chaine = doc["mots_cle"] chaine = doc["mots_cle"]
mycommon.myprint(" external_code = " + str(doc["external_code"]) + " ==> " + str(chaine)) mycommon.myprint(" external_code = " + str(doc["external_code"]) + " ==> " + str(chaine))
retval = ela_index_class(str(doc["external_code"]), "keyword") retval = ela_index_class(str(doc["external_code"]), "keyword", partner_owner_recid)
print(" apres : ela_index_all_classes_title retval = " + str(retval)) print(" apres : ela_index_all_classes_title retval = " + str(retval))
if (retval is False): if (retval is False):
@ -435,7 +435,7 @@ def ela_index_given_classes_keywords(diction) :
if ("mots_cle" in doc.keys()): if ("mots_cle" in doc.keys()):
chaine = doc["mots_cle"] chaine = doc["mots_cle"]
mycommon.myprint(" external_code = " + str(doc["external_code"]) + " ==> " + str(chaine)) mycommon.myprint(" external_code = " + str(doc["external_code"]) + " ==> " + str(chaine))
retval = ela_index_class(str(doc["external_code"]), "keyword") retval = ela_index_class(str(doc["external_code"]), "keyword", partner_owner_recid)
print(" apres : ela_index_given_classes_keywords retval = " + str(retval)) print(" apres : ela_index_given_classes_keywords retval = " + str(retval))
if (retval is False): if (retval is False):
@ -461,7 +461,7 @@ def ela_index_given_classes_keywords(diction) :
La fonction "ela_index_all_classes_title" va aller chercher chaque cours dans la BDD La fonction "ela_index_all_classes_title" va aller chercher chaque cours dans la BDD
et créer les mots clées des title qui sont ensuite enregister dans la table "elaindex" et créer les mots clées des title qui sont ensuite enregister dans la table "elaindex"
''' '''
def ela_index_all_classes_title(): def ela_index_all_classes_title(partner_owner_recid):
# Making a Connection with MongoClient # Making a Connection with MongoClient
try: try:
@ -489,7 +489,7 @@ def ela_index_all_classes_title():
if ("title" in doc.keys()): if ("title" in doc.keys()):
chaine = doc["title"] chaine = doc["title"]
mycommon.myprint(" external_code = " + str(doc["external_code"]) + " ==> " + str(chaine)) mycommon.myprint(" external_code = " + str(doc["external_code"]) + " ==> " + str(chaine))
retval = ela_index_class(str(doc["external_code"]), "title") retval = ela_index_class(str(doc["external_code"]), "title", partner_owner_recid)
print(" apres : ela_index_all_classes_title retval = " + str(retval)) print(" apres : ela_index_all_classes_title retval = " + str(retval))
if (retval is False): if (retval is False):
@ -586,7 +586,7 @@ def ela_index_given_classes_title(diction) :
if ("title" in doc.keys()): if ("title" in doc.keys()):
chaine = doc["title"] chaine = doc["title"]
mycommon.myprint(" external_code = " + str(doc["external_code"]) + " ==> " + str(chaine)) mycommon.myprint(" external_code = " + str(doc["external_code"]) + " ==> " + str(chaine))
retval = ela_index_class(str(doc["external_code"]), "title") retval = ela_index_class(str(doc["external_code"]), "title", partner_owner_recid)
print(" apres : ela_index_given_classes_title retval = " + str(retval)) print(" apres : ela_index_given_classes_title retval = " + str(retval))
if (retval is False): if (retval is False):
@ -612,7 +612,7 @@ La fonction "ela_index_all_classes_desc" va aller chercher chaque cours dans la
et créer les mots clées des "description" qui sont ensuite enregister dans la table "elaindex" et créer les mots clées des "description" qui sont ensuite enregister dans la table "elaindex"
''' '''
def ela_index_all_classes_desc(): def ela_index_all_classes_desc(partner_owner_recid):
# Making a Connection with MongoClient # Making a Connection with MongoClient
try: try:
client = MongoClient("mongodb://localhost:27017/") client = MongoClient("mongodb://localhost:27017/")
@ -643,7 +643,7 @@ def ela_index_all_classes_desc():
if ("description" in doc.keys()): if ("description" in doc.keys()):
chaine = doc["description"] chaine = doc["description"]
mycommon.myprint(" external_code = " + str(doc["external_code"]) + " ==> " + str(chaine)) mycommon.myprint(" external_code = " + str(doc["external_code"]) + " ==> " + str(chaine))
retval = ela_index_class(str(doc["external_code"]), "description") retval = ela_index_class(str(doc["external_code"]), "description", partner_owner_recid)
print(" apres : ela_index_all_classes_title retval = " + str(retval)) print(" apres : ela_index_all_classes_title retval = " + str(retval))
if (retval is False): if (retval is False):
@ -667,7 +667,7 @@ La fonction "ela_index_all_classes_desc" va aller chercher chaque cours dans la
et créer les mots clées des "objectif" qui sont ensuite enregister dans la table "elaindex" et créer les mots clées des "objectif" qui sont ensuite enregister dans la table "elaindex"
''' '''
def ela_index_all_classes_obj(): def ela_index_all_classes_obj(partner_owner_recid):
# Making a Connection with MongoClient # Making a Connection with MongoClient
try: try:
# collection # collection
@ -695,7 +695,7 @@ def ela_index_all_classes_obj():
if ("objectif" in doc.keys()): if ("objectif" in doc.keys()):
chaine = doc["objectif"] chaine = doc["objectif"]
mycommon.myprint(" external_code = " + str(doc["external_code"]) + " ==> " + str(chaine)) mycommon.myprint(" external_code = " + str(doc["external_code"]) + " ==> " + str(chaine))
retval = ela_index_class(str(doc["external_code"]), "objectif") retval = ela_index_class(str(doc["external_code"]), "objectif", partner_owner_recid)
print(" apres : ela_index_all_classes_title retval = " + str(retval)) print(" apres : ela_index_all_classes_title retval = " + str(retval))
if (retval is False): if (retval is False):
@ -718,7 +718,7 @@ def ela_index_all_classes_obj():
Cette fonction lire la transcription d'une video et Cette fonction lire la transcription d'une video et
l'indexer''' l'indexer'''
def ela_index_all_classes_video_text(): def ela_index_all_classes_video_text(partner_owner_recid):
# Making a Connection with MongoClient # Making a Connection with MongoClient
try: try:
# collection # collection
@ -746,7 +746,7 @@ def ela_index_all_classes_video_text():
if ("video_text" in doc.keys()): if ("video_text" in doc.keys()):
chaine = doc["video_text"] chaine = doc["video_text"]
#mycommon.myprint(" video_texte = " + str(doc["external_code"]) + " ==> " + str(chaine)) #mycommon.myprint(" video_texte = " + str(doc["external_code"]) + " ==> " + str(chaine))
retval = ela_index_class(str(doc["external_code"]), "video_text") retval = ela_index_class(str(doc["external_code"]), "video_text", partner_owner_recid)
#print(" apres : ela_index_all_classes_video_texte retval = " + str(retval)) #print(" apres : ela_index_all_classes_video_texte retval = " + str(retval))
if (retval is False): if (retval is False):
@ -1027,7 +1027,7 @@ Cette fonction indexe les articles et avis.
important : se ra indexé que le titre de la formation. important : se ra indexé que le titre de la formation.
apres avoir été indexés la champs "indexed" passe à 1 apres avoir été indexés la champs "indexed" passe à 1
''' '''
def ela_index_all_articles_avis(): def ela_index_all_articles_avis(partner_owner_recid):
# Making a Connection with MongoClient # Making a Connection with MongoClient
try: try:
# collection # collection
@ -1038,7 +1038,7 @@ def ela_index_all_articles_avis():
chaine = doc["title_formation"] chaine = doc["title_formation"]
mycommon.myprint(" Debut indexation de l'article : "+chaine) mycommon.myprint(" Debut indexation de l'article : "+chaine)
retval = ela_index_articles_avis(str(doc["title_formation"])) retval = ela_index_articles_avis(str(doc["title_formation"]))
print(" apres : ela_index_class retval = " + str(retval)) print(" apres : ela_index_class retval = " + str(retval), partner_owner_recid)
if (retval is False): if (retval is False):
mycommon.myprint("IMPOSSIBLE d'indexer la formation = " + str(doc["external_code"])) mycommon.myprint("IMPOSSIBLE d'indexer la formation = " + str(doc["external_code"]))