07/12/2023 - 21h30

master
cherif 2023-12-07 21:14:46 +01:00
parent 3ce34be67e
commit fadc95f768
10 changed files with 1318 additions and 49 deletions

View File

@ -1,13 +1,16 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ChangeListManager">
<list default="true" id="c6d0259a-16e1-410d-91a1-830590ee2a08" name="Changes" comment="06/12/2023 - 21h">
<change afterPath="$PROJECT_DIR$/Collection_Historique.py" afterDir="false" />
<list default="true" id="c6d0259a-16e1-410d-91a1-830590ee2a08" name="Changes" comment="07/12/2023 - 11h30">
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
<change beforePath="$PROJECT_DIR$/Collection_Historique.py" beforeDir="false" afterPath="$PROJECT_DIR$/Collection_Historique.py" afterDir="false" />
<change beforePath="$PROJECT_DIR$/Dashbord_queries/session_tbd_qries.py" beforeDir="false" afterPath="$PROJECT_DIR$/Dashbord_queries/session_tbd_qries.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$/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$/agenda.py" beforeDir="false" afterPath="$PROJECT_DIR$/agenda.py" afterDir="false" />
<change beforePath="$PROJECT_DIR$/main.py" beforeDir="false" afterPath="$PROJECT_DIR$/main.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$/prj_common.py" beforeDir="false" afterPath="$PROJECT_DIR$/prj_common.py" afterDir="false" />
</list>
<option name="SHOW_DIALOG" value="false" />
@ -78,13 +81,6 @@
<option name="presentableId" value="Default" />
<updated>1680804787304</updated>
</task>
<task id="LOCAL-00115" summary="28/09/23 - 23h">
<created>1695932550732</created>
<option name="number" value="00115" />
<option name="presentableId" value="LOCAL-00115" />
<option name="project" value="LOCAL" />
<updated>1695932550733</updated>
</task>
<task id="LOCAL-00116" summary="30/09/2023 - 14h">
<created>1696076203877</created>
<option name="number" value="00116" />
@ -421,7 +417,14 @@
<option name="project" value="LOCAL" />
<updated>1701892535756</updated>
</task>
<option name="localTasksCounter" value="164" />
<task id="LOCAL-00164" summary="07/12/2023 - 11h30">
<created>1701945586589</created>
<option name="number" value="00164" />
<option name="presentableId" value="LOCAL-00164" />
<option name="project" value="LOCAL" />
<updated>1701945586589</updated>
</task>
<option name="localTasksCounter" value="165" />
<servers />
</component>
<component name="Vcs.Log.Tabs.Properties">
@ -436,7 +439,6 @@
</option>
</component>
<component name="VcsManagerConfiguration">
<MESSAGE value="30/10/23 - 16h" />
<MESSAGE value="08/11/2023 - 23h" />
<MESSAGE value="09/11/2023 - 23h" />
<MESSAGE value="sdds" />
@ -461,6 +463,7 @@
<MESSAGE value="04/12/2023 - 21h" />
<MESSAGE value="05/12/2023 - 21h" />
<MESSAGE value="06/12/2023 - 21h" />
<option name="LAST_COMMIT_MESSAGE" value="06/12/2023 - 21h" />
<MESSAGE value="07/12/2023 - 11h30" />
<option name="LAST_COMMIT_MESSAGE" value="07/12/2023 - 11h30" />
</component>
</project>

View File

@ -209,7 +209,7 @@ def Get_Action_Historique_List(diction):
RetObject = []
val_tmp = 1
for New_retVal in MYSY_GV.dbname['historique_action'].find({'related_collection':str(diction['related_collection']), 'related_collection_recid':str(diction['related_collection_recid']),
'partner_owner_recid':str(my_partner['recid']), 'valide':'1', 'locked':'0'}).sort([("_id", pymongo.DESCENDING)]):
'partner_owner_recid':str(my_partner['recid']), 'valide':'1', 'locked':'0'}).limit(MYSY_GV.HISTORIQUE_MAX_EVENT).sort([("_id", pymongo.DESCENDING)]):
user = New_retVal
user['id'] = str(val_tmp)

View File

@ -517,7 +517,7 @@ def Get_Qery_Session_Repartition_Session_By_Trainer_By_Periode(diction):
{'$project': {'_id': 0}}
])
#print(" ### pipe_qry_nb_record = ", pipe_qry_nb_record)
print(" ### pipe_qry_nb_record = ", pipe_qry_nb_record)
nb_total_session = 0
Nb_Record_RetObject = []
for retval in MYSY_GV.dbname['session_formation'].aggregate(pipe_qry_nb_record):

View File

@ -551,4 +551,10 @@ Gestion des type d'evenement accepté dans un egend
- planning
- etc
"""
AGENDA_EVENT_TYPE = ['absence', 'planning', 'autre', '']
AGENDA_EVENT_TYPE = ['absence', 'planning', 'autre', '']
"""
Limite pour l'affichage des historique d'action coté front.
Par exemple on va afficher les 100 dernières action, mais pas tout.
"""
HISTORIQUE_MAX_EVENT = 100

View File

@ -350,6 +350,20 @@ def AddStagiairetoClass(diction):
str(inspect.stack()[0][3]) + " - ret_val.inserted_id is null ")
return False, "Impossible de créer le stagiaire"
"""
# Ajout de l'evenement dans l'historique
"""
now = str(datetime.now().strftime("%d/%m/%Y %H:%M:%S"))
history_event_dict = {}
history_event_dict['token'] = diction['token']
history_event_dict['related_collection'] = "inscription"
history_event_dict['related_collection_recid'] = str(inserted_id)
history_event_dict['action_date'] = str(now)
history_event_dict['action_description'] = "Creation "
local_status, local_retval = mycommon.Collection_Historique.Add_Historique_Event(history_event_dict)
if (local_status is False):
mycommon.myprint(
" WARNING : Impossible de logguer l'historique pour l'évènement : " + str(history_event_dict))
return True, " Le stagiaire à bien été créé. "+str(Warning_message)
@ -657,7 +671,8 @@ def UpdateStagiairetoClass(diction):
#print(" #### query_key = ", query_key)
local_retval = coll_inscription.find_one(query_key)
message_for_historic = ""
if( local_retval is not None ):
if( "status" in local_retval.keys()):
@ -670,12 +685,15 @@ def UpdateStagiairetoClass(diction):
# Il y a eu un changement de status
if( new_status == "1"):
mydata['inscription_validation_date'] = str(datetime.now().strftime("%d/%m/%Y %H:%M:%S"))
message_for_historic = "Validation Inscription"
if (new_status == "-1"):
mydata['inscription_refuse_date'] = str(datetime.now().strftime("%d/%m/%Y %H:%M:%S"))
message_for_historic = "Refus Inscription"
if (new_status == "2"):
mydata['inscription_preinscription_date'] = str(datetime.now().strftime("%d/%m/%Y %H:%M:%S"))
message_for_historic = "Préinscription "
mydata['date_update'] = str(datetime.now())
mydata['update_by'] = str(my_partner['_id'])
@ -770,12 +788,14 @@ def UpdateStagiairetoClass(diction):
inspect.stack()[0][3]) + " - l'adresse email " + str(
mydata['email']) + " pour la session " + str(mydata['session_id']) + " "
message_for_historic = message_for_historic + " : Email Préinscription "
if (new_status != old_status and diction['status'] == "1" ):
# Il s'agit d'envoyer le message de confirmation d'une inscription
email_data['partner_owner_recid'] = str(partner_recid)
local_status, local_message = email_session.incription_training_confirmation_mail(email_data)
message_for_historic = message_for_historic + " : Email Inscription "
""""
Inscription sur le LMS :
@ -850,6 +870,7 @@ def UpdateStagiairetoClass(diction):
elif ( new_status != old_status and diction['status'] == "-1" ):
# Il s'agit d'envoyer le message de refus d'une inscription
local_status, local_message = email_session.incription_training_refused_mail(email_data)
message_for_historic = message_for_historic + " : Email Refus Inscription "
@ -857,6 +878,21 @@ def UpdateStagiairetoClass(diction):
if( len(str(return_message)) > 5):
return True, "Les données du stagiaire ont été correctement mise à jour. WARNING : "+return_message
"""
# Ajout de l'evenement dans l'historique
"""
now = str(datetime.now().strftime("%d/%m/%Y %H:%M:%S"))
history_event_dict = {}
history_event_dict['token'] = diction['token']
history_event_dict['related_collection'] = "inscription"
history_event_dict['related_collection_recid'] = str(diction['_id'])
history_event_dict['action_date'] = str(now)
history_event_dict['action_description'] = str(message_for_historic)
local_status, local_retval = mycommon.Collection_Historique.Add_Historique_Event(history_event_dict)
if (local_status is False):
mycommon.myprint(
" WARNING : Impossible de logguer l'historique pour l'évènement : " + str(history_event_dict))
return True, "Les données du stagiaire ont été correctement mise à jour"
@ -3480,6 +3516,22 @@ def Evaluation_Class(diction):
# Declencer l'envoi de la notification de l'evaluation
email_mgt.EmailNotifEvaluation_Done(diction)
"""
# Ajout de l'evenement dans l'historique
"""
now = str(datetime.now().strftime("%d/%m/%Y %H:%M:%S"))
history_event_dict = {}
history_event_dict['token'] = diction['token']
history_event_dict['related_collection'] = "inscription"
history_event_dict['related_collection_recid'] = str(diction['inscription_id'])
history_event_dict['action_date'] = str(now)
history_event_dict['action_description'] = " Evaluation Formation "
local_status, local_retval = mycommon.Collection_Historique.Add_Historique_Event(history_event_dict)
if (local_status is False):
mycommon.myprint(
" WARNING : Impossible de logguer l'historique pour l'évènement : " + str(history_event_dict))
return True, " L'evaluation a bien été enregistrée"
except Exception as e:
@ -3693,6 +3745,21 @@ def SendTrainingEvaluationEmail(diction):
# Envoi de l'email de notification au formateur
local_status, local_message = email_session.Evaluation_training_confirmation_mail(my_retrun_dict)
"""
# Ajout de l'evenement dans l'historique
"""
now = str(datetime.now().strftime("%d/%m/%Y %H:%M:%S"))
history_event_dict = {}
history_event_dict['token'] = diction['token']
history_event_dict['related_collection'] = "inscription"
history_event_dict['related_collection_recid'] = str(local_Insc_retval['_id'])
history_event_dict['action_date'] = str(now)
history_event_dict['action_description'] = " Demande Evaluation Formation "
local_status, local_retval = mycommon.Collection_Historique.Add_Historique_Event(history_event_dict)
if (local_status is False):
mycommon.myprint(
" WARNING : Impossible de logguer l'historique pour l'évènement : " + str(history_event_dict))
return local_status, str(local_message)
except Exception as e:
@ -6104,6 +6171,9 @@ def Sent_Convention_Stagiaire_By_Email(tab_files, Folder, diction):
- l'adresse email du stagiaire et ses tuteurs (si les tuteurs on cochés la case 'inclu com'
"""
send_in_production = 0
tab_emails_destinataire = []
if( "email_test" in diction.keys() and diction['email_test']):
tab_email_test = str(diction['email_test']).replace(";",",").split(",")
@ -6117,7 +6187,7 @@ def Sent_Convention_Stagiaire_By_Email(tab_files, Folder, diction):
tab_emails_destinataire = tab_email_test
elif ( "email_production" in diction.keys() and diction['email_production']):
send_in_production = 1
if( str(diction['email_production']) != "default") :
tab_email_prod = str(diction['email_production']).replace(";", ",").split(",")
for email in tab_email_prod:
@ -6198,9 +6268,6 @@ def Sent_Convention_Stagiaire_By_Email(tab_files, Folder, diction):
tab_files_to_attache_to_mail.append(new_node)
#Recuperations des info de la session de formation
session_data = MYSY_GV.dbname['session_formation'].find_one({'_id': ObjectId(str(inscription_data['session_id'])),'valide': '1',
'partner_owner_recid':str(my_partner['recid'])})
@ -6376,6 +6443,24 @@ def Sent_Convention_Stagiaire_By_Email(tab_files, Folder, diction):
smtpserver.close()
print(" Email envoyé " + str(val))
"""
# Ajout de l'evenement dans l'historique
"""
# L'action n'est loggué pour les envois reels (en prod)
if( send_in_production == 1):
now = str(datetime.now().strftime("%d/%m/%Y %H:%M:%S"))
history_event_dict = {}
history_event_dict['token'] = diction['token']
history_event_dict['related_collection'] = "inscription"
history_event_dict['related_collection_recid'] = str(diction['inscription_id'])
history_event_dict['action_date'] = str(now)
history_event_dict['action_description'] = "Convention envoyée par email à la liste : "+str(tab_emails_destinataire)
local_status, local_retval = mycommon.Collection_Historique.Add_Historique_Event(history_event_dict)
if (local_status is False):
mycommon.myprint(
" WARNING : Impossible de logguer l'historique pour l'évènement : " + str(history_event_dict))
return True, "L'email a été correctement envoyé "
except Exception as e:

File diff suppressed because it is too large Load Diff

View File

@ -394,6 +394,10 @@ def Add_Update_SessionFormation(diction):
existing_session_code = local_retval1['code_session']
existing_class_internal_url = local_retval1['class_internal_url']
current_step = local_retval1['session_etape']
print(" ### current_step = ", current_step)
local_retval = MYSY_GV.dbname['inscription'].count_documents({'session_id':str(existing_session_code),
@ -405,7 +409,7 @@ def Add_Update_SessionFormation(diction):
Warning_Message = "Cette session a déjà des inscriptions. Le code de la session ne peut etre modifié. Les autres champs ont été correctement mis à jour"
print(" ###laaa mydata = ", mydata)
#print(" ###laaa mydata = ", mydata)
coll_name = MYSY_GV.dbname['session_formation']
ret_val = coll_name.find_one_and_update(
{'_id':ObjectId(str(session_id)), 'valide':'1'},
@ -420,6 +424,34 @@ def Add_Update_SessionFormation(diction):
diction['code_session']) + "' ")
return False, "Impossible d'ajouter/mettre à jour la session '" + str(diction['code_session']) + "' "
new_step = ret_val['session_etape']
print(" ### new_step = ", new_step)
"""
# Ajout de l'evenement dans l'historique
"""
# Cas particulier : Verifier s'il y a eu changement d'session_etape, pour préciser cela dans le log de l'historique
major_change_text = ""
if( str(new_step) != str(current_step)):
major_change_text = " Changement étape : "+str(current_step)+" ==> "+str(new_step)+" "
now = str(datetime.now().strftime("%d/%m/%Y %H:%M:%S"))
history_event_dict = {}
history_event_dict['token'] = diction['token']
history_event_dict['related_collection'] = "session_formation"
history_event_dict['related_collection_recid'] = str(ret_val['_id'])
history_event_dict['action_date'] = str(now)
if( major_change_text == "" ):
history_event_dict['action_description'] = "Mise à jour "
else:
history_event_dict['action_description'] = str(major_change_text)
local_status, local_retval = mycommon.Collection_Historique.Add_Historique_Event(history_event_dict)
if (local_status is False):
mycommon.myprint(
" WARNING : Impossible de logguer l'historique pour l'évènement : " + str(history_event_dict))
print("len(str(Warning_Message)) = ", len(str(Warning_Message)), )
if(len(str(Warning_Message)) > 2 ):
@ -434,7 +466,7 @@ def Add_Update_SessionFormation(diction):
coll_name = MYSY_GV.dbname['session_formation']
ret_val = coll_name.insert_one(mydata)
local_inserted_id = ret_val.inserted_id
if (ret_val is None or not hasattr(ret_val, 'inserted_id') ):
mycommon.myprint(
@ -442,6 +474,22 @@ def Add_Update_SessionFormation(diction):
diction['code_session']) + "' ")
return False, "Impossible d'ajouter la session '" + str(diction['code_session']) + "' "
"""
# Ajout de l'evenement dans l'historique
"""
now = str(datetime.now().strftime("%d/%m/%Y %H:%M:%S"))
history_event_dict = {}
history_event_dict['token'] = diction['token']
history_event_dict['related_collection'] = "session_formation"
history_event_dict['related_collection_recid'] = str(local_inserted_id)
history_event_dict['action_date'] = str(now)
history_event_dict['action_description'] = "Creation "
local_status, local_retval = mycommon.Collection_Historique.Add_Historique_Event(history_event_dict)
if (local_status is False):
mycommon.myprint(
" WARNING : Impossible de logguer l'historique pour l'évènement : " + str(history_event_dict))
return True, " La session de formation à bien été créée"
@ -3793,7 +3841,23 @@ def Duplicate_List_Session_Formation(diction):
duplicated_session['code_session'] = str(session_data['code_session'])+"_dup"
duplicated_session['date_update'] = now
duplicated_session['update_by'] = str(my_partner['_id'])
MYSY_GV.dbname['session_formation'].insert_one(duplicated_session)
local_retval = MYSY_GV.dbname['session_formation'].insert_one(duplicated_session)
"""
# Ajout de l'evenement dans l'historique
"""
now = str(datetime.now().strftime("%d/%m/%Y %H:%M:%S"))
history_event_dict = {}
history_event_dict['token'] = diction['token']
history_event_dict['related_collection'] = "session_formation"
history_event_dict['related_collection_recid'] = str(local_retval.inserted_id)
history_event_dict['action_date'] = str(now)
history_event_dict['action_description'] = "Creation (Dupliqué depuis "+str(duplicated_session['code_session'])+" "
local_status, local_retval = mycommon.Collection_Historique.Add_Historique_Event(history_event_dict)
if (local_status is False):
mycommon.myprint(
" WARNING : Impossible de logguer l'historique pour l'évènement : " + str(history_event_dict))
cpt = cpt + 1
if(cpt > 1 ):

View File

@ -320,20 +320,13 @@ def Add_Update_Agenda_Event_Stagiaire(diction):
inscription_id = str(diction['inscription_id'])
now = str(datetime.now().strftime("%d/%m/%Y %H:%M:%S"))
history_event_dict = {}
history_event_dict['token'] = diction['token']
history_event_dict['related_collection'] = "inscription"
history_event_dict['related_collection_recid'] = str(inscription_id)
history_event_dict['action_date'] = str(now)
history_event_dict['action_description'] = "Absence du "+str( mydata['event_start'] )+" au "+str(mydata['event_end'])+" "
print(" ### history_event_dict = ", history_event_dict)
local_status, local_retval = mycommon.Collection_Historique.Add_Historique_Event(history_event_dict)
if (local_status is False):
mycommon.myprint(
" WARNING : Impossible de logguer l'historique pour l'évènement : "+str(history_event_dict))

24
main.py
View File

@ -1069,7 +1069,7 @@ def add_class_mass():
# Create variable for uploaded file
f = request.files['File']
status, retval = cm.add_class_mass(f, app.config['UPLOAD_FOLDER'], payload)
status, retval = cm.add_class_mass(f, MYSY_GV.TEMPORARY_DIRECTORY_V2, payload)
return jsonify(status=status, message=retval)
@ -2498,7 +2498,7 @@ def Add_Update_SessionFormation_mass():
if request.method == 'POST':
# Create variable for uploaded file
f = request.files['File']
localStatus, message = SF.Add_Update_SessionFormation_mass(f, app.config['UPLOAD_FOLDER'], payload)
localStatus, message = SF.Add_Update_SessionFormation_mass(f, MYSY_GV.TEMPORARY_DIRECTORY_V2, payload)
#status, retval = cm.add_class_mass(f, app.config['UPLOAD_FOLDER'], payload)
return jsonify(status=localStatus, message=message)
@ -2518,7 +2518,7 @@ def Add_Update_SessionFormation_mass_for_many_class():
if request.method == 'POST':
# Create variable for uploaded file
f = request.files['File']
localStatus, message = SF.Add_Update_SessionFormation_mass_for_many_class(f, app.config['UPLOAD_FOLDER'], payload)
localStatus, message = SF.Add_Update_SessionFormation_mass_for_many_class(f, MYSY_GV.TEMPORARY_DIRECTORY_V2, payload)
#status, retval = cm.add_class_mass(f, app.config['UPLOAD_FOLDER'], payload)
return jsonify(status=localStatus, message=message)
@ -3699,7 +3699,7 @@ def Add_Partner_Client_mass():
if request.method == 'POST':
# Create variable for uploaded file
f = request.files['File']
localStatus, message = partner_client.Add_Partner_Client_mass(f, app.config['UPLOAD_FOLDER'], payload)
localStatus, message = partner_client.Add_Partner_Client_mass(f, MYSY_GV.TEMPORARY_DIRECTORY_V2, payload)
#status, retval = cm.add_class_mass(f, app.config['UPLOAD_FOLDER'], payload)
return jsonify(status=localStatus, message=message)
@ -4043,7 +4043,7 @@ def Sent_Convention_Stagiaire_By_Email_mass():
for tmp in request.files.getlist("File") :
tab_files.append(tmp)
status, retval = inscription.Sent_Convention_Stagiaire_By_Email_mass(tab_files, app.config['UPLOAD_FOLDER'], payload)
status, retval = inscription.Sent_Convention_Stagiaire_By_Email_mass(tab_files, MYSY_GV.TEMPORARY_DIRECTORY_V2, payload)
return jsonify(status=status, message=retval)
@ -4267,7 +4267,7 @@ def Add_Ressource_Humaine_mass():
if request.method == 'POST':
# Create variable for uploaded file
f = request.files['File']
localStatus, message = ressources_humaines.Add_Ressource_Humaine_mass(f, app.config['UPLOAD_FOLDER'], payload)
localStatus, message = ressources_humaines.Add_Ressource_Humaine_mass(f, MYSY_GV.TEMPORARY_DIRECTORY_V2, payload)
#status, retval = cm.add_class_mass(f, app.config['UPLOAD_FOLDER'], payload)
return jsonify(status=localStatus, message=message)
@ -6069,6 +6069,18 @@ def Get_Action_Historique_List():
return jsonify(status=status, message=retval)
"""
Clean session date : cette fontion transforme les formats de date en jj/mm/aaaa, en supprimant les h:m:s
"""
@app.route('/myclass/api/clean_session_dates/', methods=['POST','GET'])
@crossdomain(origin='*')
def clean_session_dates():
# On recupere le corps (payload) de la requete
payload = mycommon.strip_dictionary (request.form.to_dict())
print(" ### clean_session_dates payload = ",payload)
status, retval = mycommon.clean_session_dates()
return jsonify(status=status, message=retval)
if __name__ == '__main__':
print(" debut api")

View File

@ -101,9 +101,7 @@ def Upload_Save_CSV_File(file=None, Folder=None):
file.filename = new_file_name
file.save(os.path.join(str(Folder), secure_filename(file.filename))) # t
Global_file_name = "./Data/"+file.filename
Global_file_name = str(Folder)+str(file.filename)
return True, Global_file_name
@ -149,9 +147,8 @@ def Upload_Save_PDF_IMG_File(file=None, Folder=None):
file.filename = new_file_name
file.save(os.path.join(str(Folder), secure_filename(file.filename))) # t
Global_file_name = "./Data/"+file.filename
Global_file_name = str(Folder) + str(file.filename)
return True, Global_file_name
@ -193,9 +190,7 @@ def Upload_Save_IMG_File(file=None, Folder=None):
file.filename = new_file_name
file.save(os.path.join(str(Folder), secure_filename(file.filename))) # t
Global_file_name = "./Data/"+file.filename
Global_file_name = str(Folder) + str(file.filename)
return True, Global_file_name
@ -234,9 +229,7 @@ def Upload_Save_IMG_PNG_File(file=None, Folder=None):
file.filename = new_file_name
file.save(os.path.join(str(Folder), secure_filename(file.filename))) # t
Global_file_name = "./Data/"+file.filename
Global_file_name = str(Folder) + str(file.filename)
return True, Global_file_name
@ -3884,4 +3877,36 @@ def Get_Previous_Month_Start_End_Date():
except Exception as e:
exc_type, exc_obj, exc_tb = sys.exc_info()
myprint(str(inspect.stack()[0][3]) + " -" + str(e) + " - Line : " + str(exc_tb.tb_lineno))
return False, " Impossible de récuperer les dates début et fin du mois en cours ", False
return False, " Impossible de récuperer les dates début et fin du mois en cours ", False
"""
Clean session date : cette fontion transforme les formats de date en jj/mm/aaaa, en supprimant les h:m:s
"""
def clean_session_dates():
try:
count = MYSY_GV.dbname['session_formation'].count_documents({})
print(" COUT = ", count)
for val in MYSY_GV.dbname['session_formation'].find({}):
print(" Traitement de : ", str(val))
my_data = {}
my_data['date_debut'] = str(val['date_debut'])[0:10]
my_data['date_fin'] = str(val['date_fin'])[0:10]
my_data['date_debut_inscription'] = str(val['date_debut_inscription'])[0:10]
my_data['date_fin_inscription'] = str(val['date_fin_inscription'])[0:10]
ret_val = MYSY_GV.dbname['session_formation'].find_one_and_update(
{'_id': ObjectId(str(val['_id'])) },
{"$set": my_data }, upsert=False,
return_document=ReturnDocument.AFTER
)
return True, " OKK "
except Exception as e:
exc_type, exc_obj, exc_tb = sys.exc_info()
myprint(str(inspect.stack()[0][3]) + " -" + str(e) + " - Line : " + str(exc_tb.tb_lineno))
return False, " impossible de faire clean_date"