diff --git a/.idea/workspace.xml b/.idea/workspace.xml index 7a90766..eaca9b1 100644 --- a/.idea/workspace.xml +++ b/.idea/workspace.xml @@ -3,12 +3,9 @@ - - - - + diff --git a/emargement.py b/emargement.py index 02c0cdf..b4a9730 100644 --- a/emargement.py +++ b/emargement.py @@ -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, diff --git a/main.py b/main.py index 918f6f9..cfab750 100644 --- a/main.py +++ b/main.py @@ -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) diff --git a/partners.py b/partners.py index 02dae7d..7de0a1a 100644 --- a/partners.py +++ b/partners.py @@ -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'}, diff --git a/prj_common.py b/prj_common.py index 69ac339..9a7c62e 100644 --- a/prj_common.py +++ b/prj_common.py @@ -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" \ No newline at end of file