sdsqq
parent
0467c82644
commit
9e730f71b7
|
@ -1,11 +1,12 @@
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<project version="4">
|
<project version="4">
|
||||||
<component name="ChangeListManager">
|
<component name="ChangeListManager">
|
||||||
<list default="true" id="c6d0259a-16e1-410d-91a1-830590ee2a08" name="Changes" comment="21/05/2024 - 21h">
|
<list default="true" id="c6d0259a-16e1-410d-91a1-830590ee2a08" name="Changes" comment="sdsqq">
|
||||||
<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$/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_Sequence.py" beforeDir="false" afterPath="$PROJECT_DIR$/Session_Formation_Sequence.py" afterDir="false" />
|
|
||||||
<change beforePath="$PROJECT_DIR$/main.py" beforeDir="false" afterPath="$PROJECT_DIR$/main.py" afterDir="false" />
|
<change beforePath="$PROJECT_DIR$/main.py" beforeDir="false" afterPath="$PROJECT_DIR$/main.py" afterDir="false" />
|
||||||
|
<change beforePath="$PROJECT_DIR$/prj_common.py" beforeDir="false" afterPath="$PROJECT_DIR$/prj_common.py" afterDir="false" />
|
||||||
|
<change beforePath="$PROJECT_DIR$/ressources_humaines.py" beforeDir="false" afterPath="$PROJECT_DIR$/ressources_humaines.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" />
|
||||||
|
@ -75,13 +76,6 @@
|
||||||
<option name="presentableId" value="Default" />
|
<option name="presentableId" value="Default" />
|
||||||
<updated>1680804787304</updated>
|
<updated>1680804787304</updated>
|
||||||
</task>
|
</task>
|
||||||
<task id="LOCAL-00261" summary="09/04/2024 - 15h19">
|
|
||||||
<created>1712669291680</created>
|
|
||||||
<option name="number" value="00261" />
|
|
||||||
<option name="presentableId" value="LOCAL-00261" />
|
|
||||||
<option name="project" value="LOCAL" />
|
|
||||||
<updated>1712669291681</updated>
|
|
||||||
</task>
|
|
||||||
<task id="LOCAL-00262" summary="09/04/2024 - 15h19">
|
<task id="LOCAL-00262" summary="09/04/2024 - 15h19">
|
||||||
<created>1712676544737</created>
|
<created>1712676544737</created>
|
||||||
<option name="number" value="00262" />
|
<option name="number" value="00262" />
|
||||||
|
@ -418,7 +412,14 @@
|
||||||
<option name="project" value="LOCAL" />
|
<option name="project" value="LOCAL" />
|
||||||
<updated>1716318314387</updated>
|
<updated>1716318314387</updated>
|
||||||
</task>
|
</task>
|
||||||
<option name="localTasksCounter" value="310" />
|
<task id="LOCAL-00310" summary="sdsqq">
|
||||||
|
<created>1716399333864</created>
|
||||||
|
<option name="number" value="00310" />
|
||||||
|
<option name="presentableId" value="LOCAL-00310" />
|
||||||
|
<option name="project" value="LOCAL" />
|
||||||
|
<updated>1716399333865</updated>
|
||||||
|
</task>
|
||||||
|
<option name="localTasksCounter" value="311" />
|
||||||
<servers />
|
<servers />
|
||||||
</component>
|
</component>
|
||||||
<component name="Vcs.Log.Tabs.Properties">
|
<component name="Vcs.Log.Tabs.Properties">
|
||||||
|
@ -460,7 +461,6 @@
|
||||||
</option>
|
</option>
|
||||||
</component>
|
</component>
|
||||||
<component name="VcsManagerConfiguration">
|
<component name="VcsManagerConfiguration">
|
||||||
<MESSAGE value="04/05/2024 - 20h30" />
|
|
||||||
<MESSAGE value="05/05/2024 - 13h30" />
|
<MESSAGE value="05/05/2024 - 13h30" />
|
||||||
<MESSAGE value="05/05/2024 - 17h30" />
|
<MESSAGE value="05/05/2024 - 17h30" />
|
||||||
<MESSAGE value="06/05/2024 - 22h30" />
|
<MESSAGE value="06/05/2024 - 22h30" />
|
||||||
|
@ -485,6 +485,7 @@
|
||||||
<MESSAGE value="20/05/2024 - 14h00" />
|
<MESSAGE value="20/05/2024 - 14h00" />
|
||||||
<MESSAGE value="20/05/2024 - 22h00" />
|
<MESSAGE value="20/05/2024 - 22h00" />
|
||||||
<MESSAGE value="21/05/2024 - 21h" />
|
<MESSAGE value="21/05/2024 - 21h" />
|
||||||
<option name="LAST_COMMIT_MESSAGE" value="21/05/2024 - 21h" />
|
<MESSAGE value="sdsqq" />
|
||||||
|
<option name="LAST_COMMIT_MESSAGE" value="sdsqq" />
|
||||||
</component>
|
</component>
|
||||||
</project>
|
</project>
|
1788
Log/log_file.log
1788
Log/log_file.log
File diff suppressed because it is too large
Load Diff
12
main.py
12
main.py
|
@ -9592,6 +9592,18 @@ def Export_To_Excel_List_Participant_To_Evaluation(token, evaluation_id):
|
||||||
return False
|
return False
|
||||||
|
|
||||||
|
|
||||||
|
"""
|
||||||
|
API pour verifier la disponibilité d'une ressource sur un creneau donnée dans l'agenda
|
||||||
|
"""
|
||||||
|
@app.route('/myclass/api/Is_Ressource_Available/', methods=['POST','GET'])
|
||||||
|
@crossdomain(origin='*')
|
||||||
|
def Is_Ressource_Available():
|
||||||
|
# On recupere le corps (payload) de la requete
|
||||||
|
payload = mycommon.strip_dictionary (request.form.to_dict())
|
||||||
|
print(" ### Is_Ressource_Available payload = ",payload)
|
||||||
|
status, retval, avability_check = mycommon.Is_Ressource_Available(payload)
|
||||||
|
return jsonify(status=status, message=retval, avability_check=avability_check)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
180
prj_common.py
180
prj_common.py
|
@ -5608,4 +5608,182 @@ def Get_Partner_Courrier_Model(diction):
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
exc_type, exc_obj, exc_tb = sys.exc_info()
|
exc_type, exc_obj, exc_tb = sys.exc_info()
|
||||||
myprint(str(inspect.stack()[0][3]) + " -" + str(e) + " - ERRORRRR AT Line : " + str(exc_tb.tb_lineno))
|
myprint(str(inspect.stack()[0][3]) + " -" + str(e) + " - ERRORRRR AT Line : " + str(exc_tb.tb_lineno))
|
||||||
return False, " Impossible de récupérer le modèle de courrier "
|
return False, " Impossible de récupérer le modèle de courrier "
|
||||||
|
|
||||||
|
|
||||||
|
"""
|
||||||
|
Cette fonction verifie si une ressource (humaine ou materielle) est disponibe sur une creneau donnée
|
||||||
|
"""
|
||||||
|
def Is_Ressource_Available(diction):
|
||||||
|
try:
|
||||||
|
diction = strip_dictionary(diction)
|
||||||
|
|
||||||
|
"""
|
||||||
|
Verification des input acceptés
|
||||||
|
"""
|
||||||
|
field_list = ['token', 'related_collection', 'related_collection_recid', 'event_start', 'event_end' ]
|
||||||
|
|
||||||
|
incom_keys = diction.keys()
|
||||||
|
for val in incom_keys:
|
||||||
|
if val not in field_list and val.startswith('my_') is False:
|
||||||
|
myprint(str(
|
||||||
|
inspect.stack()[0][3]) + " Le champ '" + val + "' n'existe pas")
|
||||||
|
return False, " Les informations fournies sont incorrectes", "0"
|
||||||
|
|
||||||
|
"""
|
||||||
|
Verification des champs obligatoires
|
||||||
|
"""
|
||||||
|
field_list_obligatoire = ['token', 'related_collection', 'related_collection_recid', 'event_start', 'event_end' ]
|
||||||
|
for val in field_list_obligatoire:
|
||||||
|
if val not in diction:
|
||||||
|
myprint(
|
||||||
|
str(inspect.stack()[0][3]) + " - La valeur '" + val + "' n'est pas presente dans liste ")
|
||||||
|
return False, " Les informations fournies sont incorrectes", "0"
|
||||||
|
|
||||||
|
"""
|
||||||
|
Verification de l'identité et autorisation de l'entité qui
|
||||||
|
appelle cette API
|
||||||
|
"""
|
||||||
|
token = ""
|
||||||
|
if ("token" in diction.keys()):
|
||||||
|
if diction['token']:
|
||||||
|
token = diction['token']
|
||||||
|
|
||||||
|
local_status, my_partner = Check_Connexion_And_Return_Partner_Data(diction)
|
||||||
|
if (local_status is not True):
|
||||||
|
return local_status, my_partner, "0"
|
||||||
|
|
||||||
|
local_status = CheckisDate_Hours(diction['event_start'])
|
||||||
|
if (local_status is False):
|
||||||
|
myprint(
|
||||||
|
str(inspect.stack()[0][
|
||||||
|
3]) + " La date de debut n'est pas au format 'jj/mm/aaaa hh:mm' ")
|
||||||
|
return False, " La date de debut n'est pas au format 'jj/mm/aaaa hh:mm'", "0"
|
||||||
|
|
||||||
|
local_status = CheckisDate_Hours(diction['event_end'])
|
||||||
|
if (local_status is False):
|
||||||
|
myprint(
|
||||||
|
str(inspect.stack()[0][
|
||||||
|
3]) + " La date de fin n'est pas au format 'jj/mm/aaaa hh:mm' ")
|
||||||
|
return False, " La date de fin n'est pas au format 'jj/mm/aaaa hh:mm'", "0"
|
||||||
|
|
||||||
|
|
||||||
|
local_event_date_debut = datetime.strptime(str(diction['event_start']), '%d/%m/%Y %H:%M')
|
||||||
|
local_event_date_fin = datetime.strptime(str(diction['event_end']), '%d/%m/%Y %H:%M')
|
||||||
|
|
||||||
|
|
||||||
|
event_start_ISODATE = local_event_date_debut.strftime("%Y-%m-%dT%H:%M")
|
||||||
|
event_end_ISODATE = local_event_date_fin.strftime("%Y-%m-%dT%H:%M")
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
# Verification de l'existance et de l'acceptation d'un evement pour le 'related_collection'
|
||||||
|
if (diction['related_collection'] not in MYSY_GV.ALLOWED_AGENDA_RELATED_COLLECTION):
|
||||||
|
myprint(
|
||||||
|
str(inspect.stack()[0][3]) + " - L'objet metier " + str(
|
||||||
|
diction['related_collection']) + " n'accepte pas de planning")
|
||||||
|
return False, " L'objet metier " + str(diction['related_collection']) + " n'accepte pas de planning ", "0"
|
||||||
|
|
||||||
|
|
||||||
|
# Verifier que 'related_collection_recid' existe et est valide dans la collection 'related_collection'
|
||||||
|
is_existe_valide_related_collection_recid = MYSY_GV.dbname[
|
||||||
|
str(diction['related_collection'])].count_documents(
|
||||||
|
{'_id': ObjectId(str(diction['related_collection_recid'])),
|
||||||
|
'partner_recid': str(my_partner['recid']),
|
||||||
|
'valide': '1',
|
||||||
|
'locked': '0'})
|
||||||
|
|
||||||
|
if (is_existe_valide_related_collection_recid <= 0):
|
||||||
|
myprint(
|
||||||
|
str(inspect.stack()[0][3]) + " - L'identifiant du 'related_collection_recid' n'est pas valide ")
|
||||||
|
return False, " L'identifiant du 'related_collection_recid' n'est pas valide ", "0"
|
||||||
|
|
||||||
|
if (event_start_ISODATE >= event_end_ISODATE ):
|
||||||
|
myprint(
|
||||||
|
str(inspect.stack()[0][
|
||||||
|
3]) + " La date de fin " + str(
|
||||||
|
diction['event_end']) + " doit être postérieure à la date de début " + str(
|
||||||
|
diction['event_start']) + " ")
|
||||||
|
return False, " La date de fin " + str(
|
||||||
|
diction['event_end']) + " doit être postérieure à la date de début " + str(
|
||||||
|
diction['event_start']) + " ", "0"
|
||||||
|
|
||||||
|
filt_periode_start_date_ISODATE = datetime.strptime(str(diction['event_start']), '%d/%m/%Y %H:%M')
|
||||||
|
filt_periode_end_date_ISODATE = datetime.strptime(str(diction['event_end']), '%d/%m/%Y %H:%M')
|
||||||
|
|
||||||
|
|
||||||
|
qery_match = {
|
||||||
|
"$match":{
|
||||||
|
"$and":[
|
||||||
|
{
|
||||||
|
"$or":[
|
||||||
|
{
|
||||||
|
"mysy_session_end_date":{
|
||||||
|
"$lte":filt_periode_end_date_ISODATE,
|
||||||
|
"$gte":filt_periode_start_date_ISODATE
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"mysy_session_start_date": {
|
||||||
|
"$lte": filt_periode_end_date_ISODATE,
|
||||||
|
"$gte": filt_periode_start_date_ISODATE
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"valide":"1",
|
||||||
|
"partner_owner_recid":str(my_partner['recid']),
|
||||||
|
"related_collection_recid":str(diction['related_collection_recid'])
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
pipe_qry = ([
|
||||||
|
{"$addFields": {
|
||||||
|
"mysy_session_end_date": {
|
||||||
|
'$dateFromString': {
|
||||||
|
'dateString': { '$substr': [ "$event_end", 0, 16 ] },
|
||||||
|
'format': "%Y-%m-%dT%H:%M"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{"$addFields": {
|
||||||
|
"mysy_session_start_date": {
|
||||||
|
'$dateFromString': {
|
||||||
|
'dateString': {'$substr': ["$event_start", 0, 16]},
|
||||||
|
'format': "%Y-%m-%dT%H:%M"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
qery_match,
|
||||||
|
{
|
||||||
|
"$count": "nb_existing_event"
|
||||||
|
}
|
||||||
|
|
||||||
|
])
|
||||||
|
|
||||||
|
#print(" ### Is_Ressource_Available ici pipe_qry = ", pipe_qry)
|
||||||
|
|
||||||
|
existing_event = 0
|
||||||
|
for retval in MYSY_GV.dbname['agenda'].aggregate(pipe_qry):
|
||||||
|
#print( " ### retval = ", retval)
|
||||||
|
existing_event = tryInt(retval['nb_existing_event'])
|
||||||
|
|
||||||
|
if( existing_event > 0 ):
|
||||||
|
return True, "Cette ressource n'est pas disponible entre le "+str(diction['event_start'])+" et le "+str(diction['event_end'])+" ", "0"
|
||||||
|
|
||||||
|
|
||||||
|
return True, "Ressource disponible ", "1"
|
||||||
|
|
||||||
|
|
||||||
|
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 verifier la disponibilité de la ressource ", "0"
|
|
@ -5121,3 +5121,6 @@ def Delete_RH_Competence(diction):
|
||||||
exc_type, exc_obj, exc_tb = sys.exc_info()
|
exc_type, exc_obj, exc_tb = sys.exc_info()
|
||||||
mycommon.myprint(str(inspect.stack()[0][3]) + " -" + str(e) + " - Line : " + str(exc_tb.tb_lineno))
|
mycommon.myprint(str(inspect.stack()[0][3]) + " -" + str(e) + " - Line : " + str(exc_tb.tb_lineno))
|
||||||
return False, " Impossible de supprimer la compétence "
|
return False, " Impossible de supprimer la compétence "
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue