06/09/2024 - 22h
parent
695c0b465c
commit
c196c94546
|
@ -1,15 +1,12 @@
|
|||
<?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="04/09/2024 - 23h">
|
||||
<list default="true" id="c6d0259a-16e1-410d-91a1-830590ee2a08" name="Changes" comment="qsh">
|
||||
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/Activite.py" beforeDir="false" afterPath="$PROJECT_DIR$/Activite.py" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/GlobalVariable.py" beforeDir="false" afterPath="$PROJECT_DIR$/GlobalVariable.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$/lms_chamilo/mysy_lms.py" beforeDir="false" afterPath="$PROJECT_DIR$/lms_chamilo/mysy_lms.py" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/main.py" beforeDir="false" afterPath="$PROJECT_DIR$/main.py" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/partners.py" beforeDir="false" afterPath="$PROJECT_DIR$/partners.py" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/ressources_humaines.py" beforeDir="false" afterPath="$PROJECT_DIR$/ressources_humaines.py" afterDir="false" />
|
||||
</list>
|
||||
<option name="SHOW_DIALOG" value="false" />
|
||||
<option name="HIGHLIGHT_CONFLICTS" value="true" />
|
||||
|
@ -79,13 +76,6 @@
|
|||
<option name="presentableId" value="Default" />
|
||||
<updated>1680804787304</updated>
|
||||
</task>
|
||||
<task id="LOCAL-00342" summary="ww">
|
||||
<created>1719675793617</created>
|
||||
<option name="number" value="00342" />
|
||||
<option name="presentableId" value="LOCAL-00342" />
|
||||
<option name="project" value="LOCAL" />
|
||||
<updated>1719675793618</updated>
|
||||
</task>
|
||||
<task id="LOCAL-00343" summary="wws">
|
||||
<created>1720114279292</created>
|
||||
<option name="number" value="00343" />
|
||||
|
@ -422,7 +412,14 @@
|
|||
<option name="project" value="LOCAL" />
|
||||
<updated>1725482228555</updated>
|
||||
</task>
|
||||
<option name="localTasksCounter" value="391" />
|
||||
<task id="LOCAL-00391" summary="qsh">
|
||||
<created>1725630280201</created>
|
||||
<option name="number" value="00391" />
|
||||
<option name="presentableId" value="LOCAL-00391" />
|
||||
<option name="project" value="LOCAL" />
|
||||
<updated>1725630280202</updated>
|
||||
</task>
|
||||
<option name="localTasksCounter" value="392" />
|
||||
<servers />
|
||||
</component>
|
||||
<component name="Vcs.Log.Tabs.Properties">
|
||||
|
@ -464,7 +461,6 @@
|
|||
</option>
|
||||
</component>
|
||||
<component name="VcsManagerConfiguration">
|
||||
<MESSAGE value="08/08/2024 - 20h32" />
|
||||
<MESSAGE value="08/08/2024 - 20h32s" />
|
||||
<MESSAGE value="10/08/2024 - 20h32s" />
|
||||
<MESSAGE value="11/08/2024 - 12h32s" />
|
||||
|
@ -489,6 +485,7 @@
|
|||
<MESSAGE value="01/09/2024 - 20:00" />
|
||||
<MESSAGE value="03/09/2024 - 20:00" />
|
||||
<MESSAGE value="04/09/2024 - 23h" />
|
||||
<option name="LAST_COMMIT_MESSAGE" value="04/09/2024 - 23h" />
|
||||
<MESSAGE value="qsh" />
|
||||
<option name="LAST_COMMIT_MESSAGE" value="qsh" />
|
||||
</component>
|
||||
</project>
|
192
Activite.py
192
Activite.py
|
@ -87,11 +87,12 @@ def Add_activite(diction):
|
|||
str(inspect.stack()[0][3]) + " - partner_recid est KO. Les données de connexion sont incorrectes ")
|
||||
return False, " Vous n'etes pas autorisé à utiliser cette API "
|
||||
|
||||
# Recuperation des données du partenaire
|
||||
local_status, my_partner = mycommon.get_partner_data_from_recid(partner_recid)
|
||||
if (local_status is False):
|
||||
mycommon.myprint(str(inspect.stack()[0][3]) + " - impossible de récupérer les données du partenaire")
|
||||
return False, str(inspect.stack()[0][3]) + " - impossible de récupérer les données du partenaire. "
|
||||
|
||||
|
||||
data_for_check_connexion = {'token': token}
|
||||
local_status, my_partner = mycommon.Check_Connexion_And_Return_Partner_Data(data_for_check_connexion)
|
||||
if (local_status is not True):
|
||||
return local_status, my_partner
|
||||
|
||||
|
||||
|
||||
|
@ -218,7 +219,10 @@ def Add_activite(diction):
|
|||
data['valide'] = '1'
|
||||
data['locked'] = '0'
|
||||
data['date_update'] = str(datetime.now())
|
||||
data['created_by'] = str(my_partner['_id'])
|
||||
|
||||
|
||||
print(" ### my_partner = ", my_partner)
|
||||
# Creation du RecId
|
||||
data['recid'] = mycommon.create_user_recid()
|
||||
|
||||
|
@ -296,11 +300,10 @@ def Update_activite(diction):
|
|||
str(inspect.stack()[0][3]) + " - partner_recid est KO. Les données de connexion sont incorrectes ")
|
||||
return False, " Vous n'etes pas autorisé à utiliser cette API "
|
||||
|
||||
# Recuperation des données du partenaire
|
||||
local_status, my_partner = mycommon.get_partner_data_from_recid(partner_recid)
|
||||
if (local_status is False):
|
||||
mycommon.myprint(str(inspect.stack()[0][3]) + " - impossible de récupérer les données du partenaire")
|
||||
return False, str(inspect.stack()[0][3]) + " - impossible de récupérer les données du partenaire. "
|
||||
data_for_check_connexion = {'token': token}
|
||||
local_status, my_partner = mycommon.Check_Connexion_And_Return_Partner_Data(data_for_check_connexion)
|
||||
if (local_status is not True):
|
||||
return local_status, my_partner
|
||||
|
||||
"""
|
||||
Verification s'il n'existe pas un cient du partenaire qui perte le meme
|
||||
|
@ -601,7 +604,7 @@ def Get_List_Entity_Activite(diction):
|
|||
if val not in field_list and val.startswith('my_') is False:
|
||||
mycommon.myprint(str(
|
||||
inspect.stack()[0][3]) + " Le champ '" + val + "' n'existe pas")
|
||||
return False, " Les informations fournies sont incorrectes", False
|
||||
return False, " Les informations fournies sont incorrectes", False, False
|
||||
|
||||
"""
|
||||
Verification des champs obligatoires
|
||||
|
@ -611,7 +614,7 @@ def Get_List_Entity_Activite(diction):
|
|||
if val not in diction:
|
||||
mycommon.myprint(
|
||||
str(inspect.stack()[0][3]) + " - La valeur '" + val + "' n'est pas presente dans liste ")
|
||||
return False, " Les informations fournies sont incorrectes", False
|
||||
return False, " Les informations fournies sont incorrectes", False, False
|
||||
|
||||
"""
|
||||
Verification de l'identité et autorisation de l'entité qui
|
||||
|
@ -626,13 +629,14 @@ def Get_List_Entity_Activite(diction):
|
|||
retval = mycommon.check_partner_token_validity("", token)
|
||||
|
||||
if retval is False:
|
||||
return "Err_Connexion", " La session de connexion n'est pas valide", False
|
||||
return "Err_Connexion", " La session de connexion n'est pas valide", False, False
|
||||
|
||||
# Recuperation des données du partenaire
|
||||
local_status, my_partner = mycommon.get_partner_data_from_token(token)
|
||||
if (local_status is False):
|
||||
mycommon.myprint(str(inspect.stack()[0][3]) + " - impossible de récupérer les données de l'utilisateur ")
|
||||
return False, str(inspect.stack()[0][3]) + " - impossible de récupérer les données de l'utilisateur. ", False
|
||||
|
||||
|
||||
data_for_check_connexion = {'token': token}
|
||||
local_status, my_partner = mycommon.Check_Connexion_And_Return_Partner_Data(data_for_check_connexion)
|
||||
if (local_status is not True):
|
||||
return local_status, my_partner, False, False
|
||||
|
||||
"""
|
||||
Clés de mise à jour
|
||||
|
@ -641,6 +645,7 @@ def Get_List_Entity_Activite(diction):
|
|||
data_cle['partner_recid'] = str(my_partner['recid'])
|
||||
data_cle['related_collection'] = str(diction['related_collection'])
|
||||
|
||||
|
||||
if ("related_collection_owner_email" in diction.keys()):
|
||||
related_collection_owner_email = str(diction['related_collection_owner_email'])
|
||||
"""
|
||||
|
@ -656,11 +661,14 @@ def Get_List_Entity_Activite(diction):
|
|||
related_collection_owner_email) + " dans la collection " + str(diction['related_collection']))
|
||||
return False, str(inspect.stack()[0][3]) + " - impossible de récupérer les données de " + str(
|
||||
related_collection_owner_email) + " dans la collection " + str(
|
||||
diction['related_collection']) + " . ", False
|
||||
diction['related_collection']) + " . ", False, False
|
||||
|
||||
data_cle['related_collection_recid'] = str(local_tmp_val['recid'])
|
||||
|
||||
data_cle['locked'] = "0"
|
||||
data_cle['created_by'] = str(my_partner['_id'])
|
||||
|
||||
print(" frfrfr data_cle = ", data_cle)
|
||||
|
||||
RetObject = []
|
||||
val_tmp = 0
|
||||
|
@ -690,13 +698,29 @@ def Get_List_Entity_Activite(diction):
|
|||
val_tmp = val_tmp + 1
|
||||
RetObject.append(mycommon.JSONEncoder().encode(user))
|
||||
|
||||
return True, RetObject, str(nb_activite_en_retard)
|
||||
"""
|
||||
Reuperer le nombre de nouvelle activité assignées à moi
|
||||
"""
|
||||
"""
|
||||
Clés de mise à jour
|
||||
"""
|
||||
data_cle = {}
|
||||
data_cle['partner_recid'] = str(my_partner['recid'])
|
||||
data_cle['employee_assigned_to_id'] = str(my_partner['ressource_humaine_id'])
|
||||
data_cle['status'] = "0"
|
||||
data_cle['locked'] = "0"
|
||||
data_cle['employee_assigned_view_statut'] = {'$ne': '1'}
|
||||
|
||||
|
||||
nb_new_activite_assigned_to_me = MYSY_GV.dbname['activite'].count_documents(data_cle)
|
||||
|
||||
return True, RetObject, str(nb_activite_en_retard), str(nb_new_activite_assigned_to_me)
|
||||
|
||||
|
||||
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 activités ", False
|
||||
return False, " Impossible de récupérer la liste des activités ", False, False
|
||||
|
||||
|
||||
"""
|
||||
|
@ -743,11 +767,10 @@ def Get_List_Activite_Assign_To(diction):
|
|||
if retval is False:
|
||||
return "Err_Connexion", " La session de connexion n'est pas valide", False
|
||||
|
||||
# Recuperation des données du partenaire
|
||||
local_status, my_partner = mycommon.get_partner_data_from_token(token)
|
||||
if (local_status is False):
|
||||
mycommon.myprint(str(inspect.stack()[0][3]) + " - impossible de récupérer les données de l'utilisateur ")
|
||||
return False, str(inspect.stack()[0][3]) + " - impossible de récupérer les données de l'utilisateur. ", False
|
||||
data_for_check_connexion = {'token': token}
|
||||
local_status, my_partner = mycommon.Check_Connexion_And_Return_Partner_Data(data_for_check_connexion)
|
||||
if (local_status is not True):
|
||||
return local_status, my_partner, False
|
||||
|
||||
"""
|
||||
Clés de mise à jour
|
||||
|
@ -779,6 +802,8 @@ def Get_List_Activite_Assign_To(diction):
|
|||
nb_activite_en_retard = nb_activite_en_retard + 1
|
||||
|
||||
user['retard'] = str(retard)
|
||||
if( "employee_assigned_view_statut" not in user.keys() ):
|
||||
user['employee_assigned_view_statut'] = "0"
|
||||
|
||||
val_tmp = val_tmp + 1
|
||||
RetObject.append(mycommon.JSONEncoder().encode(user))
|
||||
|
@ -838,11 +863,10 @@ def Get_Nb_Entity_Activite_Assign_To_Me_En_Retard(diction):
|
|||
if retval is False:
|
||||
return "Err_Connexion", " La session de connexion n'est pas valide"
|
||||
|
||||
# Recuperation des données du partenaire
|
||||
local_status, my_partner = mycommon.get_partner_data_from_token(token)
|
||||
if (local_status is False):
|
||||
mycommon.myprint(str(inspect.stack()[0][3]) + " - impossible de récupérer les données de l'utilisateur ")
|
||||
return False, str(inspect.stack()[0][3]) + " - impossible de récupérer les données de l'utilisateur. "
|
||||
data_for_check_connexion = {'token': token}
|
||||
local_status, my_partner = mycommon.Check_Connexion_And_Return_Partner_Data(data_for_check_connexion)
|
||||
if (local_status is not True):
|
||||
return local_status, my_partner
|
||||
|
||||
"""
|
||||
Clés de mise à jour
|
||||
|
@ -962,6 +986,69 @@ def Get_Nb_Entity_Activite_Assigne_To_Me_En_Retard_No_token(diction):
|
|||
return False, " Impossible de récupérer la liste des activités en retard"
|
||||
|
||||
|
||||
|
||||
"""
|
||||
Cette fonction recuperer le nombre de nouvelles activité assignée à moi.
|
||||
Une activité nouvellement assignée est une activité dont :
|
||||
employee_assigned_view_statut != 1
|
||||
|
||||
"""
|
||||
def Get_Nb_New_Activite_Assigne_To_Me_Token(diction):
|
||||
try:
|
||||
diction = mycommon.strip_dictionary(diction)
|
||||
|
||||
"""
|
||||
Verification des input acceptés
|
||||
"""
|
||||
field_list = ['partner_owner_recid', 'employee_assigned_to_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'existe pas")
|
||||
return False, " Les informations fournies sont incorrectes",
|
||||
|
||||
"""
|
||||
Verification des champs obligatoires
|
||||
"""
|
||||
field_list_obligatoire = ['partner_owner_recid', 'employee_assigned_to_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, " Les informations fournies sont incorrectes",
|
||||
|
||||
|
||||
"""
|
||||
Clés de mise à jour
|
||||
"""
|
||||
data_cle = {}
|
||||
data_cle['partner_recid'] = str(diction['partner_owner_recid'])
|
||||
data_cle['employee_assigned_to_id'] = str(diction['employee_assigned_to_id'])
|
||||
data_cle['status'] = "0"
|
||||
data_cle['locked'] = "0"
|
||||
data_cle['employee_assigned_view_statut'] = {'$ne':'1'}
|
||||
|
||||
print(" ### data_cle new = ", data_cle)
|
||||
|
||||
nb_new_activite_assigned_to_me = MYSY_GV.dbname['activite'].count_documents(data_cle)
|
||||
|
||||
|
||||
print(" ### il y a "+str(nb_new_activite_assigned_to_me)+" nouvelles activité ")
|
||||
|
||||
return True, str(nb_new_activite_assigned_to_me)
|
||||
|
||||
|
||||
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 activités en retard"
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
"""
|
||||
Recuperation d'une activité donnée en se basant sur on token, activite_recid
|
||||
"""
|
||||
|
@ -979,7 +1066,7 @@ def Get_Given_Activite(diction):
|
|||
if val not in field_list and val.startswith('my_') is False:
|
||||
mycommon.myprint(str(
|
||||
inspect.stack()[0][3]) + " Le champ '" + val + "' n'existe pas")
|
||||
return False, " Les informations fournies sont incorrectes",
|
||||
return False, " Les informations fournies sont incorrectes", False
|
||||
|
||||
"""
|
||||
Verification des champs obligatoires
|
||||
|
@ -989,7 +1076,7 @@ def Get_Given_Activite(diction):
|
|||
if val not in diction:
|
||||
mycommon.myprint(
|
||||
str(inspect.stack()[0][3]) + " - La valeur '" + val + "' n'est pas presente dans liste ")
|
||||
return False, " Les informations fournies sont incorrectes",
|
||||
return False, " Les informations fournies sont incorrectes", False
|
||||
|
||||
"""
|
||||
Verification de l'identité et autorisation de l'entité qui
|
||||
|
@ -1004,13 +1091,12 @@ def Get_Given_Activite(diction):
|
|||
retval = mycommon.check_partner_token_validity("", token)
|
||||
|
||||
if retval is False:
|
||||
return "Err_Connexion", " La session de connexion n'est pas valide"
|
||||
return "Err_Connexion", " La session de connexion n'est pas valide", False
|
||||
|
||||
# Recuperation des données du partenaire
|
||||
local_status, my_partner = mycommon.get_partner_data_from_token(token)
|
||||
if (local_status is False):
|
||||
mycommon.myprint(str(inspect.stack()[0][3]) + " - impossible de récupérer les données de l'utilisateur ")
|
||||
return False, str(inspect.stack()[0][3]) + " - impossible de récupérer les données de l'utilisateur. "
|
||||
data_for_check_connexion = {'token': token}
|
||||
local_status, my_partner = mycommon.Check_Connexion_And_Return_Partner_Data(data_for_check_connexion)
|
||||
if (local_status is not True):
|
||||
return local_status, my_partner, False
|
||||
|
||||
"""
|
||||
Clés de mise à jour
|
||||
|
@ -1067,13 +1153,28 @@ def Get_Given_Activite(diction):
|
|||
return_document=ReturnDocument.AFTER
|
||||
)
|
||||
|
||||
return True, RetObject
|
||||
"""
|
||||
Reuperer le nombre de nouvelle activité assignées à moi
|
||||
"""
|
||||
"""
|
||||
Clés de mise à jour
|
||||
"""
|
||||
data_cle = {}
|
||||
data_cle['partner_recid'] = str(my_partner['recid'])
|
||||
data_cle['employee_assigned_to_id'] = str(my_partner['ressource_humaine_id'])
|
||||
data_cle['status'] = "0"
|
||||
data_cle['locked'] = "0"
|
||||
data_cle['employee_assigned_view_statut'] = {'$ne': '1'}
|
||||
|
||||
nb_new_activite_assigned_to_me = MYSY_GV.dbname['activite'].count_documents(data_cle)
|
||||
|
||||
return True, RetObject, str(nb_new_activite_assigned_to_me)
|
||||
|
||||
|
||||
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 l'activité "
|
||||
return False, " Impossible de récupérer l'activité ", False
|
||||
|
||||
|
||||
"""
|
||||
|
@ -1120,11 +1221,10 @@ def Delete_Given_Activite(diction):
|
|||
if retval is False:
|
||||
return "Err_Connexion", " La session de connexion n'est pas valide"
|
||||
|
||||
# Recuperation des données du partenaire
|
||||
local_status, my_partner = mycommon.get_partner_data_from_token(token)
|
||||
if (local_status is False):
|
||||
mycommon.myprint(str(inspect.stack()[0][3]) + " - impossible de récupérer les données de l'utilisateur ")
|
||||
return False, str(inspect.stack()[0][3]) + " - impossible de récupérer les données de l'utilisateur. "
|
||||
data_for_check_connexion = {'token': token}
|
||||
local_status, my_partner = mycommon.Check_Connexion_And_Return_Partner_Data(data_for_check_connexion)
|
||||
if (local_status is not True):
|
||||
return local_status, my_partner
|
||||
|
||||
"""
|
||||
Clés de mise à jour
|
||||
|
|
2613
Log/log_file.log
2613
Log/log_file.log
File diff suppressed because it is too large
Load Diff
8
main.py
8
main.py
|
@ -4554,8 +4554,8 @@ def Get_List_Entity_Activite():
|
|||
# On recupere le corps (payload) de la requete
|
||||
payload = mycommon.strip_dictionary (request.form.to_dict())
|
||||
print(" ### Get_List_Entity_Activite : payload = ",payload)
|
||||
localStatus, message, nb_activite_en_retard = Activite.Get_List_Entity_Activite(payload)
|
||||
return jsonify(status=localStatus, message=message, nb_activite_en_retard = nb_activite_en_retard)
|
||||
localStatus, message, nb_activite_en_retard, nb_new_activite_assigned_to_me = Activite.Get_List_Entity_Activite(payload)
|
||||
return jsonify(status=localStatus, message=message, nb_activite_en_retard = nb_activite_en_retard, nb_new_activite_assigned_to_me = nb_new_activite_assigned_to_me)
|
||||
|
||||
|
||||
|
||||
|
@ -4596,8 +4596,8 @@ def Get_Given_Activite():
|
|||
# On recupere le corps (payload) de la requete
|
||||
payload = mycommon.strip_dictionary (request.form.to_dict())
|
||||
print(" ### Get_Given_Activite : payload = ",payload)
|
||||
localStatus, message = Activite.Get_Given_Activite(payload)
|
||||
return jsonify(status=localStatus, message=message)
|
||||
localStatus, message, nb_new_activite_assigned_to_me = Activite.Get_Given_Activite(payload)
|
||||
return jsonify(status=localStatus, message=message, nb_new_activite_assigned_to_me=nb_new_activite_assigned_to_me)
|
||||
|
||||
|
||||
|
||||
|
|
11
partners.py
11
partners.py
|
@ -1178,6 +1178,17 @@ def get_partner_account(diction):
|
|||
user['nb_activite_retard'] = "0"
|
||||
|
||||
|
||||
"""
|
||||
Recuperation du nombre de nouvelles activité assigné a moi
|
||||
"""
|
||||
local_new_activite_status, local_new_activite_retval = Activite.Get_Nb_New_Activite_Assigne_To_Me_Token(
|
||||
local_diction)
|
||||
if (local_new_activite_status is True):
|
||||
user['nb_activite_new'] = local_new_activite_retval
|
||||
else:
|
||||
user['nb_activite_new'] = "0"
|
||||
|
||||
|
||||
"""
|
||||
update du 01/05/2024
|
||||
Pour distinguer si le partenaire est a lié à une formation initiale ou continue
|
||||
|
|
Loading…
Reference in New Issue