01/12/2023 - 17h
parent
c75a756c11
commit
ea814d9aa7
|
@ -1,12 +1,13 @@
|
|||
<?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="24/11/2023 - 18h30">
|
||||
<list default="true" id="c6d0259a-16e1-410d-91a1-830590ee2a08" name="Changes" comment="30/11/2023 - 21h">
|
||||
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/Dashbord_queries/common_tdb_qries.py" beforeDir="false" afterPath="$PROJECT_DIR$/Dashbord_queries/common_tdb_qries.py" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/Dashbord_queries/session_tbd_qries.py" beforeDir="false" afterPath="$PROJECT_DIR$/Dashbord_queries/session_tbd_qries.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.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" />
|
||||
<change beforePath="$PROJECT_DIR$/prj_common.py" beforeDir="false" afterPath="$PROJECT_DIR$/prj_common.py" afterDir="false" />
|
||||
</list>
|
||||
<option name="SHOW_DIALOG" value="false" />
|
||||
<option name="HIGHLIGHT_CONFLICTS" value="true" />
|
||||
|
@ -76,13 +77,6 @@
|
|||
<option name="presentableId" value="Default" />
|
||||
<updated>1680804787304</updated>
|
||||
</task>
|
||||
<task id="LOCAL-00110" summary="25/09/2023 - 12h40">
|
||||
<created>1695638525925</created>
|
||||
<option name="number" value="00110" />
|
||||
<option name="presentableId" value="LOCAL-00110" />
|
||||
<option name="project" value="LOCAL" />
|
||||
<updated>1695638525925</updated>
|
||||
</task>
|
||||
<task id="LOCAL-00111" summary="25/09/2023 - 16h40">
|
||||
<created>1695652896870</created>
|
||||
<option name="number" value="00111" />
|
||||
|
@ -419,7 +413,14 @@
|
|||
<option name="project" value="LOCAL" />
|
||||
<updated>1700846519569</updated>
|
||||
</task>
|
||||
<option name="localTasksCounter" value="159" />
|
||||
<task id="LOCAL-00159" summary="30/11/2023 - 21h">
|
||||
<created>1701375202172</created>
|
||||
<option name="number" value="00159" />
|
||||
<option name="presentableId" value="LOCAL-00159" />
|
||||
<option name="project" value="LOCAL" />
|
||||
<updated>1701375202174</updated>
|
||||
</task>
|
||||
<option name="localTasksCounter" value="160" />
|
||||
<servers />
|
||||
</component>
|
||||
<component name="Vcs.Log.Tabs.Properties">
|
||||
|
@ -434,7 +435,6 @@
|
|||
</option>
|
||||
</component>
|
||||
<component name="VcsManagerConfiguration">
|
||||
<MESSAGE value="22/10/2023 - 12h" />
|
||||
<MESSAGE value="22/10/2023 - 18h00" />
|
||||
<MESSAGE value="22/10/2023 - 22h" />
|
||||
<MESSAGE value="23/10/2023 - 13h" />
|
||||
|
@ -459,6 +459,7 @@
|
|||
<MESSAGE value="23/11/23 - 13:30" />
|
||||
<MESSAGE value="23/11/2023 - 21h30" />
|
||||
<MESSAGE value="24/11/2023 - 18h30" />
|
||||
<option name="LAST_COMMIT_MESSAGE" value="24/11/2023 - 18h30" />
|
||||
<MESSAGE value="30/11/2023 - 21h" />
|
||||
<option name="LAST_COMMIT_MESSAGE" value="30/11/2023 - 21h" />
|
||||
</component>
|
||||
</project>
|
|
@ -1,12 +1,13 @@
|
|||
"""
|
||||
Ce fichier contient les requetes utilisées dans les tableaux de bord des session
|
||||
"""
|
||||
import dateutil
|
||||
import pymongo
|
||||
from pymongo import MongoClient
|
||||
import json
|
||||
from bson import ObjectId
|
||||
import re
|
||||
from datetime import datetime
|
||||
from datetime import datetime, timezone
|
||||
import prj_common as mycommon
|
||||
import secrets
|
||||
import inspect
|
||||
|
@ -21,6 +22,9 @@ from datetime import timedelta
|
|||
from datetime import timedelta
|
||||
|
||||
|
||||
"""
|
||||
Recuperation des sessions avec le taux de remplissage
|
||||
"""
|
||||
def Get_Qery_List_Session_Data(diction):
|
||||
try:
|
||||
diction = mycommon.strip_dictionary(diction)
|
||||
|
@ -172,3 +176,390 @@ def Get_Qery_List_Session_Data(diction):
|
|||
mycommon.myprint(str(inspect.stack()[0][3]) + " -" + str(e) + " - Line : " + str(exc_tb.tb_lineno))
|
||||
return False, " Impossible de récupérer les données "
|
||||
|
||||
|
||||
"""
|
||||
Recuperation des sessions par formateur sur une periode
|
||||
"""
|
||||
|
||||
def Get_Qery_Session_By_Trainer_By_Periode(diction):
|
||||
try:
|
||||
diction = mycommon.strip_dictionary(diction)
|
||||
|
||||
"""
|
||||
Verification des input acceptés
|
||||
"""
|
||||
field_list = ['token', 'session_start_date', 'session_end_date' ]
|
||||
|
||||
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 = ['token', 'session_start_date', 'session_end_date' ]
|
||||
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",
|
||||
|
||||
"""
|
||||
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 = mycommon.Check_Connexion_And_Return_Partner_Data(diction)
|
||||
if (local_status is not True):
|
||||
return local_status, my_partner
|
||||
|
||||
filt_session_start_date = ""
|
||||
if ("session_start_date" in diction.keys() and diction['session_start_date']):
|
||||
filt_session_start_date = str(diction['session_start_date'])[0:10]
|
||||
local_status = mycommon.CheckisDate(filt_session_start_date)
|
||||
if (local_status is False):
|
||||
mycommon.myprint(str(
|
||||
inspect.stack()[0][3]) + " Le filtre : 'date de debut de session' n'est pas au format jj/mm/aaaa.")
|
||||
return False, " Le filtre : 'date de debut de session' n'est pas au format jj/mm/aaaa."
|
||||
|
||||
filt_session_end_date = ""
|
||||
if ("session_end_date" in diction.keys() and diction['session_end_date']):
|
||||
filt_session_end_date = str(diction['session_end_date'])[0:10]
|
||||
local_status = mycommon.CheckisDate(filt_session_end_date)
|
||||
if (local_status is False):
|
||||
mycommon.myprint(str(
|
||||
inspect.stack()[0][3]) + " Le filtre : 'date de fin de session' n'est pas au format jj/mm/aaaa.")
|
||||
return False, " Le filtre : 'date de fin de session' n'est pas au format jj/mm/aaaa."
|
||||
|
||||
|
||||
|
||||
RetObject = []
|
||||
val_tmp = 1
|
||||
|
||||
filt_session_start_date_ISODATE = datetime.strptime(str(filt_session_start_date), '%d/%m/%Y')
|
||||
filt_session_end_date_ISODATE = datetime.strptime(str(filt_session_end_date), '%d/%m/%Y')
|
||||
|
||||
|
||||
|
||||
qery = [{'partner_owner_recid':str(my_partner['recid'])}, {'code_session':1, 'session_etape':1, 'class_internal_url':1, 'distantiel':1,
|
||||
'presentiel':1, 'nb_participant':1, 'formateur_id':1,
|
||||
'date_debut':1, 'date_fin':1}]
|
||||
|
||||
qery_match = {'$and': [ {"partner_owner_recid":str(my_partner['recid']) }, {"valide":'1'}, {"formateur_id": { "$exists": 'true' } }, { 'mysy_date_debut_session': { '$gte': filt_session_start_date_ISODATE, '$lte': filt_session_end_date_ISODATE } } , ]}
|
||||
|
||||
pipe_qry = ([
|
||||
{"$addFields": {
|
||||
"mysy_date_debut_session": {
|
||||
'$dateFromString': {
|
||||
'dateString': '$date_debut',
|
||||
'format': "%d/%m/%Y"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
{'$match': qery_match},
|
||||
{'$lookup': {
|
||||
'from': 'ressource_humaine',
|
||||
"let": {'formateur_id': "$formateur_id", 'partner_owner_recid': '$partner_owner_recid'},
|
||||
'pipeline': [
|
||||
{'$match':
|
||||
{'$expr':
|
||||
{'$and':
|
||||
[
|
||||
|
||||
{'$eq': ["$_id", {'$convert': {
|
||||
'input': "$$formateur_id",
|
||||
'to': "objectId",
|
||||
'onError': {'error': 'true'},
|
||||
'onNull': {'isnull': 'true'}
|
||||
}}]},
|
||||
|
||||
{'$eq': ["$valide", "1"]},
|
||||
{'$eq': ["$partner_recid", '$$partner_owner_recid']}
|
||||
|
||||
]
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
],
|
||||
'as': 'ressource_humaine'
|
||||
}
|
||||
},
|
||||
{'$group': {
|
||||
'_id': {
|
||||
"Formateur_id": "$formateur_id",
|
||||
"Formateur_nom": "$ressource_humaine.nom",
|
||||
"Formateur_prenom": "$ressource_humaine.prenom",
|
||||
"mois_session": {'$substr': ["$date_debut", 3, 2]},
|
||||
"annee_session": {'$substr': ["$date_debut", 6, 4]},
|
||||
},
|
||||
'count': {'$count': {}
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
'$sort': {'count': -1}
|
||||
},
|
||||
|
||||
])
|
||||
|
||||
|
||||
|
||||
print(" ### Get_Qery_Session_By_Trainer_By_Periode ici pipe_qry = ", pipe_qry)
|
||||
|
||||
|
||||
for retval in MYSY_GV.dbname['session_formation'].aggregate(pipe_qry):
|
||||
|
||||
user = {}
|
||||
user["Formateur_id"] = retval['_id']['Formateur_id']
|
||||
if( len(retval['_id']['Formateur_nom']) > 0 ):
|
||||
user["Formateur_nom"] = retval['_id']['Formateur_nom'][0]
|
||||
else:
|
||||
user["Formateur_nom"] = ""
|
||||
|
||||
if (len(retval['_id']['Formateur_nom']) > 0):
|
||||
user["Formateur_prenom"] = retval['_id']['Formateur_prenom'][0]
|
||||
else:
|
||||
user["Formateur_prenom"] = ""
|
||||
|
||||
user["mois_session"] = retval['_id']['mois_session']
|
||||
user["annee_session"] = retval['_id']['annee_session']
|
||||
user["nb"] = retval['count']
|
||||
|
||||
if( str(user["Formateur_nom"]).strip() == "" and str(user["Formateur_prenom"]).strip() == ""):
|
||||
user["Formateur_nom_prenom_mois_annee"] = str(user["annee_session"]) + "/" + str(user["mois_session"]) + " - Inconnu "
|
||||
else:
|
||||
user["Formateur_nom_prenom_mois_annee"] = str(user["annee_session"]) + "/" + str(
|
||||
user["mois_session"]) + " - " + str(user["Formateur_nom"]) + " " + str(user["Formateur_prenom"])
|
||||
|
||||
val_tmp = val_tmp + 1
|
||||
|
||||
RetObject.append(mycommon.JSONEncoder().encode(user))
|
||||
|
||||
#print(" #### RetObject = ", RetObject)
|
||||
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 les données "
|
||||
|
||||
|
||||
"""
|
||||
Repartition du pourcentage de session par formateur
|
||||
"""
|
||||
def Get_Qery_Session_Repartition_Session_By_Trainer_By_Periode(diction):
|
||||
try:
|
||||
diction = mycommon.strip_dictionary(diction)
|
||||
|
||||
"""
|
||||
Verification des input acceptés
|
||||
"""
|
||||
field_list = ['token', 'session_start_date', 'session_end_date' ]
|
||||
|
||||
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 = ['token', 'session_start_date', 'session_end_date' ]
|
||||
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",
|
||||
|
||||
"""
|
||||
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 = mycommon.Check_Connexion_And_Return_Partner_Data(diction)
|
||||
if (local_status is not True):
|
||||
return local_status, my_partner
|
||||
|
||||
filt_session_start_date = ""
|
||||
if ("session_start_date" in diction.keys() and diction['session_start_date']):
|
||||
filt_session_start_date = str(diction['session_start_date'])[0:10]
|
||||
local_status = mycommon.CheckisDate(filt_session_start_date)
|
||||
if (local_status is False):
|
||||
mycommon.myprint(str(
|
||||
inspect.stack()[0][3]) + " Le filtre : 'date de debut de session' n'est pas au format jj/mm/aaaa.")
|
||||
return False, " Le filtre : 'date de debut de session' n'est pas au format jj/mm/aaaa."
|
||||
|
||||
filt_session_end_date = ""
|
||||
if ("session_end_date" in diction.keys() and diction['session_end_date']):
|
||||
filt_session_end_date = str(diction['session_end_date'])[0:10]
|
||||
local_status = mycommon.CheckisDate(filt_session_end_date)
|
||||
if (local_status is False):
|
||||
mycommon.myprint(str(
|
||||
inspect.stack()[0][3]) + " Le filtre : 'date de fin de session' n'est pas au format jj/mm/aaaa.")
|
||||
return False, " Le filtre : 'date de fin de session' n'est pas au format jj/mm/aaaa."
|
||||
|
||||
|
||||
|
||||
RetObject = []
|
||||
val_tmp = 1
|
||||
|
||||
filt_session_start_date_ISODATE = datetime.strptime(str(filt_session_start_date), '%d/%m/%Y')
|
||||
filt_session_end_date_ISODATE = datetime.strptime(str(filt_session_end_date), '%d/%m/%Y')
|
||||
|
||||
|
||||
|
||||
qery_match = {'$and': [{"partner_owner_recid":str(my_partner['recid']) }, {"valide":'1'}, { 'mysy_date_debut_session': { '$gte': filt_session_start_date_ISODATE, '$lte': filt_session_end_date_ISODATE } } , ]}
|
||||
|
||||
# Recuperation du nombre total de session sur la periode
|
||||
pipe_qry_nb_record = ([
|
||||
{"$addFields": {
|
||||
"mysy_date_debut_session": {
|
||||
'$dateFromString': {
|
||||
'dateString': '$date_debut',
|
||||
'format': "%d/%m/%Y"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
{'$match': qery_match},
|
||||
|
||||
{'$group': {'_id': 'null', 'nb_record': {'$sum': 1}}},
|
||||
{'$project': {'_id': 0}}
|
||||
])
|
||||
|
||||
|
||||
|
||||
nb_total_session = 0
|
||||
Nb_Record_RetObject = []
|
||||
for retval in MYSY_GV.dbname['session_formation'].aggregate(pipe_qry_nb_record):
|
||||
|
||||
if( "nb_record" in retval.keys() and retval['nb_record']):
|
||||
nb_total_session = mycommon.tryInt(retval['nb_record'])
|
||||
|
||||
print(" #### nb_total_session = ",str(nb_total_session))
|
||||
if(nb_total_session == 0 ):
|
||||
mycommon.myprint(str(
|
||||
inspect.stack()[0][3]) + " Aucune session de formation valide ")
|
||||
return False, " Aucune session de formation valide "
|
||||
|
||||
pipe_qry = ([
|
||||
{"$addFields": {
|
||||
"mysy_date_debut_session": {
|
||||
'$dateFromString': {
|
||||
'dateString': '$date_debut',
|
||||
'format': "%d/%m/%Y"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
{'$match': qery_match},
|
||||
{'$lookup': {
|
||||
'from': 'ressource_humaine',
|
||||
"let": {'formateur_id': "$formateur_id", 'partner_owner_recid': '$partner_owner_recid'},
|
||||
'pipeline': [
|
||||
{'$match':
|
||||
{'$expr':
|
||||
{'$and':
|
||||
[
|
||||
|
||||
{'$eq': ["$_id", {'$convert': {
|
||||
'input': "$$formateur_id",
|
||||
'to': "objectId",
|
||||
'onError': {'error': 'true'},
|
||||
'onNull': {'isnull': 'true'}
|
||||
}}]},
|
||||
|
||||
{'$eq': ["$valide", "1"]},
|
||||
{'$eq': ["$partner_recid", '$$partner_owner_recid']}
|
||||
|
||||
]
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
],
|
||||
'as': 'ressource_humaine'
|
||||
}
|
||||
},
|
||||
{'$group': {
|
||||
'_id': {
|
||||
"Formateur_id": "$formateur_id",
|
||||
"Formateur_nom": "$ressource_humaine.nom",
|
||||
"Formateur_prenom": "$ressource_humaine.prenom",
|
||||
|
||||
},
|
||||
'count': {'$count': {}
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
'$sort': {'count': -1}
|
||||
},
|
||||
|
||||
])
|
||||
|
||||
|
||||
|
||||
print(" ### Get_Qery_Session_Repartition_Session_By_Trainer_By_Periode ici pipe_qry = ", pipe_qry)
|
||||
|
||||
|
||||
for retval in MYSY_GV.dbname['session_formation'].aggregate(pipe_qry):
|
||||
print(" ### retval = ", retval)
|
||||
if( "Formateur_id" in retval['_id'].keys() ):
|
||||
user = {}
|
||||
user["Formateur_id"] = retval['_id']['Formateur_id']
|
||||
if( len(retval['_id']['Formateur_nom']) > 0 ):
|
||||
user["Formateur_nom"] = retval['_id']['Formateur_nom'][0]
|
||||
else:
|
||||
user["Formateur_nom"] = ""
|
||||
|
||||
if (len(retval['_id']['Formateur_nom']) > 0):
|
||||
user["Formateur_prenom"] = retval['_id']['Formateur_prenom'][0]
|
||||
else:
|
||||
user["Formateur_prenom"] = ""
|
||||
|
||||
|
||||
user["nb"] = retval['count']
|
||||
|
||||
user["pourcentage"] = str(round(mycommon.tryInt( str(user["nb"] )) / nb_total_session, 2))
|
||||
|
||||
if( str(user["Formateur_nom"]).strip() == "" and str(user["Formateur_prenom"]).strip() == ""):
|
||||
user["Formateur_nom_prenom"] = "Inconnu "
|
||||
user["id"] = "Inconnu "
|
||||
else:
|
||||
user["Formateur_nom_prenom"] = str(user["Formateur_nom"]) + " " + str(user["Formateur_prenom"])
|
||||
user["id"] = str(user["Formateur_nom"]) + " " + str(user["Formateur_prenom"])
|
||||
|
||||
user["label"] = user["id"]
|
||||
user["value"] = retval['count']
|
||||
|
||||
val_tmp = val_tmp + 1
|
||||
|
||||
RetObject.append(mycommon.JSONEncoder().encode(user))
|
||||
|
||||
#print(" #### RetObject = ", RetObject)
|
||||
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 les données "
|
||||
|
|
2274
Log/log_file.log
2274
Log/log_file.log
File diff suppressed because it is too large
Load Diff
|
@ -930,13 +930,28 @@ def GetAllValideSessionPartner_List(diction):
|
|||
|
||||
val['distantiel'] = retVal['distantiel']
|
||||
|
||||
if( "formateur" in retVal.keys()):
|
||||
val['formateur'] = retVal['formateur']
|
||||
else:
|
||||
val['formateur'] = ""
|
||||
|
||||
if ("formateur_id" in retVal.keys()):
|
||||
if ("formateur_id" in retVal.keys() and retVal['formateur_id']):
|
||||
val['formateur_id'] = retVal['formateur_id']
|
||||
|
||||
|
||||
# On va aller chercher le nom et prenom du formateur
|
||||
fomateur_data = MYSY_GV.dbname['ressource_humaine'].find_one(
|
||||
{'_id': ObjectId(str(retVal['formateur_id'])),
|
||||
'valide': '1',
|
||||
'locked': '0',
|
||||
'partner_recid': str(my_partner['recid'])})
|
||||
if (fomateur_data is None):
|
||||
val['formateur'] = " Invalide"
|
||||
else:
|
||||
nom = ""
|
||||
prenom = ""
|
||||
if ("nom" in fomateur_data.keys()):
|
||||
nom = fomateur_data['nom']
|
||||
if ("prenom" in fomateur_data.keys()):
|
||||
prenom = fomateur_data['prenom']
|
||||
val['formateur'] = str(nom) + " " + str(prenom)
|
||||
|
||||
else:
|
||||
val['formateur_id'] = ""
|
||||
|
||||
|
@ -1147,13 +1162,27 @@ def GetAllValideSessionPartner_List_filter_like(diction):
|
|||
else:
|
||||
val['distantiel'] = "0"
|
||||
|
||||
if ("formateur" in retVal.keys()):
|
||||
val['formateur'] = retVal['formateur']
|
||||
else:
|
||||
val['formateur'] = ""
|
||||
|
||||
if ("formateur_id" in retVal.keys()):
|
||||
if ("formateur_id" in retVal.keys() and retVal['formateur_id']):
|
||||
val['formateur_id'] = retVal['formateur_id']
|
||||
|
||||
# On va aller chercher le nom et prenom du formateur
|
||||
fomateur_data = MYSY_GV.dbname['ressource_humaine'].find_one({'_id':ObjectId(str(retVal['formateur_id'])),
|
||||
'valide':'1',
|
||||
'locked':'0',
|
||||
'partner_recid':str(my_partner['recid'])})
|
||||
if( fomateur_data is None):
|
||||
val['formateur'] = " Invalide"
|
||||
else:
|
||||
nom = ""
|
||||
prenom = ""
|
||||
if( "nom" in fomateur_data.keys()):
|
||||
nom = fomateur_data['nom']
|
||||
if ("prenom" in fomateur_data.keys()):
|
||||
prenom = fomateur_data['prenom']
|
||||
val['formateur'] = str(nom)+" "+str(prenom)
|
||||
|
||||
|
||||
else:
|
||||
val['formateur_id'] = ""
|
||||
|
||||
|
@ -1360,13 +1389,26 @@ def GetAllValideSessionPartner_List_no_filter(diction):
|
|||
else:
|
||||
val['distantiel'] = "0"
|
||||
|
||||
if ("formateur" in retVal.keys()):
|
||||
val['formateur'] = retVal['formateur']
|
||||
else:
|
||||
val['formateur'] = ""
|
||||
|
||||
if ("formateur_id" in retVal.keys()):
|
||||
if ("formateur_id" in retVal.keys() and retVal['formateur_id']):
|
||||
val['formateur_id'] = retVal['formateur_id']
|
||||
|
||||
# On va aller chercher le nom et prenom du formateur
|
||||
fomateur_data = MYSY_GV.dbname['ressource_humaine'].find_one(
|
||||
{'_id': ObjectId(str(retVal['formateur_id'])),
|
||||
'valide': '1',
|
||||
'locked': '0',
|
||||
'partner_recid': str(my_partner['recid'])})
|
||||
if (fomateur_data is None):
|
||||
val['formateur'] = " Invalide"
|
||||
else:
|
||||
nom = ""
|
||||
prenom = ""
|
||||
if ("nom" in fomateur_data.keys()):
|
||||
nom = fomateur_data['nom']
|
||||
if ("prenom" in fomateur_data.keys()):
|
||||
prenom = fomateur_data['prenom']
|
||||
val['formateur'] = str(nom) + " " + str(prenom)
|
||||
else:
|
||||
val['formateur_id'] = ""
|
||||
|
||||
|
|
27
main.py
27
main.py
|
@ -5784,6 +5784,33 @@ def Get_Qery_List_Session_Data():
|
|||
return jsonify(status=status, message=retval)
|
||||
|
||||
|
||||
"""
|
||||
API / TBD / QRY : Recuperation des sessions par formateur sur une periode
|
||||
"""
|
||||
@app.route('/myclass/api/Get_Qery_Session_By_Trainer_By_Periode/', methods=['POST','GET'])
|
||||
@crossdomain(origin='*')
|
||||
def Get_Qery_Session_By_Trainer_By_Periode():
|
||||
# On recupere le corps (payload) de la requete
|
||||
payload = mycommon.strip_dictionary (request.form.to_dict())
|
||||
print(" ### Get_Qery_Session_By_Trainer_By_Periode payload = ",payload)
|
||||
status, retval = session_tbd_qries.Get_Qery_Session_By_Trainer_By_Periode(payload)
|
||||
return jsonify(status=status, message=retval)
|
||||
|
||||
|
||||
"""
|
||||
API / TBD / QRY : Repartition du pourcentage de session par formateur
|
||||
"""
|
||||
@app.route('/myclass/api/Get_Qery_Session_Repartition_Session_By_Trainer_By_Periode/', methods=['POST','GET'])
|
||||
@crossdomain(origin='*')
|
||||
def Get_Qery_Session_Repartition_Session_By_Trainer_By_Periode():
|
||||
# On recupere le corps (payload) de la requete
|
||||
payload = mycommon.strip_dictionary (request.form.to_dict())
|
||||
print(" ### Get_Qery_Session_Repartition_Session_By_Trainer_By_Periode payload = ",payload)
|
||||
status, retval = session_tbd_qries.Get_Qery_Session_Repartition_Session_By_Trainer_By_Periode(payload)
|
||||
return jsonify(status=status, message=retval)
|
||||
|
||||
|
||||
|
||||
"""
|
||||
Recuperation de liste des tableaux de bord d'un partenaire
|
||||
"""
|
||||
|
|
|
@ -8,7 +8,7 @@ from pymongo import MongoClient
|
|||
import pymongo
|
||||
from difflib import SequenceMatcher
|
||||
import textdistance
|
||||
from datetime import datetime
|
||||
from datetime import datetime, date
|
||||
import logging
|
||||
import secrets
|
||||
import base64
|
||||
|
@ -44,10 +44,13 @@ import mariadb
|
|||
from datetime import timedelta
|
||||
|
||||
class JSONEncoder(json.JSONEncoder):
|
||||
def default(self, o):
|
||||
if isinstance(o, ObjectId):
|
||||
return str(o)
|
||||
return json.JSONEncoder.default(self, o)
|
||||
def default(self, o):
|
||||
if ( isinstance(o, ObjectId)):
|
||||
return str(o)
|
||||
if ( isinstance(o, (datetime, date)) ):
|
||||
return o.isoformat()
|
||||
|
||||
return json.JSONEncoder.default(self, o)
|
||||
|
||||
def myprint(message = ""):
|
||||
logging.info(str(datetime.now()) + " : "+str(message) )
|
||||
|
|
Loading…
Reference in New Issue