sdsqq
parent
6f2d7e311a
commit
0467c82644
|
@ -1,12 +1,11 @@
|
|||
<?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="20/05/2024 - 22h00">
|
||||
<list default="true" id="c6d0259a-16e1-410d-91a1-830590ee2a08" name="Changes" comment="21/05/2024 - 21h">
|
||||
<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$/partner_client.py" beforeDir="false" afterPath="$PROJECT_DIR$/partner_client.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$/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" />
|
||||
</list>
|
||||
<option name="SHOW_DIALOG" value="false" />
|
||||
<option name="HIGHLIGHT_CONFLICTS" value="true" />
|
||||
|
@ -76,13 +75,6 @@
|
|||
<option name="presentableId" value="Default" />
|
||||
<updated>1680804787304</updated>
|
||||
</task>
|
||||
<task id="LOCAL-00260" summary="07/04/2024 - 19h19">
|
||||
<created>1712509552892</created>
|
||||
<option name="number" value="00260" />
|
||||
<option name="presentableId" value="LOCAL-00260" />
|
||||
<option name="project" value="LOCAL" />
|
||||
<updated>1712509552893</updated>
|
||||
</task>
|
||||
<task id="LOCAL-00261" summary="09/04/2024 - 15h19">
|
||||
<created>1712669291680</created>
|
||||
<option name="number" value="00261" />
|
||||
|
@ -419,7 +411,14 @@
|
|||
<option name="project" value="LOCAL" />
|
||||
<updated>1716233337269</updated>
|
||||
</task>
|
||||
<option name="localTasksCounter" value="309" />
|
||||
<task id="LOCAL-00309" summary="21/05/2024 - 21h">
|
||||
<created>1716318314386</created>
|
||||
<option name="number" value="00309" />
|
||||
<option name="presentableId" value="LOCAL-00309" />
|
||||
<option name="project" value="LOCAL" />
|
||||
<updated>1716318314387</updated>
|
||||
</task>
|
||||
<option name="localTasksCounter" value="310" />
|
||||
<servers />
|
||||
</component>
|
||||
<component name="Vcs.Log.Tabs.Properties">
|
||||
|
@ -461,7 +460,6 @@
|
|||
</option>
|
||||
</component>
|
||||
<component name="VcsManagerConfiguration">
|
||||
<MESSAGE value="vvvv" />
|
||||
<MESSAGE value="04/05/2024 - 20h30" />
|
||||
<MESSAGE value="05/05/2024 - 13h30" />
|
||||
<MESSAGE value="05/05/2024 - 17h30" />
|
||||
|
@ -486,6 +484,7 @@
|
|||
<MESSAGE value="19/05/2024 - 22h15" />
|
||||
<MESSAGE value="20/05/2024 - 14h00" />
|
||||
<MESSAGE value="20/05/2024 - 22h00" />
|
||||
<option name="LAST_COMMIT_MESSAGE" value="20/05/2024 - 22h00" />
|
||||
<MESSAGE value="21/05/2024 - 21h" />
|
||||
<option name="LAST_COMMIT_MESSAGE" value="21/05/2024 - 21h" />
|
||||
</component>
|
||||
</project>
|
1359
Log/log_file.log
1359
Log/log_file.log
File diff suppressed because it is too large
Load Diff
|
@ -1479,7 +1479,7 @@ def Add_Sequence_Affectation_Ressource_Poste(diction):
|
|||
|
||||
my_data['valide'] = "1"
|
||||
my_data['locked'] = "0"
|
||||
my_data['date_update'] = str(datetime.now().strftime("%d/%m/%Y %H:%M:%S"))
|
||||
my_data['date_update'] = str(datetime.now())
|
||||
my_data['update_by'] = str(my_partner_data['_id'])
|
||||
|
||||
inserted_data = MYSY_GV.dbname['session_formation_sequence_affectation'].insert_one(my_data)
|
||||
|
@ -1532,11 +1532,10 @@ def Add_Sequence_Affectation_Ressource_Poste(diction):
|
|||
return False, " Impossible d'affecter la ressource à la sequence "
|
||||
|
||||
|
||||
|
||||
"""
|
||||
Affectation d'une ressource (humaine ou materielle) en masse à plusieurs sequence
|
||||
Affectation d'une ressource (humaine ou materielle) a une note_evaluation
|
||||
"""
|
||||
def Add_Sequence_Affectation_Ressource_Poste_Mass(diction):
|
||||
def Add_Note_Evaluation_Affectation_Ressource_Poste(diction):
|
||||
try:
|
||||
|
||||
diction = mycommon.strip_dictionary(diction)
|
||||
|
@ -1544,7 +1543,8 @@ def Add_Sequence_Affectation_Ressource_Poste_Mass(diction):
|
|||
"""
|
||||
Verification des input acceptés
|
||||
"""
|
||||
field_list = ['token', "tab_sequence_session_id", "poste", "comment", 'related_target_collection', 'related_target_collection_id']
|
||||
field_list = ['token', "note_evaluation_id", "poste",
|
||||
"comment", 'related_target_collection', 'related_target_collection_id']
|
||||
|
||||
incom_keys = diction.keys()
|
||||
for val in incom_keys:
|
||||
|
@ -1557,7 +1557,183 @@ def Add_Sequence_Affectation_Ressource_Poste_Mass(diction):
|
|||
Verification des champs obligatoires
|
||||
"""
|
||||
|
||||
field_list_obligatoire = ['token', 'tab_sequence_session_id', "poste", ]
|
||||
field_list_obligatoire = ['token', 'note_evaluation_id', "poste", ]
|
||||
|
||||
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 liste ")
|
||||
return False, " Toutes le information obligatoires n'ont pas été fournies"
|
||||
|
||||
token = ""
|
||||
if ("token" in diction.keys()):
|
||||
if diction['token']:
|
||||
token = diction['token']
|
||||
|
||||
|
||||
# Recuperation du recid du partenaire
|
||||
partner_recid = mycommon.get_parnter_recid_from_token(str(token))
|
||||
if partner_recid is False:
|
||||
mycommon.myprint(str(inspect.stack()[0][3]) + " - Impossible de récupérer le partner_recid")
|
||||
return False, " Les informations d'identification sont invalides"
|
||||
|
||||
local_status, my_partner_data = mycommon.Check_Connexion_And_Return_Partner_Data(diction)
|
||||
if (local_status is not True):
|
||||
return local_status, my_partner_data
|
||||
|
||||
note_evaluation_id = ""
|
||||
if ("note_evaluation_id" in diction.keys()):
|
||||
if diction['note_evaluation_id']:
|
||||
note_evaluation_id = diction['note_evaluation_id']
|
||||
|
||||
# Verifier que l'evaluation existe bien
|
||||
note_evaluation_existe_count = MYSY_GV.dbname['note_evaluation'].count_documents({'_id':ObjectId(str(note_evaluation_id)),
|
||||
'partner_owner_recid':str(partner_recid),
|
||||
'valide':'1', 'locked':'0'})
|
||||
|
||||
if( note_evaluation_existe_count != 1 ) :
|
||||
mycommon.myprint(str(inspect.stack()[0][3]) + " L'identifiant de la note d'évaluation est invalide ")
|
||||
return False, "L'identifiant de l'note d'évaluation est invalide "
|
||||
|
||||
|
||||
note_evaluation_existe_data = MYSY_GV.dbname['note_evaluation'].find_one(
|
||||
{'_id': ObjectId(str(note_evaluation_id)),
|
||||
'partner_owner_recid': str(partner_recid),
|
||||
'valide': '1', 'locked': '0'})
|
||||
|
||||
|
||||
|
||||
|
||||
comment = ""
|
||||
if ("comment" in diction.keys()):
|
||||
if diction['comment']:
|
||||
comment = diction['comment']
|
||||
if(len(str(comment)) > 500):
|
||||
mycommon.myprint(
|
||||
str(inspect.stack()[0][
|
||||
3]) + " Le champ 'comment' a plus de 500 caractères ")
|
||||
return False, "Le champ 'comment' a plus de 500 caractères "
|
||||
|
||||
poste = ""
|
||||
if ("poste" in diction.keys()):
|
||||
poste = diction['poste']
|
||||
if (len(str(poste)) > 255):
|
||||
mycommon.myprint(
|
||||
str(inspect.stack()[0][
|
||||
3]) + " Le champ 'poste' a plus de 255 caractères ")
|
||||
return False, "Le champ 'poste' a plus de 255 caractères "
|
||||
|
||||
|
||||
related_target_collection_id = ""
|
||||
related_target_collection = ""
|
||||
if ("related_target_collection_id" in diction.keys() and "related_target_collection" in diction.keys()):
|
||||
if( diction['related_target_collection_id'] and diction['related_target_collection'] ):
|
||||
related_target_collection_id = diction['related_target_collection_id']
|
||||
related_target_collection = diction['related_target_collection']
|
||||
else:
|
||||
if( diction['related_target_collection_id'] != "" or diction['related_target_collection'] != ""):
|
||||
mycommon.myprint(
|
||||
str(inspect.stack()[0][
|
||||
3]) + " Les données related_target_collection_id et related_target_collection sont incohérentes")
|
||||
return False, "Les données related_target_collection_id et related_target_collection sont incohérentes "
|
||||
|
||||
|
||||
|
||||
my_data = {}
|
||||
|
||||
my_data['partner_owner_recid'] = str(partner_recid)
|
||||
my_data['poste'] = str(poste)
|
||||
my_data['related_target_collection_id'] = str(related_target_collection_id)
|
||||
my_data['related_target_collection'] = str(related_target_collection)
|
||||
if( "comment" in diction.keys() ):
|
||||
my_data['comment'] = str(diction['comment'])
|
||||
else:
|
||||
my_data['comment'] = ""
|
||||
|
||||
my_data['note_evaluation_id'] = str(diction['note_evaluation_id'])
|
||||
|
||||
|
||||
my_data['valide'] = "1"
|
||||
my_data['locked'] = "0"
|
||||
my_data['date_update'] = str(datetime.now())
|
||||
my_data['update_by'] = str(my_partner_data['_id'])
|
||||
|
||||
inserted_data = MYSY_GV.dbname['note_evaluation_affectation_ressource'].insert_one(my_data)
|
||||
if( inserted_data is None):
|
||||
return False," Impossible d'affecter la ressource à l'évaluation (2)"
|
||||
|
||||
print(" ### inserted_data = ", inserted_data)
|
||||
|
||||
|
||||
"""
|
||||
A présent que la ressource est créée, creation de l'event dans l'agenda de la ressource
|
||||
"""
|
||||
|
||||
my_class_data = MYSY_GV.dbname['myclass'].find_one({'_id':str(note_evaluation_existe_data['class_id']),
|
||||
'partner_owner_recid':str(my_partner_data['recid']),
|
||||
'valide':'1'})
|
||||
|
||||
class_title = ""
|
||||
if( my_class_data and "title" in my_class_data.keys()):
|
||||
class_title = my_class_data['title']
|
||||
|
||||
data_agenda = {}
|
||||
data_agenda['related_collection'] = str(related_target_collection)
|
||||
data_agenda['related_collection_recid'] = str(related_target_collection_id)
|
||||
data_agenda['partner_owner_recid'] = str(partner_recid)
|
||||
data_agenda['event_title'] = str(class_title)
|
||||
|
||||
data_agenda['session_formation_sequence_affectation_id'] = str(inserted_data.inserted_id)
|
||||
|
||||
data_agenda['comment'] = "Eval : "+str(note_evaluation_existe_data['titre'])
|
||||
|
||||
data_agenda['event_start'] = datetime.strptime(str(note_evaluation_existe_data['eval_date_heure_debut']), '%d/%m/%Y %H:%M').isoformat()
|
||||
data_agenda['event_end'] = datetime.strptime(str(note_evaluation_existe_data['eval_date_heure_fin']), '%d/%m/%Y %H:%M').isoformat()
|
||||
data_agenda['valide'] = "1"
|
||||
data_agenda['locked'] = "0"
|
||||
data_agenda['event_type'] = "planning"
|
||||
data_agenda['sequence_session_id'] = str(note_evaluation_existe_data['_id'])
|
||||
data_agenda['update_by'] = str(my_partner_data['_id'])
|
||||
|
||||
#print(" #### data_agenda to add = ", data_agenda)
|
||||
|
||||
MYSY_GV.dbname['agenda'].insert_one(data_agenda)
|
||||
|
||||
|
||||
return True, " La ressource a été correctement affectée à l'évaluation "
|
||||
|
||||
except Exception as e:
|
||||
exc_type, exc_obj, exc_tb = sys.exc_info()
|
||||
mycommon.myprint(str(inspect.stack()[0][3]) + " -" + str(e) + " - Line : " + str(exc_tb.tb_lineno))
|
||||
return False, " Impossible d'affecter la ressource à l'évaluation "
|
||||
|
||||
|
||||
"""
|
||||
Mettre à jour une affectation de ressource a une note_evaluation
|
||||
"""
|
||||
def Update_Note_Evaluation_Affectation_Ressource_Poste(diction):
|
||||
try:
|
||||
|
||||
diction = mycommon.strip_dictionary(diction)
|
||||
|
||||
"""
|
||||
Verification des input acceptés
|
||||
"""
|
||||
field_list = ['token', "_id", "note_evaluation_id", "poste", "comment", 'related_target_collection', 'related_target_collection_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, " Les informations fournies sont incorrectes",
|
||||
|
||||
"""
|
||||
Verification des champs obligatoires
|
||||
"""
|
||||
|
||||
field_list_obligatoire = ['token', '_id' ]
|
||||
|
||||
for val in field_list_obligatoire:
|
||||
if val not in diction:
|
||||
|
@ -1583,66 +1759,91 @@ def Add_Sequence_Affectation_Ressource_Poste_Mass(diction):
|
|||
if (local_status is not True):
|
||||
return local_status, my_partner_data
|
||||
|
||||
tab_sequence_session_id = ""
|
||||
if ("tab_sequence_session_id" in diction.keys()):
|
||||
if diction['tab_sequence_session_id']:
|
||||
tab_sequence_session_id = str(diction['tab_sequence_session_id']).split(",")
|
||||
|
||||
# Verifier que la sequence existe bien
|
||||
for sequence_session_id in tab_sequence_session_id :
|
||||
sequence_session_existe_count = MYSY_GV.dbname['session_formation_sequence'].count_documents({'_id':ObjectId(str(sequence_session_id)), 'partner_owner_recid':str(partner_recid),
|
||||
'valide':'1', 'locked':'0'})
|
||||
# Verifier l'existence et la validité de la sequence à modifier
|
||||
|
||||
if( sequence_session_existe_count <= 0 ) :
|
||||
mycommon.myprint(str(inspect.stack()[0][3]) + " - La sequence est invalide ")
|
||||
return False, " La sequence est invalide "
|
||||
|
||||
if (sequence_session_existe_count > 1):
|
||||
mycommon.myprint(str(inspect.stack()[0][3]) + " - Sequence incohérente. il a plusieurs sequences avec le meme id ")
|
||||
return False, " Sequence incohérente. il a plusieurs sequences avec le meme id "
|
||||
# Verifier que l'affetation existe bien
|
||||
affectation_note_evaluation_existe_count = MYSY_GV.dbname['note_evaluation_affectation_ressource'].count_documents({'_id':ObjectId(str(diction['_id'])),
|
||||
'partner_owner_recid':str(partner_recid),
|
||||
'valide':'1', 'locked':'0'})
|
||||
|
||||
# Vu que toutes les sequences sont valides, on fait la mise à jour
|
||||
for sequence_session_id in tab_sequence_session_id:
|
||||
my_ressource_seq_data = {}
|
||||
|
||||
my_ressource_seq_data['token'] = diction['token']
|
||||
my_ressource_seq_data['sequence_session_id'] = sequence_session_id
|
||||
if( "poste" in diction.keys() ):
|
||||
my_ressource_seq_data['poste'] = diction['poste']
|
||||
else:
|
||||
my_ressource_seq_data['poste'] = ""
|
||||
|
||||
if ("comment" in diction.keys()):
|
||||
my_ressource_seq_data['comment'] = diction['comment']
|
||||
else:
|
||||
my_ressource_seq_data['comment'] = ""
|
||||
|
||||
if ("related_target_collection" in diction.keys()):
|
||||
my_ressource_seq_data['related_target_collection'] = diction['related_target_collection']
|
||||
else:
|
||||
my_ressource_seq_data['related_target_collection'] = ""
|
||||
|
||||
if ("related_target_collection_id" in diction.keys()):
|
||||
my_ressource_seq_data['related_target_collection_id'] = diction['related_target_collection_id']
|
||||
else:
|
||||
my_ressource_seq_data['related_target_collection_id'] = ""
|
||||
if( affectation_note_evaluation_existe_count != 1 ) :
|
||||
mycommon.myprint(str(inspect.stack()[0][3]) + " L'identification de l'affectation est invalide ")
|
||||
return False, " L'identification de l'affectation est invalide "
|
||||
|
||||
|
||||
|
||||
local_status, local_retval = Add_Sequence_Affectation_Ressource_Poste(my_ressource_seq_data)
|
||||
if(local_status is False ):
|
||||
comment = ""
|
||||
if ("comment" in diction.keys()):
|
||||
comment = diction['comment']
|
||||
if(len(str(comment)) > 500):
|
||||
mycommon.myprint(
|
||||
str(inspect.stack()[0][3]) + " - WARNING . "+str(local_retval))
|
||||
str(inspect.stack()[0][
|
||||
3]) + " Le champ 'comment' a plus de 500 caractères ")
|
||||
return False, "Le champ 'comment' a plus de 500 caractères "
|
||||
|
||||
poste = ""
|
||||
if ("poste" in diction.keys()):
|
||||
poste = diction['poste']
|
||||
if (len(str(poste)) > 255):
|
||||
mycommon.myprint(
|
||||
str(inspect.stack()[0][
|
||||
3]) + " Le champ 'poste' a plus de 255 caractères ")
|
||||
return False, "Le champ 'poste' a plus de 255 caractères "
|
||||
|
||||
|
||||
related_target_collection_id = ""
|
||||
related_target_collection = ""
|
||||
if ("related_target_collection_id" in diction.keys() and "related_target_collection" in diction.keys()):
|
||||
if( diction['related_target_collection_id'] and diction['related_target_collection'] ):
|
||||
related_target_collection_id = diction['related_target_collection_id']
|
||||
related_target_collection = diction['related_target_collection']
|
||||
else:
|
||||
if( diction['related_target_collection_id'] != "" or diction['related_target_collection'] != ""):
|
||||
mycommon.myprint(
|
||||
str(inspect.stack()[0][
|
||||
3]) + " Les données related_target_collection_id et related_target_collection sont incohérentes")
|
||||
return False, "Les données related_target_collection_id et related_target_collection sont incohérentes "
|
||||
|
||||
|
||||
|
||||
update_data = {}
|
||||
|
||||
return True, " Les ressources ont bien été ajoutées en masse"
|
||||
update_data['partner_owner_recid'] = str(partner_recid)
|
||||
update_data['poste'] = str(poste)
|
||||
update_data['related_target_collection_id'] = str(related_target_collection_id)
|
||||
update_data['related_target_collection'] = str(related_target_collection)
|
||||
update_data['comment'] = str(diction['comment'])
|
||||
update_data['sequence_session_id'] = str(affectation_note_evaluation_existe_count['_id'])
|
||||
|
||||
|
||||
update_data['valide'] = "1"
|
||||
update_data['locked'] = "0"
|
||||
update_data['date_update'] = str(datetime.now())
|
||||
update_data['update_by'] = str(my_partner_data['_id'])
|
||||
|
||||
inserted_data = MYSY_GV.dbname['note_evaluation_affectation_ressource'].find_one_and_update(
|
||||
{'_id': ObjectId(str(diction['_id'])), 'valide': "1", "locked": "0",
|
||||
'partner_owner_recid': str(partner_recid)},
|
||||
{"$set": update_data},
|
||||
return_document=ReturnDocument.AFTER,
|
||||
upsert=False,
|
||||
)
|
||||
|
||||
if (inserted_data is None):
|
||||
mycommon.myprint(str(inspect.stack()[0][3]) + " - Impossible de mettre à jour cette affectation (3)")
|
||||
return False, " Impossible de mettre à jour cette affectation (3) "
|
||||
|
||||
|
||||
|
||||
return True, " L'affectation a bien été mise à jour"
|
||||
|
||||
except Exception as e:
|
||||
exc_type, exc_obj, exc_tb = sys.exc_info()
|
||||
mycommon.myprint(str(inspect.stack()[0][3]) + " -" + str(e) + " - Line : " + str(exc_tb.tb_lineno))
|
||||
return False, " Impossible d'affecter la ressource à la sequence "
|
||||
return False, " Impossible de mettre à jour l'affectation de la ressource "
|
||||
|
||||
|
||||
|
||||
|
||||
|
@ -1762,7 +1963,7 @@ def Update_Sequence_Affectation_Ressource_Poste(diction):
|
|||
|
||||
update_data['valide'] = "1"
|
||||
update_data['locked'] = "0"
|
||||
update_data['date_update'] = str(datetime.now().strftime("%d/%m/%Y %H:%M:%S"))
|
||||
update_data['date_update'] = str(datetime.now())
|
||||
update_data['update_by'] = str(my_partner_data['_id'])
|
||||
|
||||
inserted_data = MYSY_GV.dbname['session_formation_sequence_affectation'].find_one_and_update(
|
||||
|
@ -1986,6 +2187,103 @@ def Get_List_Sequence_Ressource_Affectation(diction):
|
|||
return False, " Impossible de récupérer la liste des ressources affectées à cette séquence "
|
||||
|
||||
|
||||
|
||||
"""
|
||||
Recuperer la liste des affectations de ressource à une sequence
|
||||
"""
|
||||
def Get_List_note_evaluation_Ressource_Affectation(diction):
|
||||
try:
|
||||
field_list_obligatoire = [ 'token', 'note_evaluation_id', ]
|
||||
|
||||
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 liste ")
|
||||
return False, " La valeur '" + val + "' n'est pas presente dans liste"
|
||||
|
||||
my_token = ""
|
||||
if ("token" in diction.keys()):
|
||||
if diction['token']:
|
||||
my_token = diction['token']
|
||||
|
||||
|
||||
|
||||
# Recuperation du recid du partenaire
|
||||
partner_recid = mycommon.get_parnter_recid_from_token(str(my_token))
|
||||
if partner_recid is False:
|
||||
mycommon.myprint(str(inspect.stack()[0][3]) + " - Impossible d'imprimer la fiche detaillée")
|
||||
return False, " Les informations d'identification sont invalides"
|
||||
|
||||
local_status, my_partner_data = mycommon.Check_Connexion_And_Return_Partner_Data(diction)
|
||||
if (local_status is not True):
|
||||
return local_status, my_partner_data
|
||||
|
||||
|
||||
|
||||
qry_affectation = {'partner_owner_recid':str(my_partner_data['recid']),
|
||||
'note_evaluation_id':str(diction['note_evaluation_id']),
|
||||
'valide':'1', 'locked':'0'}
|
||||
|
||||
|
||||
#print(" ### qry_affectation = ",qry_affectation)
|
||||
|
||||
RetObject = []
|
||||
val_tmp = 1
|
||||
|
||||
for retval in MYSY_GV.dbname['note_evaluation_affectation_ressource'].find(qry_affectation):
|
||||
user = retval
|
||||
user['id'] = str(val_tmp)
|
||||
val_tmp = val_tmp + 1
|
||||
|
||||
related_target_collection_id_nom = ""
|
||||
related_target_collection_object = ""
|
||||
|
||||
# Si l'affectation a un 'related_target_collection_id', alors cela veut dire qu'il faut aller chercheer
|
||||
# la cible de cette affection.
|
||||
if( "related_target_collection_id" in retval.keys() and "related_target_collection" in retval.keys()):
|
||||
if( retval["related_target_collection_id"] and retval["related_target_collection"]):
|
||||
|
||||
# Si l'affectation concerne une ressource_humaine
|
||||
if( retval["related_target_collection"] == "ressource_humaine"):
|
||||
affectation_target_data = MYSY_GV.dbname[retval["related_target_collection"]].find_one({"_id":ObjectId(str( retval["related_target_collection_id"])),
|
||||
'partner_recid':str(partner_recid),
|
||||
'valide':'1', 'locked':"0"})
|
||||
|
||||
if(affectation_target_data is not None):
|
||||
related_target_collection_id_nom = affectation_target_data["nom"] +" "+affectation_target_data["prenom"]
|
||||
related_target_collection_object = "Ressource Humaine"
|
||||
|
||||
elif ( retval["related_target_collection"] == "ressource_materielle") :
|
||||
# Si l'affectation concerne une ressource_materielle
|
||||
affectation_target_data = MYSY_GV.dbname[retval["related_target_collection"]].find_one(
|
||||
{"_id": ObjectId(str(retval["related_target_collection_id"])),
|
||||
'partner_recid': str(partner_recid),
|
||||
'valide': '1'})
|
||||
|
||||
if (affectation_target_data is not None):
|
||||
related_target_collection_id_nom = affectation_target_data["nom"]
|
||||
related_target_collection_object = "Ressource Materielle"
|
||||
|
||||
|
||||
|
||||
|
||||
user['related_target_collection_id_nom'] = related_target_collection_id_nom
|
||||
user['related_target_collection_object'] = related_target_collection_object
|
||||
|
||||
RetObject.append(mycommon.JSONEncoder().encode(user))
|
||||
|
||||
return True, RetObject
|
||||
|
||||
except Exception as e:
|
||||
exc_type, exc_obj, exc_tb = sys.exc_info()
|
||||
mycommon.myprint(str(inspect.stack()[0][3]) + " -" + str(e) + " - Line : " + str(exc_tb.tb_lineno))
|
||||
return False, " Impossible de récupérer la liste des ressources affectées à cette évaluation "
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
"""
|
||||
Cette fonction permet de dupliquer une semaine type
|
||||
de date_debut à date_fin.
|
||||
|
|
48
main.py
48
main.py
|
@ -3992,6 +3992,7 @@ Flak ne supporte pas "@app.route" pour lancer les cron,
|
|||
c'est pour cela qu'on recrée la meme entrée sans "@app.route"
|
||||
"""
|
||||
def Flask_Cron_Strip_Get_Customer_Abonnement_Data():
|
||||
mycommon.myprint(" ### CRONN : Flask_Cron_Strip_Get_Customer_Abonnement_Data : payload = ")
|
||||
print(" ### Flask_Cron_Strip_Get_Customer_Abonnement_Data : payload = ")
|
||||
localStatus, message = Stripe.Cron_Strip_Get_Customer_Abonnement_Data()
|
||||
return jsonify(status=localStatus, message=message)
|
||||
|
@ -6834,6 +6835,35 @@ def Update_Sequence_Affectation_Ressource_Poste():
|
|||
return jsonify(status=status, message=retval)
|
||||
|
||||
|
||||
|
||||
"""
|
||||
API pour Affectation d'une ressource (humaine ou materielle) a une note_evaluation
|
||||
"""
|
||||
@app.route('/myclass/api/Add_Note_Evaluation_Affectation_Ressource_Poste/', methods=['POST','GET'])
|
||||
@crossdomain(origin='*')
|
||||
def Add_Note_Evaluation_Affectation_Ressource_Poste():
|
||||
# On recupere le corps (payload) de la requete
|
||||
payload = mycommon.strip_dictionary (request.form.to_dict())
|
||||
print(" ### Add_Note_Evaluation_Affectation_Ressource_Poste payload = ",payload)
|
||||
status, retval = Session_Formation_Sequence.Add_Note_Evaluation_Affectation_Ressource_Poste(payload)
|
||||
return jsonify(status=status, message=retval)
|
||||
|
||||
|
||||
"""
|
||||
API pour mettre à jour une ressource (humaine ou materielle) a une note_evaluation
|
||||
"""
|
||||
@app.route('/myclass/api/Update_Note_Evaluation_Affectation_Ressource_Poste/', methods=['POST','GET'])
|
||||
@crossdomain(origin='*')
|
||||
def Update_Note_Evaluation_Affectation_Ressource_Poste():
|
||||
# On recupere le corps (payload) de la requete
|
||||
payload = mycommon.strip_dictionary (request.form.to_dict())
|
||||
print(" ### Update_Note_Evaluation_Affectation_Ressource_Poste payload = ",payload)
|
||||
status, retval = Session_Formation_Sequence.Update_Note_Evaluation_Affectation_Ressource_Poste(payload)
|
||||
return jsonify(status=status, message=retval)
|
||||
|
||||
|
||||
|
||||
|
||||
"""
|
||||
API Supprimer une affectation de ressource à une sequence
|
||||
"""
|
||||
|
@ -6860,6 +6890,21 @@ def Get_List_Sequence_Ressource_Affectation():
|
|||
return jsonify(status=status, message=retval)
|
||||
|
||||
|
||||
|
||||
"""
|
||||
API Recuperer la liste des affectations de ressource à une note evaluation
|
||||
"""
|
||||
@app.route('/myclass/api/Get_List_note_evaluation_Ressource_Affectation/', methods=['POST','GET'])
|
||||
@crossdomain(origin='*')
|
||||
def Get_List_note_evaluation_Ressource_Affectation():
|
||||
# On recupere le corps (payload) de la requete
|
||||
payload = mycommon.strip_dictionary (request.form.to_dict())
|
||||
print(" ### Get_List_note_evaluation_Ressource_Affectation payload = ",payload)
|
||||
status, retval = Session_Formation_Sequence.Get_List_note_evaluation_Ressource_Affectation(payload)
|
||||
return jsonify(status=status, message=retval)
|
||||
|
||||
|
||||
|
||||
"""
|
||||
API Creation automatique des sequence selon les modeles de jounée de travail
|
||||
"""
|
||||
|
@ -9240,6 +9285,7 @@ def Global_MySy_Cron_Traitement():
|
|||
|
||||
|
||||
def Internal_Global_MySy_Cron_Traitement():
|
||||
mycommon.myprint(" ### CRONNN Internal_Global_MySy_Cron_Traitement : payload = ")
|
||||
print(" ### CRONNN Internal_Global_MySy_Cron_Traitement : payload = ")
|
||||
status, retval = Job_Cron.Global_MySy_Cron_Traitement()
|
||||
print(" FIN traitement Internal_Global_MySy_Cron_Traitement localStatus = ", status)
|
||||
|
@ -9624,7 +9670,7 @@ if __name__ == '__main__':
|
|||
# Create the job
|
||||
#scheduler.add_job(func=Flask_Cron_Strip_Get_Customer_Abonnement_Data, trigger="interval", minutes=50)
|
||||
scheduler.add_job(func=Flask_Cron_Strip_Get_Customer_Abonnement_Data, trigger="interval", hours=22)
|
||||
scheduler.add_job(func=Internal_Global_MySy_Cron_Traitement, trigger="interval", hours=22)
|
||||
scheduler.add_job(func=Internal_Global_MySy_Cron_Traitement, trigger="interval", hours=1)
|
||||
# Start the scheduler
|
||||
scheduler.start()
|
||||
|
||||
|
|
Loading…
Reference in New Issue