qsdsqqsdsq
parent
e430b67d71
commit
b68d69cd55
|
@ -5,8 +5,10 @@
|
|||
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" 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_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$/Session_Formation.py" beforeDir="false" afterPath="$PROJECT_DIR$/Session_Formation.py" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/partner_order.py" beforeDir="false" afterPath="$PROJECT_DIR$/partner_order.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_materiels.py" beforeDir="false" afterPath="$PROJECT_DIR$/ressources_materiels.py" afterDir="false" />
|
||||
</list>
|
||||
<option name="SHOW_DIALOG" value="false" />
|
||||
<option name="HIGHLIGHT_CONFLICTS" value="true" />
|
||||
|
@ -76,13 +78,6 @@
|
|||
<option name="presentableId" value="Default" />
|
||||
<updated>1680804787304</updated>
|
||||
</task>
|
||||
<task id="LOCAL-00267" summary="12/04/2024 - 15h05">
|
||||
<created>1712927149481</created>
|
||||
<option name="number" value="00267" />
|
||||
<option name="presentableId" value="LOCAL-00267" />
|
||||
<option name="project" value="LOCAL" />
|
||||
<updated>1712927149482</updated>
|
||||
</task>
|
||||
<task id="LOCAL-00268" summary="14/04/2024 - 23h05">
|
||||
<created>1713129649065</created>
|
||||
<option name="number" value="00268" />
|
||||
|
@ -419,7 +414,14 @@
|
|||
<option name="project" value="LOCAL" />
|
||||
<updated>1716822032753</updated>
|
||||
</task>
|
||||
<option name="localTasksCounter" value="316" />
|
||||
<task id="LOCAL-00316" summary="qsdsq">
|
||||
<created>1716925262987</created>
|
||||
<option name="number" value="00316" />
|
||||
<option name="presentableId" value="LOCAL-00316" />
|
||||
<option name="project" value="LOCAL" />
|
||||
<updated>1716925262988</updated>
|
||||
</task>
|
||||
<option name="localTasksCounter" value="317" />
|
||||
<servers />
|
||||
</component>
|
||||
<component name="Vcs.Log.Tabs.Properties">
|
||||
|
|
|
@ -12013,7 +12013,7 @@ def Get_Inscrit_List_EU_Type_Evaluation(diction):
|
|||
|
||||
])
|
||||
|
||||
print(" ### Get_Inscrit_List_EU_Type_Evaluation pipe_qry = ", pipe_qry)
|
||||
#print(" ### Get_Inscrit_List_EU_Type_Evaluation pipe_qry = ", pipe_qry)
|
||||
|
||||
for val in MYSY_GV.dbname['inscription_liste_ue_type_evalution'].aggregate(pipe_qry):
|
||||
user = {}
|
||||
|
@ -12051,3 +12051,140 @@ def Get_Inscrit_List_EU_Type_Evaluation(diction):
|
|||
print(str(inspect.stack()[0][3]) + " -" + str(e) + " - ERRORRRR AT Line : " + str(exc_tb.tb_lineno))
|
||||
return False, " Impossible de recuperer la liste des évaluation par UE "
|
||||
|
||||
|
||||
"""
|
||||
Cette fonction retourne la liste des inscrits à
|
||||
une UE et un type d'evaluation donnée.
|
||||
|
||||
sont données en option :
|
||||
- Liste UE,
|
||||
- Liste Type evaluation
|
||||
|
||||
use case :
|
||||
Avec cette fonction on peut recuperer la liste des personnes inscrite à
|
||||
- ue : ue1, ue2, etc
|
||||
- type eval : TP, Projet, etc
|
||||
|
||||
"""
|
||||
|
||||
def Get_List_Inscrit_OF_UE_And_Type_Evaluation_with_filter(diction):
|
||||
try:
|
||||
field_list = ['token', 'class_id', 'tab_session_id', 'tab_ue_id', 'tab_type_eval_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é, Creation partenaire annulée")
|
||||
return False, "Toutes les informations fournies ne sont pas valables"
|
||||
|
||||
"""
|
||||
Verification de la liste des champs obligatoires
|
||||
"""
|
||||
field_list_obligatoire = ['token', 'class_id', 'tab_session_id', 'tab_ue_id', 'tab_type_eval_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, "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']
|
||||
|
||||
local_status, my_partner = mycommon.Check_Connexion_And_Return_Partner_Data(diction)
|
||||
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 "
|
||||
|
||||
# Verification de la validité de la formation
|
||||
if (MYSY_GV.dbname['myclass'].count_documents({'_id': ObjectId(str(diction['class_id'])),
|
||||
'valide': '1',
|
||||
'partner_owner_recid': str(
|
||||
my_partner['recid'])}) != 1):
|
||||
mycommon.myprint(
|
||||
str(inspect.stack()[0][3]) + " La formation :" + str(diction['class_id']) + " n'est pas valide ")
|
||||
return False, " La formation :" + str(diction['class_id']) + " n'est pas valide "
|
||||
|
||||
|
||||
# Verification de la validité de toutes les ue_id dans tab_ue_id
|
||||
tab_ue_id = str(diction['tab_ue_id']).split(',')
|
||||
for ue_id in tab_ue_id:
|
||||
if (MYSY_GV.dbname['unite_enseignement'].count_documents({'_id': ObjectId(str(ue_id)),
|
||||
'valide': '1',
|
||||
'partner_owner_recid': str(
|
||||
my_partner['recid'])}) != 1):
|
||||
mycommon.myprint(
|
||||
str(inspect.stack()[0][3]) + " L'UE :" + str(session_id) + " n'est pas valide ")
|
||||
return False, " L'UE :" + str(session_id) + " n'est pas valide "
|
||||
|
||||
# Verification de la validité de toutes les type_eval_id dans tab_type_eval_id
|
||||
tab_type_eval_id = str(diction['tab_type_eval_id']).split(',')
|
||||
for type_eval_id in tab_type_eval_id:
|
||||
if (MYSY_GV.dbname['unite_enseignement'].count_documents({'_id': ObjectId(str(type_eval_id)),
|
||||
'valide': '1',
|
||||
'partner_owner_recid': str(
|
||||
my_partner['recid'])}) != 1):
|
||||
mycommon.myprint(
|
||||
str(inspect.stack()[0][3]) + " Le type d'évaluation :" + str(type_eval_id) + " n'est pas valide ")
|
||||
return False, " Le type d'évaluation :" + str(type_eval_id) + " n'est pas valide "
|
||||
|
||||
|
||||
|
||||
RetObject = []
|
||||
cpt = 0
|
||||
|
||||
qry = {'partner_owner_recid':str(my_partner['recid']),
|
||||
'valide':'1',
|
||||
'locked':'0',
|
||||
'class_id': {'$in': str(diction['class_id']) },
|
||||
'class_eu_id': {'$in': tab_ue_id},
|
||||
'type_evaluation_id': {'$in': tab_type_eval_id},
|
||||
}
|
||||
|
||||
print(" qry = ", qry)
|
||||
|
||||
for retval in MYSY_GV.dbname['inscription_liste_ue_type_evalution'].find( qry ).sort([("_id", pymongo.DESCENDING), ]):
|
||||
user = {}
|
||||
# Recuperation des données de l'inscrit et de l'apprenant
|
||||
if( "inscription_id" in retval.keys() ):
|
||||
inscrit_data = MYSY_GV.dbname['inscription'].find_one({'partner_owner_recid':str(my_partner['recid']),
|
||||
'valide':'1',
|
||||
'locked':'0',
|
||||
'_id':ObjectId(str(retval['inscription_id']))})
|
||||
|
||||
|
||||
local_new_dict = {}
|
||||
local_new_dict['token'] = diction['token']
|
||||
local_new_dict['inscrit_id'] = retval['inscription_id']
|
||||
|
||||
local_inscrit_data_status, local_inscrit_data_retval = mycommon.Get_Inscrit_And_Apprenant_Data(local_new_dict)
|
||||
if( local_inscrit_data_status is False ):
|
||||
return local_inscrit_data_status, local_inscrit_data_retval
|
||||
|
||||
if( "inscrit_data" in local_inscrit_data_retval.keys() ):
|
||||
user['inscrit_data'] = local_inscrit_data_retval['inscrit_data']
|
||||
|
||||
if ("apprenant_data" in local_inscrit_data_retval.keys()):
|
||||
user['apprenant_data'] = local_inscrit_data_retval['apprenant_data']
|
||||
|
||||
|
||||
|
||||
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) + " - ERRORRRR AT Line : " + str(exc_tb.tb_lineno))
|
||||
return False, "Impossible de récupérer la liste des inscrits"
|
||||
|
|
4584
Log/log_file.log
4584
Log/log_file.log
File diff suppressed because it is too large
Load Diff
|
@ -1386,6 +1386,58 @@ def GetAllValideSessionPartner_List(diction):
|
|||
|
||||
val['taux_remplissage'] = str(taux_remplissage)
|
||||
|
||||
"""
|
||||
29/05/2024 : On va aller recuperer le nombre de personnes inscrites sur des devis non envoyés et non validés.
|
||||
Ceci permet de connaitre le nombre potentiel d'inscription en attentes.
|
||||
|
||||
Regles : Cela concerne uniquement les devis envoyés aux clients et prospects mais non validé
|
||||
|
||||
"""
|
||||
|
||||
locl_find_qry = {
|
||||
'$and': [{'partner_owner_recid': str(my_partner['recid']), 'valide': '1', 'locked': '0',
|
||||
'order_header_type':'devis', 'is_validated':'0', 'date_envoi_quotation': { "$exists": True } }, {}, ]}
|
||||
|
||||
|
||||
local_new_myquery_find_order = [{'$match': locl_find_qry},
|
||||
{'$sort': {'_id': -1}},
|
||||
{"$addFields": {"partner_order_header_Id": {"$toString": "$_id"}}},
|
||||
{'$lookup':
|
||||
{
|
||||
'from': 'partner_order_line',
|
||||
'localField': "partner_order_header_Id",
|
||||
'foreignField': 'order_header_id',
|
||||
'pipeline': [
|
||||
{'$match':
|
||||
{'$and':
|
||||
[
|
||||
{'order_line_formation':str(retVal['class_internal_url'])},
|
||||
{'partner_owner_recid': str(my_partner['recid']),
|
||||
'order_line_session_id':str(retVal['_id'])},
|
||||
{'valide': '1'}]}}, ],
|
||||
'as': 'partner_order_line_collection'
|
||||
}
|
||||
},
|
||||
{
|
||||
'$unwind': '$partner_order_line_collection'
|
||||
}
|
||||
]
|
||||
total_qty = 0
|
||||
tab_quotation_ref = []
|
||||
|
||||
for local_New_retVal in MYSY_GV.dbname['partner_order_header'].aggregate(local_new_myquery_find_order):
|
||||
#print(" ### local_New_retVal = ", local_New_retVal)
|
||||
if( "partner_order_line_collection" in local_New_retVal.keys() ):
|
||||
if( "order_line_qty" in local_New_retVal['partner_order_line_collection'].keys() and
|
||||
len(str(local_New_retVal['date_envoi_quotation'])) > 5 ):
|
||||
total_qty = total_qty + mycommon.tryFloat(local_New_retVal['partner_order_line_collection']['order_line_qty'])
|
||||
tab_quotation_ref.append(str(local_New_retVal['order_header_ref_interne']))
|
||||
|
||||
#print(" ### total_qty = ", total_qty)
|
||||
#print(" ### tab_quotation_ref = ", tab_quotation_ref)
|
||||
|
||||
val['qty_in_quotation'] = str(total_qty)
|
||||
val['qty_in_quotation_list_quotation'] = ', '.join(tab_quotation_ref)
|
||||
|
||||
RetObject.append(mycommon.JSONEncoder().encode(val))
|
||||
|
||||
|
@ -1650,6 +1702,62 @@ def GetAllValideSessionPartner_List_filter_like(diction):
|
|||
|
||||
val['taux_remplissage'] = str(taux_remplissage)
|
||||
|
||||
"""
|
||||
29/05/2024 : On va aller recuperer le nombre de personnes inscrites sur des devis non envoyés et non validés.
|
||||
Ceci permet de connaitre le nombre potentiel d'inscription en attentes.
|
||||
|
||||
Regles : Cela concerne uniquement les devis envoyés aux clients et prospects mais non validé
|
||||
|
||||
"""
|
||||
|
||||
locl_find_qry = {
|
||||
'$and': [{'partner_owner_recid': str(my_partner['recid']), 'valide': '1', 'locked': '0',
|
||||
'order_header_type': 'devis', 'is_validated': '0',
|
||||
'date_envoi_quotation': {"$exists": True}}, {}, ]}
|
||||
|
||||
local_new_myquery_find_order = [{'$match': locl_find_qry},
|
||||
{'$sort': {'_id': -1}},
|
||||
{"$addFields": {"partner_order_header_Id": {"$toString": "$_id"}}},
|
||||
{'$lookup':
|
||||
{
|
||||
'from': 'partner_order_line',
|
||||
'localField': "partner_order_header_Id",
|
||||
'foreignField': 'order_header_id',
|
||||
'pipeline': [
|
||||
{'$match':
|
||||
{'$and':
|
||||
[
|
||||
{'order_line_formation': str(
|
||||
retVal['class_internal_url'])},
|
||||
{'partner_owner_recid': str(
|
||||
my_partner['recid']),
|
||||
'order_line_session_id': str(retVal['_id'])},
|
||||
{'valide': '1'}]}}, ],
|
||||
'as': 'partner_order_line_collection'
|
||||
}
|
||||
},
|
||||
{
|
||||
'$unwind': '$partner_order_line_collection'
|
||||
}
|
||||
]
|
||||
total_qty = 0
|
||||
tab_quotation_ref = []
|
||||
|
||||
for local_New_retVal in MYSY_GV.dbname['partner_order_header'].aggregate(local_new_myquery_find_order):
|
||||
# print(" ### local_New_retVal = ", local_New_retVal)
|
||||
if ("partner_order_line_collection" in local_New_retVal.keys()):
|
||||
if ("order_line_qty" in local_New_retVal['partner_order_line_collection'].keys() and
|
||||
len(str(local_New_retVal['date_envoi_quotation'])) > 5):
|
||||
total_qty = total_qty + mycommon.tryFloat(
|
||||
local_New_retVal['partner_order_line_collection']['order_line_qty'])
|
||||
tab_quotation_ref.append(str(local_New_retVal['order_header_ref_interne']))
|
||||
|
||||
# print(" ### total_qty = ", total_qty)
|
||||
# print(" ### tab_quotation_ref = ", tab_quotation_ref)
|
||||
|
||||
val['qty_in_quotation'] = str(total_qty)
|
||||
val['qty_in_quotation_list_quotation'] = ', '.join(tab_quotation_ref)
|
||||
|
||||
if (filt_session_start_date and filt_session_end_date):
|
||||
# Si on a un filtre sur la date debut et de fin de session
|
||||
if ((datetime.strptime(str(retVal['date_debut'][0:10]).strip(), '%d/%m/%Y') >= datetime.strptime(
|
||||
|
@ -1888,7 +1996,61 @@ def GetAllValideSessionPartner_List_no_filter(diction):
|
|||
|
||||
val['taux_remplissage'] = str(taux_remplissage)
|
||||
|
||||
"""
|
||||
29/05/2024 : On va aller recuperer le nombre de personnes inscrites sur des devis non envoyés et non validés.
|
||||
Ceci permet de connaitre le nombre potentiel d'inscription en attentes.
|
||||
|
||||
Regles : Cela concerne uniquement les devis envoyés aux clients et prospects mais non validé
|
||||
|
||||
"""
|
||||
|
||||
locl_find_qry = {
|
||||
'$and': [{'partner_owner_recid': str(my_partner['recid']), 'valide': '1', 'locked': '0',
|
||||
'order_header_type': 'devis', 'is_validated': '0',
|
||||
'date_envoi_quotation': {"$exists": True}}, {}, ]}
|
||||
|
||||
local_new_myquery_find_order = [{'$match': locl_find_qry},
|
||||
{'$sort': {'_id': -1}},
|
||||
{"$addFields": {"partner_order_header_Id": {"$toString": "$_id"}}},
|
||||
{'$lookup':
|
||||
{
|
||||
'from': 'partner_order_line',
|
||||
'localField': "partner_order_header_Id",
|
||||
'foreignField': 'order_header_id',
|
||||
'pipeline': [
|
||||
{'$match':
|
||||
{'$and':
|
||||
[
|
||||
{'order_line_formation': str(
|
||||
retVal['class_internal_url'])},
|
||||
{'partner_owner_recid': str(
|
||||
my_partner['recid']),
|
||||
'order_line_session_id': str(retVal['_id'])},
|
||||
{'valide': '1'}]}}, ],
|
||||
'as': 'partner_order_line_collection'
|
||||
}
|
||||
},
|
||||
{
|
||||
'$unwind': '$partner_order_line_collection'
|
||||
}
|
||||
]
|
||||
total_qty = 0
|
||||
tab_quotation_ref = []
|
||||
|
||||
for local_New_retVal in MYSY_GV.dbname['partner_order_header'].aggregate(local_new_myquery_find_order):
|
||||
# print(" ### local_New_retVal = ", local_New_retVal)
|
||||
if ("partner_order_line_collection" in local_New_retVal.keys()):
|
||||
if ("order_line_qty" in local_New_retVal['partner_order_line_collection'].keys() and
|
||||
len(str(local_New_retVal['date_envoi_quotation'])) > 5):
|
||||
total_qty = total_qty + mycommon.tryFloat(
|
||||
local_New_retVal['partner_order_line_collection']['order_line_qty'])
|
||||
tab_quotation_ref.append(str(local_New_retVal['order_header_ref_interne']))
|
||||
|
||||
# print(" ### total_qty = ", total_qty)
|
||||
# print(" ### tab_quotation_ref = ", tab_quotation_ref)
|
||||
|
||||
val['qty_in_quotation'] = str(total_qty)
|
||||
val['qty_in_quotation_list_quotation'] = ', '.join(tab_quotation_ref)
|
||||
|
||||
RetObject.append(mycommon.JSONEncoder().encode(val))
|
||||
|
||||
|
|
|
@ -3147,7 +3147,7 @@ def Get_Given_Partner_Order_Lines(diction):
|
|||
'localField': 'order_line_formation',
|
||||
'foreignField': 'internal_url',
|
||||
'pipeline': [{'$match': {'$and': [ filt_class_partner_recid]}},
|
||||
{'$project': {'title': 1, 'domaine': 1,
|
||||
{'$project': {'title': 1, 'domaine': 1, '_id':1,
|
||||
'duration': 1,
|
||||
'duration_unit': 1,'external_code':1}}],
|
||||
'as': 'myclass_collection'
|
||||
|
@ -3734,7 +3734,8 @@ def Get_List_Partner_Order_with_filter(diction):
|
|||
Verification des input acceptés. les filtres accepté sont :
|
||||
- ref_interne,
|
||||
"""
|
||||
field_list = ['token', 'date_cmd_debut', 'date_cmd_fin', 'client_nom', 'ref_interne', 'ref_externe', 'formation']
|
||||
field_list = ['token', 'date_cmd_debut', 'date_cmd_fin', 'client_nom', 'ref_interne', 'ref_externe',
|
||||
'formation', 'code_session']
|
||||
|
||||
incom_keys = diction.keys()
|
||||
for val in incom_keys:
|
||||
|
@ -3795,6 +3796,20 @@ def Get_List_Partner_Order_with_filter(diction):
|
|||
|
||||
filt_formation_external_code = {'order_line_formation': {'$in': Lists_partner_formation_internal_url }}
|
||||
|
||||
filt_code_session_id = {}
|
||||
sub_filt_code_session = {}
|
||||
Lists_partner_session_id = []
|
||||
if ("code_session" in diction.keys()):
|
||||
sub_filt_code_session = {'code_session': {'$regex': str(diction['code_session']), "$options": "i"},
|
||||
'partner_owner_recid': str(my_partner['recid']), 'valide': '1',}
|
||||
|
||||
# Recuperation des '_id' des formation dont le nom match en regexp
|
||||
print(" ### sub_filt_code_session = ", sub_filt_code_session)
|
||||
for Lists_partner_session_Data in MYSY_GV.dbname['session_formation'].find(sub_filt_code_session,
|
||||
{'_id': 1}):
|
||||
Lists_partner_session_id.append(str(Lists_partner_session_Data['_id']))
|
||||
|
||||
filt_code_session_id = {'order_line_session_id': {'$in': Lists_partner_session_id}}
|
||||
|
||||
|
||||
filt_ref_interne = {}
|
||||
|
@ -3818,7 +3833,8 @@ def Get_List_Partner_Order_with_filter(diction):
|
|||
'from': 'partner_order_line',
|
||||
'localField': "partner_order_header_Id",
|
||||
'foreignField': 'order_header_id',
|
||||
'pipeline': [{'$match': {'$and': [filt_formation_external_code, {
|
||||
'pipeline': [{'$match': {'$and': [filt_formation_external_code, filt_code_session_id,
|
||||
{
|
||||
'partner_owner_recid': str(my_partner['recid'])}, {'valide': '1'}]}}, ],
|
||||
'as': 'partner_order_line_collection'
|
||||
}
|
||||
|
|
|
@ -5789,4 +5789,100 @@ def Is_Ressource_Available(diction):
|
|||
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"
|
||||
return False, " Impossible de verifier la disponibilité de la ressource ", "0"
|
||||
|
||||
|
||||
"""
|
||||
30/05/2024 - Important :
|
||||
Une fois une inscription validée, certaines données comme (nom, prenom, email, etc (les données personnelles))
|
||||
sont basculer vers la collection 'apprenant', et l'information 'apprenant_id' est ajouté à l'insciption.
|
||||
|
||||
L'objectif de cette fonction est de :
|
||||
- prendre en entrée l'inscription_id et
|
||||
- retourne un json de ce type :
|
||||
return[incrit_data] = données de l'inscription
|
||||
return[apprenant_data] = données de l'apprenant
|
||||
|
||||
"""
|
||||
def Get_Inscrit_And_Apprenant_Data(diction):
|
||||
try:
|
||||
diction = strip_dictionary(diction)
|
||||
|
||||
"""
|
||||
Verification des input acceptés
|
||||
"""
|
||||
field_list = ['token', 'inscrit_id']
|
||||
|
||||
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",
|
||||
|
||||
"""
|
||||
Verification des champs obligatoires
|
||||
"""
|
||||
field_list_obligatoire = ['token', 'inscrit_id']
|
||||
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",
|
||||
|
||||
"""
|
||||
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
|
||||
|
||||
is_inscription_valide_count = MYSY_GV.dbname['inscription'].count_documents({'_id': ObjectId(str(diction['inscrit_id'])),
|
||||
'partner_owner_recid': str(
|
||||
my_partner['recid']),
|
||||
'valide': '1',
|
||||
'locked': '0'})
|
||||
|
||||
if( is_inscription_valide_count != 1):
|
||||
myprint(
|
||||
str(inspect.stack()[0][3]) + " L'identifiant de l'inscrit "+str(diction['inscrit_id'])+ " n'est pas valide ")
|
||||
return False, " L'identifiant de l'inscrit "+str(diction['inscrit_id'])+ " n'est pas valide ",
|
||||
|
||||
RetObject = {}
|
||||
val_tmp = 1
|
||||
for New_retVal in MYSY_GV.dbname['inscription'].find({'_id': ObjectId(str(diction['inscrit_id'])),
|
||||
'partner_owner_recid': str(
|
||||
my_partner['recid']),
|
||||
'valide': '1',
|
||||
'locked': '0'}):
|
||||
|
||||
RetObject['inscrit_data'] = New_retVal
|
||||
|
||||
|
||||
if( "apprenant_id" in New_retVal.keys() and New_retVal['apprenant_id']):
|
||||
apprenant_data = MYSY_GV.dbname['apprenant'].find_one({'_id': ObjectId(str(diction['apprenant_id'])),
|
||||
'partner_owner_recid': str(
|
||||
my_partner['recid']),
|
||||
'valide': '1',
|
||||
'locked': '0'})
|
||||
|
||||
if( apprenant_data and 'id' in apprenant_data.keys() ):
|
||||
RetObject['apprenant_data'] = apprenant_data
|
||||
else:
|
||||
RetObject['apprenant_data'] = {}
|
||||
|
||||
|
||||
|
||||
|
||||
return True, RetObject
|
||||
|
||||
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écupérer les données de l'inscrit "
|
|
@ -1297,7 +1297,16 @@ def Get_List_Ressource_Materielle_Affectation(diction):
|
|||
'valide': '1'})
|
||||
|
||||
if (affectation_target_data is not None):
|
||||
related_target_collection_id_nom = str(affectation_target_data["prenom"]+" "+affectation_target_data["nom"])
|
||||
prenom = ""
|
||||
nom = ""
|
||||
if( "prenom" in affectation_target_data.keys() ):
|
||||
prenom =affectation_target_data['prenom']
|
||||
|
||||
if ("nom" in affectation_target_data.keys()):
|
||||
nom = affectation_target_data['nom']
|
||||
|
||||
|
||||
related_target_collection_id_nom = str(prenom+" "+nom)
|
||||
related_target_collection_object = "Employe"
|
||||
|
||||
|
||||
|
@ -1933,7 +1942,7 @@ def Get_Related_Target_Materiel_Collection_Data(diction):
|
|||
|
||||
# Recuperation des données des employés
|
||||
for retval in MYSY_GV.dbname['ressource_humaine'].find({'partner_recid': str(partner_recid),
|
||||
'valide': '1'}, {'_id': 1, 'prenom': 1, 'nom':1}):
|
||||
'valide': '1', 'is_partner_admin_account':{ '$ne': '1' } }, {'_id': 1, 'prenom': 1, 'nom':1}):
|
||||
retval_data = {}
|
||||
retval_data['related_target_collection'] = "ressource_humaine"
|
||||
retval_data['related_target_collection_id'] = str(retval['_id'])
|
||||
|
|
Loading…
Reference in New Issue