parent
0b9634ccc5
commit
65d788ac44
|
@ -4,10 +4,11 @@
|
|||
<option name="autoReloadType" value="SELECTIVE" />
|
||||
</component>
|
||||
<component name="ChangeListManager">
|
||||
<list default="true" id="c6d0259a-16e1-410d-91a1-830590ee2a08" name="Changes" comment="ss">
|
||||
<list default="true" id="c6d0259a-16e1-410d-91a1-830590ee2a08" name="Changes" comment="ssqsdqsd">
|
||||
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" 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$/main.py" beforeDir="false" afterPath="$PROJECT_DIR$/main.py" afterDir="false" />
|
||||
</list>
|
||||
<option name="SHOW_DIALOG" value="false" />
|
||||
<option name="HIGHLIGHT_CONFLICTS" value="true" />
|
||||
|
@ -449,7 +450,7 @@
|
|||
<option name="project" value="LOCAL" />
|
||||
<updated>1747251650255</updated>
|
||||
</task>
|
||||
<option name="localTasksCounter" value="479" />
|
||||
<option name="localTasksCounter" value="480" />
|
||||
<servers />
|
||||
</component>
|
||||
<component name="Vcs.Log.Tabs.Properties">
|
||||
|
@ -491,7 +492,6 @@
|
|||
</option>
|
||||
</component>
|
||||
<component name="VcsManagerConfiguration">
|
||||
<MESSAGE value="03/05/2025 - 20h" />
|
||||
<MESSAGE value="05/05/2025 - 20h" />
|
||||
<MESSAGE value="06/05/2025 - 20h" />
|
||||
<MESSAGE value="07/05/2025 - 20h" />
|
||||
|
@ -516,6 +516,7 @@
|
|||
<MESSAGE value="19/06/2025 -18h" />
|
||||
<MESSAGE value="20/06/2025 -18h" />
|
||||
<MESSAGE value="ss" />
|
||||
<option name="LAST_COMMIT_MESSAGE" value="ss" />
|
||||
<MESSAGE value="ssqsdqsd" />
|
||||
<option name="LAST_COMMIT_MESSAGE" value="ssqsdqsd" />
|
||||
</component>
|
||||
</project>
|
3211
Log/log_file.log
3211
Log/log_file.log
File diff suppressed because it is too large
Load Diff
|
@ -1851,6 +1851,8 @@ def GetAllValideSessionPartner_List(diction):
|
|||
}
|
||||
]
|
||||
print("#### GetAllValideSessionPartner_List query = ", query)
|
||||
mytoday_add_30j = datetime.today() + timedelta(days=30)
|
||||
mytoday_minus_5j = datetime.today() - timedelta(days=5)
|
||||
|
||||
RetObject = []
|
||||
cpt = 0
|
||||
|
@ -2098,12 +2100,26 @@ def GetAllValideSessionPartner_List(diction):
|
|||
local_diction['token'] = str(diction['token'])
|
||||
local_diction['session_id'] = str(retVal['_id'])
|
||||
|
||||
local_check_session_alert_status, local_check_session_alert_retval, local_check_session_alert_is_warning = mycommon.Check_Partner_Session_Alert(
|
||||
local_diction)
|
||||
"""
|
||||
25/06/2025 - zzzz
|
||||
On ne fait le controle d'alerte que sur les session dont la date début < today - 5 jours jour ou > today + 30 jour
|
||||
|
||||
"""
|
||||
|
||||
#print(" ### CMP de datetime.strptime(val['date_debut'], '%d/%m/%Y') = ", datetime.strptime(val['date_debut'], '%d/%m/%Y'))
|
||||
#print(" ### CMP de mytoday_add_30j = ", mytoday_add_30j)
|
||||
|
||||
if( datetime.strptime(val['date_debut'], '%d/%m/%Y') < mytoday_add_30j and datetime.strptime(val['date_debut'], '%d/%m/%Y') > mytoday_minus_5j):
|
||||
# On est dans l'interval de controle.
|
||||
local_check_session_alert_status, local_check_session_alert_retval, local_check_session_alert_is_warning = mycommon.Check_Partner_Session_Alert(
|
||||
local_diction)
|
||||
|
||||
if (local_check_session_alert_status):
|
||||
is_session_alert = local_check_session_alert_is_warning
|
||||
session_alert_message = local_check_session_alert_retval
|
||||
|
||||
|
||||
|
||||
if (local_check_session_alert_status):
|
||||
is_session_alert = local_check_session_alert_is_warning
|
||||
session_alert_message = local_check_session_alert_retval
|
||||
|
||||
val['is_session_alert'] = is_session_alert
|
||||
val['session_alert_message'] = session_alert_message
|
||||
|
@ -5557,6 +5573,201 @@ def Duplicate_List_Session_Formation(diction):
|
|||
return False, "Impossible de dupliquer La promotion de formation"
|
||||
|
||||
|
||||
|
||||
"""
|
||||
Cette fonction est utilisé pour faire les tests de volumetrie
|
||||
"""
|
||||
def Duplicate_List_Session_Formation_CREATE_1000_SESSION(diction):
|
||||
try:
|
||||
|
||||
field_list = ['token', 'tab_session_id', 'date_debut', 'date_fin', 'session_etape',
|
||||
'formateur_id']
|
||||
incom_keys = diction.keys()
|
||||
for val in incom_keys:
|
||||
if val not in field_list and val.startswith('my_') is False:
|
||||
mycommon.myprint(str(inspect.stack()[0][
|
||||
3]) + " - Le champ '" + val + "' n'est pas autorisé.")
|
||||
return False, " Toutes les informations fournies ne sont pas valables"
|
||||
|
||||
"""
|
||||
Verification de la liste des champs obligatoires
|
||||
"""
|
||||
field_list_obligatoire = ['token', 'tab_session_id', 'date_debut', 'date_fin']
|
||||
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 la liste des arguments ")
|
||||
return False, " Toutes les informations necessaires n'ont pas été fournies"
|
||||
|
||||
# Recuperation du recid du partner
|
||||
mydata = {}
|
||||
mytoken = ""
|
||||
if ("token" in diction.keys()):
|
||||
if diction['token']:
|
||||
mytoken = diction['token']
|
||||
|
||||
# Verifier la validité du token
|
||||
local_status, my_partner = mycommon.Check_Connexion_And_Return_Partner_Data({'token':mytoken})
|
||||
if (local_status is not True):
|
||||
return local_status, my_partner
|
||||
|
||||
|
||||
# Verification de la validité de toutes les session dans tab_session_id
|
||||
tab_session_id = str(diction['tab_session_id']).split(',')
|
||||
for session_id in tab_session_id :
|
||||
if( MYSY_GV.dbname['session_formation'].count_documents({'_id':ObjectId(str(session_id)),
|
||||
'valide':'1',
|
||||
'partner_owner_recid':str(my_partner['recid'])}) != 1):
|
||||
mycommon.myprint(
|
||||
str(inspect.stack()[0][3]) + " La session_id :"+str(session_id)+" n'est pas valide ")
|
||||
return False, " La session_id :"+str(session_id)+" n'est pas valide "
|
||||
|
||||
|
||||
# Verifier la validité du formateur si fourni
|
||||
formateur_id = ""
|
||||
if( "formateur_id" in diction.keys() and diction['formateur_id']):
|
||||
formateur_id = diction['formateur_id']
|
||||
is_valide_formateur_count = MYSY_GV.dbname['ressource_humaine'].count_documents({'partner_recid':my_partner['recid'],
|
||||
'valide':'1',
|
||||
'locked':'0',
|
||||
'_id':ObjectId(str(formateur_id))})
|
||||
|
||||
if( is_valide_formateur_count != 1):
|
||||
mycommon.myprint(
|
||||
str(inspect.stack()[0][3]) + " L'identifiant du formateur est invalide ")
|
||||
return False, " L'identifiant du formateur est invalide "
|
||||
|
||||
|
||||
# Verifier la validité de l'etape
|
||||
session_etape = ""
|
||||
if ("session_etape" in diction.keys()):
|
||||
session_etape = str(diction['session_etape'])
|
||||
|
||||
is_valide_etape = MYSY_GV.dbname['base_partner_session_step'].count_documents({'partner_owner_recid':my_partner['recid'],
|
||||
'valide':'1',
|
||||
'locked':'0',
|
||||
'session_step_name':str(session_etape)})
|
||||
if( is_valide_etape != 1):
|
||||
mycommon.myprint(
|
||||
str(inspect.stack()[0][3]) + " L'étape de La promotion est invalide ")
|
||||
return False, " L'étape de La promotion est invalide "
|
||||
|
||||
|
||||
# Verification des date et des cohérences de date
|
||||
local_session_date_debut = ""
|
||||
if ("date_debut" in diction.keys()):
|
||||
local_session_date_debut = str(diction['date_debut'])[0:10]
|
||||
|
||||
local_session_date_fin = ""
|
||||
if ("date_fin" in diction.keys()):
|
||||
local_session_date_fin = str(diction['date_fin'])[0:10]
|
||||
|
||||
# Controle de cohérence sur les dates
|
||||
local_status = mycommon.CheckisDate(str(diction['date_debut'])[0:10])
|
||||
if (local_status is False):
|
||||
mycommon.myprint(
|
||||
str(inspect.stack()[0][
|
||||
3]) + " La date de debut n'est pas au format jj/mm/aaaa ")
|
||||
|
||||
return False, " La date de debut n'est pas au format jj/mm/aaaa "
|
||||
|
||||
local_status = mycommon.CheckisDate(str(diction['date_fin'])[0:10])
|
||||
if (local_status is False):
|
||||
mycommon.myprint(
|
||||
str(inspect.stack()[0][
|
||||
3]) + " La date de fin n'est pas au format jj/mm/aaaa ")
|
||||
|
||||
return False, " La date de fin n'est pas au format jj/mm/aaaa "
|
||||
|
||||
if (datetime.strptime(str(diction['date_debut'])[0:10], '%d/%m/%Y') > datetime.strptime(
|
||||
str(diction['date_fin'])[0:10], '%d/%m/%Y')):
|
||||
mycommon.myprint(
|
||||
str(inspect.stack()[0][
|
||||
3]) + " Session de Formation : La date debut " + str(
|
||||
diction['date_debut'])[0:10] +
|
||||
" doit être antérieure à la date de fin " + str(diction['date_fin'])[0:10])
|
||||
|
||||
return False, " La date debut de formation " + str(diction['date_debut'])[0:10] + \
|
||||
" doit être antérieure à la date de fin de formation " + str(diction['date_fin'])[0:10] + " "
|
||||
|
||||
# Duplicata
|
||||
cpt = 0
|
||||
now = str(datetime.now())
|
||||
for session_id in tab_session_id:
|
||||
session_data = MYSY_GV.dbname['session_formation'].find_one({'_id':ObjectId(str(session_id)),
|
||||
'valide':'1',
|
||||
'partner_owner_recid':str(my_partner['recid'])})
|
||||
|
||||
if( session_data is None):
|
||||
mycommon.myprint(
|
||||
str(inspect.stack()[0][3]) + " La session / promotion n'est pas valide ")
|
||||
return False, " La session / promotion n'est pas valide "
|
||||
|
||||
|
||||
|
||||
duplicated_session = session_data
|
||||
del duplicated_session['_id']
|
||||
if( "invoiced_statut" in duplicated_session ):
|
||||
del duplicated_session['invoiced_statut']
|
||||
|
||||
|
||||
duplicated_session['code_session'] = str(session_data['code_session'])+"_dup"
|
||||
duplicated_session['creation_date'] = now
|
||||
duplicated_session['creation_by'] = str(my_partner['_id'])
|
||||
|
||||
if( "mode_animation" in session_data.keys() ):
|
||||
duplicated_session['mode_animation'] = str(session_data['mode_animation'])
|
||||
else:
|
||||
duplicated_session['mode_animation'] = "0"
|
||||
|
||||
if( "type_session" in session_data.keys() ):
|
||||
duplicated_session['type_session'] = str(session_data['type_session'])
|
||||
else:
|
||||
duplicated_session['type_session'] = "0"
|
||||
|
||||
duplicated_session['date_debut'] = str(diction['date_debut'])[0:10]
|
||||
duplicated_session['date_fin'] = str(diction['date_fin'])[0:10]
|
||||
duplicated_session['session_etape'] = str(diction['session_etape'])
|
||||
duplicated_session['formateur_id'] = str(formateur_id)
|
||||
|
||||
i = 1
|
||||
code_session = str(session_data['code_session'])
|
||||
while (i < 300 ):
|
||||
duplicated_session['code_session'] = str(code_session) + "_dup_"+str(i)
|
||||
print(" ### duplicated_session = ", duplicated_session)
|
||||
if( "_id" in duplicated_session.keys()):
|
||||
del duplicated_session['_id']
|
||||
|
||||
local_retval = MYSY_GV.dbname['session_formation'].insert_one(duplicated_session)
|
||||
i = i + 1
|
||||
|
||||
"""
|
||||
# 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 ):
|
||||
return True, "("+str(cpt)+" sessions ont été correctement dupliquées "
|
||||
else:
|
||||
return True, "La promotion a été correctement dupliquée "
|
||||
|
||||
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 de dupliquer La promotion de formation"
|
||||
|
||||
"""
|
||||
Cette fonction les conventions par email de formation en partant de la session.
|
||||
|
||||
|
|
13
main.py
13
main.py
|
@ -2565,6 +2565,19 @@ def Duplicate_List_Session_Formation():
|
|||
localStatus, message= SF.Duplicate_List_Session_Formation(payload)
|
||||
return jsonify(status=localStatus, message=message )
|
||||
|
||||
"""
|
||||
Cette fonction est utilisé pour faire les tests de volumetrie
|
||||
"""
|
||||
@app.route('/myclass/api/Duplicate_List_Session_Formation_CREATE_1000_SESSION/', methods=['POST','GET'])
|
||||
@crossdomain(origin='*')
|
||||
def Duplicate_List_Session_Formation_CREATE_1000_SESSION():
|
||||
# On recupere le corps (payload) de la requete
|
||||
payload = mycommon.strip_dictionary (request.form.to_dict())
|
||||
print(" ### Duplicate_List_Session_Formation_CREATE_1000_SESSION : payload = ",str(payload))
|
||||
localStatus, message= SF.Duplicate_List_Session_Formation_CREATE_1000_SESSION(payload)
|
||||
return jsonify(status=localStatus, message=message )
|
||||
|
||||
|
||||
|
||||
"""
|
||||
API : pour préparer et envoyer les convention en partant d'une session
|
||||
|
|
Loading…
Reference in New Issue