15/12/2022 - 22h00

master
cherif 2022-12-15 22:21:42 +01:00
parent 7c9d2f0a0f
commit c010387c6e
5 changed files with 91 additions and 6 deletions

View File

@ -3,12 +3,9 @@
<component name="ChangeListManager">
<list default="true" id="1122d9e2-679f-46d6-8c4f-97e9ae4041b5" name="Changes" comment="26/11/22 - 23h30">
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
<change beforePath="$PROJECT_DIR$/Emargement/test_emargement.pdf" beforeDir="false" afterPath="$PROJECT_DIR$/Emargement/test_emargement.pdf" 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$/class_mgt.py" beforeDir="false" afterPath="$PROJECT_DIR$/class_mgt.py" afterDir="false" />
<change beforePath="$PROJECT_DIR$/data_indexees.csv" beforeDir="false" afterPath="$PROJECT_DIR$/data_indexees.csv" afterDir="false" />
<change beforePath="$PROJECT_DIR$/ela_output_test_file_pandas_2.txt" beforeDir="false" afterPath="$PROJECT_DIR$/ela_output_test_file_pandas_2.txt" afterDir="false" />
<change beforePath="$PROJECT_DIR$/emargement.py" beforeDir="false" afterPath="$PROJECT_DIR$/emargement.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$/prj_common.py" beforeDir="false" afterPath="$PROJECT_DIR$/prj_common.py" afterDir="false" />
</list>

View File

@ -166,7 +166,7 @@ def CreateTableauEmargement(diction):
new_my_local_data['matin'] = False
new_my_local_data['apresmidi'] = False
print("### emargement insertion de : "+str(new_my_local_data))
#print("### emargement insertion de : "+str(new_my_local_data))
local_ret_val = coll_emargement.find_one_and_update(
query_key,

14
main.py
View File

@ -2119,6 +2119,20 @@ def Add_Update_SessionFormation_mass():
return jsonify(status=localStatus, message=message)
"""
API de recuperation des infos detaillées d'un stagiaire pour une session
"""
@app.route('/myclass/api/GetAttendeeDetail_perSession/', methods=['POST','GET'])
@crossdomain(origin='*')
def GetAttendeeDetail_perSession():
# On recupere le corps (payload) de la requete
payload = request.form.to_dict()
print(" ### GetAttendeeDetail_perSession : payload = ",str(payload))
localStatus, message= mycommon.GetAttendeeDetail_perSession(payload)
return jsonify(status=localStatus, message=message )
if __name__ == '__main__':
print(" debut api")
context = SSL.Context(SSL.SSLv23_METHOD)

View File

@ -995,6 +995,7 @@ def partner_login(diction):
#print(" GRRRRRRRRRRRRRRRRRRR "+str(ret_val))
partner_key_secrete_key = str(ret_val['token'])
mydata['recid'] = str(ret_val['recid'])
mydata['token'] = str(ret_val['token'])
token_collection = MYSY_GV.dbname['partner_token']
ret_val2 = token_collection.find_one_and_update({'recid': str(mydata['recid']), 'valide': '1', 'locked':'0'},

View File

@ -1604,12 +1604,13 @@ def getRecodedImage(diction=None):
'''
Verification de la validité du token et recuperation du recid du user
'''
retval = check_user_validity("", str(mytoken))
if retval is False:
myprint(str(inspect.stack()[0][3]) + " - Le token n'est pas valide ")
return False, "L'email ou le token ne sont pas valident"
'''
# Recuperation du recid de la personne
if( mytype == "user"):
@ -2476,3 +2477,75 @@ def CreateTrainingSession_id(diction):
exc_type, exc_obj, exc_tb = sys.exc_info()
print(str(inspect.stack()[0][3]) + " -" + str(e) + " - ERRORRRR AT Line : " + str(exc_tb.tb_lineno))
return False, False
"""
Cette fonction prend un email, et une session de formation
puis retourne toutes les informations relatif au couple (personne / session formation)
"""
def GetAttendeeDetail_perSession(diction):
try:
field_list_obligatoire = ['session_id', 'token', 'attendee_email']
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, " Impossible de recuperer les informations detaillées"
my_token = ""
if ("token" in diction.keys()):
if diction['token']:
my_token = diction['token']
# Recuperation du recid du partenaire
partner_recid = get_parnter_recid_from_token(str(my_token))
if partner_recid is False:
myprint(str(inspect.stack()[0][3]) + " - Impossible de recuperer le recid du partenaire")
return False, " Les informations d'identification sont invalides"
RetObject = []
# Recuperation des infos de la formation
local_Insc_retval = MYSY_GV.dbname['inscription'].find_one({'session_id':str(diction['session_id']),
'email':str(diction['attendee_email'])})
my_retrun_dict = {}
my_retrun_dict['session_id'] = local_Insc_retval['session_id']
my_retrun_dict['date_du'] = local_Insc_retval['date_du']
my_retrun_dict['date_au'] = local_Insc_retval['date_au']
my_retrun_dict['ville'] = local_Insc_retval['ville']
my_retrun_dict['code_postal'] = local_Insc_retval['code_postal']
my_retrun_dict['adresse'] = local_Insc_retval['adresse']
my_retrun_dict['nom'] = local_Insc_retval['nom']
my_retrun_dict['prenom'] = local_Insc_retval['prenom']
my_retrun_dict['employeur'] = local_Insc_retval['employeur']
my_retrun_dict['telephone'] = local_Insc_retval['telephone']
my_retrun_dict['email'] = local_Insc_retval['email']
my_retrun_dict['modefinancement'] = local_Insc_retval['modefinancement']
my_retrun_dict['opco'] = local_Insc_retval['opco']
my_retrun_dict['class_internal_url'] = local_Insc_retval['class_internal_url']
my_retrun_dict['status'] = local_Insc_retval['status']
my_retrun_dict['price'] = local_Insc_retval['price']
my_retrun_dict['inscription_validation_date'] = local_Insc_retval['inscription_validation_date']
v = local_Insc_retval['_id'].generation_time
my_retrun_dict['created_date'] = str(v.strftime("%d/%m/%Y"))
# Recuperation des infotrmations de la formation
local_formation = MYSY_GV.dbname['myclass'].find_one({'internal_url':str(local_Insc_retval['class_internal_url'])})
my_retrun_dict['class_title'] = local_formation['title']
RetObject.append(JSONEncoder().encode(my_retrun_dict))
return True, RetObject
except Exception as e:
exc_type, exc_obj, exc_tb = sys.exc_info()
print(str(inspect.stack()[0][3]) + " -" + str(e) + " - ERRORRRR AT Line : " + str(exc_tb.tb_lineno))
return False, " Impossible de recuperer les informations detaillées"