09/02/23 - 17h

master
cherif 2023-02-09 17:00:38 +01:00
parent 92170635f1
commit c2644dfde7
9 changed files with 2006 additions and 19 deletions

View File

@ -1,16 +1,16 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ChangeListManager">
<list default="true" id="1122d9e2-679f-46d6-8c4f-97e9ae4041b5" name="Changes" comment="05/02/23 - 20h">
<list default="true" id="1122d9e2-679f-46d6-8c4f-97e9ae4041b5" name="Changes" comment="09/02/23 - 11h">
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
<change beforePath="$PROJECT_DIR$/Emargement/fichier_presence.pdf" beforeDir="false" afterPath="$PROJECT_DIR$/Emargement/fichier_presence.pdf" 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$/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$/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$/tools_cherif/tools_cherif.py" beforeDir="false" afterPath="$PROJECT_DIR$/tools_cherif/tools_cherif.py" afterDir="false" />
<change beforePath="$PROJECT_DIR$/partners.py" beforeDir="false" afterPath="$PROJECT_DIR$/partners.py" afterDir="false" />
</list>
<option name="SHOW_DIALOG" value="false" />
<option name="HIGHLIGHT_CONFLICTS" value="true" />
@ -279,7 +279,14 @@
<option name="project" value="LOCAL" />
<updated>1675623091527</updated>
</task>
<option name="localTasksCounter" value="30" />
<task id="LOCAL-00030" summary="09/02/23 - 11h">
<created>1675938338905</created>
<option name="number" value="00030" />
<option name="presentableId" value="LOCAL-00030" />
<option name="project" value="LOCAL" />
<updated>1675938338905</updated>
</task>
<option name="localTasksCounter" value="31" />
<servers />
</component>
<component name="Vcs.Log.Tabs.Properties">
@ -294,7 +301,6 @@
</option>
</component>
<component name="VcsManagerConfiguration">
<MESSAGE value="22/11/22 - 22h30" />
<MESSAGE value="23/11/22 - 22h30" />
<MESSAGE value="26/11/22 - 10h30" />
<MESSAGE value="26/11/22 - 23h30" />
@ -319,7 +325,8 @@
<MESSAGE value="30/01/23 - 22h" />
<MESSAGE value="01/02/23 - 22h" />
<MESSAGE value="05/02/23 - 20h" />
<option name="LAST_COMMIT_MESSAGE" value="05/02/23 - 20h" />
<MESSAGE value="09/02/23 - 11h" />
<option name="LAST_COMMIT_MESSAGE" value="09/02/23 - 11h" />
</component>
<component name="XDebuggerManager">
<breakpoint-manager>

View File

@ -25,6 +25,7 @@ from xhtml2pdf import pisa
import jinja2
import ftplib
import pysftp
import email_mgt as email_mgt
"""
Enregistrement d'un stagiaire
@ -1443,6 +1444,9 @@ def Evaluation_Class(diction):
mycommon.myprint(str(inspect.stack()[0][3]) + " Impossible d'enregistrer l'evaluation ")
return False, " Impossible d'enregistrer l'evaluation "
# Declencer l'envoi de la notification de l'evaluation
email_mgt.EmailNotifEvaluation_Done()
return True, " L'evaluation a bien été enregistrée"
except Exception as e:

File diff suppressed because it is too large Load Diff

View File

@ -1854,14 +1854,31 @@ def get_class(diction):
" d'une recherche de formation. Voir _id = ")
return False, "Impossible de faire un affichage detaillé "
# Cette varible compte le nombre de certificat dont dispose le partenaire.
# Cette information est utilisée pour savoir les taille à afficher sur le front
nb_partner_certificat = 0
if( "isdatadock" in tmp_partenaire_data.keys() and tmp_partenaire_data['isdatadock']):
retVal['isdatadock'] = tmp_partenaire_data['isdatadock']
if (tmp_partenaire_data['isdatadock'] == "1"):
nb_partner_certificat = nb_partner_certificat + 1
if ("isqualiopi" in tmp_partenaire_data.keys() and tmp_partenaire_data['isqualiopi']):
retVal['isqualiopi'] = tmp_partenaire_data['isqualiopi']
if (tmp_partenaire_data['isqualiopi'] == "1"):
nb_partner_certificat = nb_partner_certificat + 1
if ("iscertitrace" in tmp_partenaire_data.keys() and tmp_partenaire_data['iscertitrace']):
retVal['iscertitrace'] = tmp_partenaire_data['iscertitrace']
if( tmp_partenaire_data['iscertitrace'] == "1"):
nb_partner_certificat = nb_partner_certificat + 1
if ("isbureaucertitrace" in tmp_partenaire_data.keys() and tmp_partenaire_data['isbureaucertitrace']):
retVal['isbureaucertitrace'] = tmp_partenaire_data['isbureaucertitrace']
if (tmp_partenaire_data['isbureaucertitrace'] == "1"):
nb_partner_certificat = nb_partner_certificat + 1
retVal['nb_partner_certificat'] = str(nb_partner_certificat)
if ("nom" in tmp_partenaire_data.keys() and tmp_partenaire_data['nom']):
retVal['nom_partenaire'] = tmp_partenaire_data['nom']
@ -1870,11 +1887,13 @@ def get_class(diction):
retVal['website_partenaire'] = tmp_partenaire_data['website']
if ("description" in retVal.keys()):
tmp_str = retVal['description']
no_html = mycommon.cleanhtml(retVal['description'])
nb_pave_a_afficher = nb_pave_a_afficher + 1
print(" ### nb_pave_a_afficher , DESCRI ")
text_size = text_size + len(str(no_html))
if (len(retVal['description']) > MYSY_GV.MAX_CARACT_DETAIL):
@ -1886,7 +1905,7 @@ def get_class(diction):
no_html = mycommon.cleanhtml(retVal['objectif'])
text_size = text_size + len(str(no_html))
nb_pave_a_afficher = nb_pave_a_afficher + 1
print(" ### nb_pave_a_afficher , OBJECTIF ")
if (len(retVal['objectif']) > MYSY_GV.MAX_CARACT_DETAIL):
@ -1895,7 +1914,7 @@ def get_class(diction):
if ("pourqui" in retVal.keys() and retVal['pourqui']):
nb_pave_a_afficher = nb_pave_a_afficher + 1
print(" ### nb_pave_a_afficher , POURQUI ")
if ("programme" in retVal.keys()):
@ -1903,7 +1922,7 @@ def get_class(diction):
no_html = mycommon.cleanhtml( retVal['programme'])
text_size = text_size + len(str(no_html))
nb_pave_a_afficher = nb_pave_a_afficher + 1
print(" ### nb_pave_a_afficher , PROGRAMME ")
if (len(retVal['programme']) > MYSY_GV.MAX_CARACT_DETAIL):
retVal['programme'] = tmp_str[:MYSY_GV.MAX_CARACT_DETAIL] + " ..."
@ -1932,7 +1951,7 @@ def get_class(diction):
retVal["nb_pave_a_afficher"] = str(nb_pave_a_afficher)
print(" #### Pour la formation :",internal_url, " text_size = ", str(text_size))
#print(" #### Pour la formation :",internal_url, " text_size = ", str(text_size))
#mycommon.myprint(" #### "+str(retVal))
user = retVal
RetObject.append(JSONEncoder().encode(user))

View File

@ -1,5 +1,4 @@
,index,mots,occurence,moyenne,id_formation,source_field
0,0,electrique,1,0.17,MYSY_0001,title
1,1,b,2,0.33,MYSY_0001,title
2,2,v,2,0.33,MYSY_0001,title
3,3,habilitation,1,0.17,MYSY_0001,title
0,0,aromatherapie,1,0.33,MYSY_0004,title
1,1,integrative,1,0.33,MYSY_0004,title
2,2,praticien,1,0.33,MYSY_0004,title

1 index mots occurence moyenne id_formation source_field
2 0 0 electrique aromatherapie 1 0.17 0.33 MYSY_0001 MYSY_0004 title
3 1 1 b integrative 2 1 0.33 MYSY_0001 MYSY_0004 title
4 2 2 v praticien 2 1 0.33 MYSY_0001 MYSY_0004 title
3 3 habilitation 1 0.17 MYSY_0001 title

View File

@ -1,3 +1,4 @@
Empty DataFrame
Columns: [mots, occurence, moyenne, id_formation, source_field]
Index: []
mots occurence moyenne id_formation source_field
0 aromatherapie 1 0.33 MYSY_0004 title
1 integrative 1 0.33 MYSY_0004 title
2 praticien 1 0.33 MYSY_0004 title

View File

@ -1992,3 +1992,67 @@ def EmailStopAbonnement( partners_email, partners_pack_service, partners_date_ar
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'envoyer l'email de notification "
"""
Cette fonction envoie la notification d'evaluation à un institut de formation
"""
def EmailNotifEvaluation_Done():
try:
tomorrow = datetime.date.today() + datetime.timedelta(days=1)
tomorrow_day = tomorrow.strftime("%A")
smtpserver = smtplib.SMTP(MYSY_GV.O365_SMTP_COUNT_smtpsrv, MYSY_GV.O365_SMTP_COUNT_port)
# msg = MIMEMultipart("alternative")
msg = EmailMessage()
# JINJA2
templateLoader = jinja2.FileSystemLoader(searchpath="./")
templateEnv = jinja2.Environment(loader=templateLoader)
TEMPLATE_FILE = "Template/MySy_Evaluation_Class_done_Notif_tpl.html"
template = templateEnv.get_template(TEMPLATE_FILE)
# This data can come from database query
body = {
"params":{"partenaire_name": "Mysy",
"prenom": "sekou",
"nom": "balde",
"date_du": "10/01/22",
"date_fin": "12/01/22",
"eval_note":"5",
"eval_pedagogie": "6",
"eval_eval": "topppp cool",
"eval_date": "09/02/23",
"aaa": 3,
"aab": "3",
},
}
sourceHtml = template.render(params=body["params"])
msg.set_content(sourceHtml, subtype='html')
msg['From'] = MYSY_GV.O365_SMTP_COUNT_From_User
msg['Bcc'] = 'contact@mysy-training.com'
msg['Subject'] = "[MySy Training Technology] : Evaluation de votre formation "
msg['To'] = "billardman1@gmail.com"
smtpserver.ehlo()
smtpserver.starttls()
smtpserver.login(MYSY_GV.O365_SMTP_COUNT_user, MYSY_GV.O365_SMTP_COUNT_password)
val = smtpserver.send_message(msg)
smtpserver.close()
print(" Email envoyé " + str(val))
return True, "ok"
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'envoyer l'email de notification "

12
main.py
View File

@ -2375,6 +2375,18 @@ def SendAttestion_to_attendee_by_email_standalone():
return jsonify(status=localStatus, message=message )
"""
API de test pour envoyer la notif d'evaluation
"""
@app.route('/myclass/api/EmailNotifEvaluation_Done/', methods=['POST','GET'])
@crossdomain(origin='*')
def EmailNotifEvaluation_Done():
# On recupere le corps (payload) de la requete
payload = request.form.to_dict()
print(" ### EmailNotifEvaluation_Done : payload = ",payload)
localStatus, message = emails.EmailNotifEvaluation_Done()
return jsonify(status=localStatus, message=message )

View File

@ -519,7 +519,7 @@ def update_partner_account(diction):
'contact_mail', 'token', 'link_facebook', 'link_twitter', 'invoice_vat_num',
'invoice_nom', 'invoice_adr_street', 'invoice_adr_city', 'invoice_adr_zip',
'invoice_adr_country', 'invoice_email', 'invoice_telephone', 'invoice_vat_num',
'siren', 'num_nda', 'iscertitrace', 'isdatadock', 'isqualiopi', 'website']
'siren', 'num_nda', 'iscertitrace', 'isdatadock', 'isqualiopi', 'website', 'isbureaucertitrace']
incom_keys = diction.keys()
@ -585,6 +585,9 @@ def update_partner_account(diction):
if ("iscertitrace" in diction.keys()):
mydata['iscertitrace'] = diction['iscertitrace']
if ("isbureaucertitrace" in diction.keys()):
mydata['isbureaucertitrace'] = diction['isbureaucertitrace']
if ("isdatadock" in diction.keys()):
mydata['isdatadock'] = diction['isdatadock']