master
parent
88b064e8c4
commit
62dd855456
|
@ -1,8 +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="26/06/2024 - 19h30">
|
||||
<list default="true" id="c6d0259a-16e1-410d-91a1-830590ee2a08" name="Changes" comment="ww">
|
||||
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" 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$/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" />
|
||||
<change beforePath="$PROJECT_DIR$/survey_mgt.py" beforeDir="false" afterPath="$PROJECT_DIR$/survey_mgt.py" afterDir="false" />
|
||||
</list>
|
||||
<option name="SHOW_DIALOG" value="false" />
|
||||
<option name="HIGHLIGHT_CONFLICTS" value="true" />
|
||||
|
@ -72,13 +77,6 @@
|
|||
<option name="presentableId" value="Default" />
|
||||
<updated>1680804787304</updated>
|
||||
</task>
|
||||
<task id="LOCAL-00292" summary="10/05/2024 - 18h30">
|
||||
<created>1715358191842</created>
|
||||
<option name="number" value="00292" />
|
||||
<option name="presentableId" value="LOCAL-00292" />
|
||||
<option name="project" value="LOCAL" />
|
||||
<updated>1715358191843</updated>
|
||||
</task>
|
||||
<task id="LOCAL-00293" summary="gdf">
|
||||
<created>1715422956048</created>
|
||||
<option name="number" value="00293" />
|
||||
|
@ -415,7 +413,14 @@
|
|||
<option name="project" value="LOCAL" />
|
||||
<updated>1719423411649</updated>
|
||||
</task>
|
||||
<option name="localTasksCounter" value="341" />
|
||||
<task id="LOCAL-00341" summary="ww">
|
||||
<created>1719519702779</created>
|
||||
<option name="number" value="00341" />
|
||||
<option name="presentableId" value="LOCAL-00341" />
|
||||
<option name="project" value="LOCAL" />
|
||||
<updated>1719519702780</updated>
|
||||
</task>
|
||||
<option name="localTasksCounter" value="342" />
|
||||
<servers />
|
||||
</component>
|
||||
<component name="Vcs.Log.Tabs.Properties">
|
||||
|
@ -457,7 +462,6 @@
|
|||
</option>
|
||||
</component>
|
||||
<component name="VcsManagerConfiguration">
|
||||
<MESSAGE value="sdsqq" />
|
||||
<MESSAGE value="gdfgdf" />
|
||||
<MESSAGE value="26/05/2024 - 20h30" />
|
||||
<MESSAGE value="qsdsqqsdsq" />
|
||||
|
@ -482,6 +486,7 @@
|
|||
<MESSAGE value="22/06/24 - 17h30" />
|
||||
<MESSAGE value="qsds" />
|
||||
<MESSAGE value="26/06/2024 - 19h30" />
|
||||
<option name="LAST_COMMIT_MESSAGE" value="26/06/2024 - 19h30" />
|
||||
<MESSAGE value="ww" />
|
||||
<option name="LAST_COMMIT_MESSAGE" value="ww" />
|
||||
</component>
|
||||
</project>
|
|
@ -687,8 +687,10 @@ Les types de formulaire
|
|||
- pos = Formulaire pour questionnaire de positionnement
|
||||
- hot_eval = Formulaire pour evaluation à chaud
|
||||
- cold_eval = Formulaire pour evaluation à froid
|
||||
- human_eval = Formulaire pour evaluation d'une ressource humaine
|
||||
- autre_eval = Formulaire pour d'autres evaluation non prevu plus haut
|
||||
"""
|
||||
FORM_TYPE = ['pos', 'hot_eval', 'cold_eval']
|
||||
FORM_TYPE = ['pos', 'hot_eval', 'cold_eval', 'human_eval', 'autre_eval']
|
||||
|
||||
|
||||
"""
|
||||
|
|
1570
Log/log_file.log
1570
Log/log_file.log
File diff suppressed because it is too large
Load Diff
19
main.py
19
main.py
|
@ -8736,6 +8736,25 @@ def Init_Survey_Tab_For_All_Session_Inscrit():
|
|||
return jsonify(status=status, message=retval)
|
||||
|
||||
|
||||
|
||||
|
||||
"""
|
||||
API pour initialiset (suppression et creation ) d'une enquete pour tous
|
||||
SAUF LES inscrits d'un session.
|
||||
algorithm :
|
||||
|
||||
"""
|
||||
@app.route('/myclass/api/Init_Survey_Tab_For_All_Except_Inscription/', methods=['POST','GET'])
|
||||
@crossdomain(origin='*')
|
||||
def Init_Survey_Tab_For_All_Except_Inscription():
|
||||
# On recupere le corps (payload) de la requete
|
||||
payload = mycommon.strip_dictionary (request.form.to_dict())
|
||||
print(" ### Init_Survey_Tab_For_All_Except_Inscription payload = ",payload)
|
||||
status, retval = survey_mgt.Init_Survey_Tab_For_All_Except_Inscription(payload)
|
||||
return jsonify(status=status, message=retval)
|
||||
|
||||
|
||||
|
||||
"""
|
||||
API pour recuperer la liste des survey avec des filtre sur
|
||||
- sesson_id,
|
||||
|
|
|
@ -4987,8 +4987,8 @@ def Get_Dictionnary_data_For_Template(diction):
|
|||
|
||||
json_formatted_str = json.dumps(dictionnary_data, indent=2)
|
||||
|
||||
print(" ### AFFICHAGE dU data dictionnary ")
|
||||
print(json_formatted_str)
|
||||
#print(" ### AFFICHAGE dU data dictionnary ")
|
||||
#print(json_formatted_str)
|
||||
|
||||
|
||||
return True, dictionnary_data
|
||||
|
|
429
survey_mgt.py
429
survey_mgt.py
|
@ -147,7 +147,7 @@ def Get_Given_Survey_Data_No_Token(diction):
|
|||
|
||||
RetObject.append(mycommon.JSONEncoder().encode(user))
|
||||
|
||||
#print(" ### RetObject = ", RetObject)
|
||||
print(" ### RetObject = ", RetObject)
|
||||
return True, RetObject
|
||||
|
||||
|
||||
|
@ -401,6 +401,13 @@ les inscrits d'un session.
|
|||
algorithm :
|
||||
On supprime tous enregistrements avec le clé :
|
||||
- session_id,
|
||||
|
||||
|
||||
28/06/2024: Pour permettre d'adresser une enquete à plusieurs objects,
|
||||
pas que les inscrits, (le cas de enseignants), on va rajouter
|
||||
- related_collection = collection concernée
|
||||
- related_collection_id = l'_id concernée dans la collection
|
||||
|
||||
"""
|
||||
def Init_Survey_Tab_For_All_Session_Inscrit(diction):
|
||||
try:
|
||||
|
@ -475,11 +482,7 @@ def Init_Survey_Tab_For_All_Session_Inscrit(diction):
|
|||
for my_inscription_id in tab_my_inscription_ids:
|
||||
# Recuperation des données de l'inscript
|
||||
|
||||
req = {'session_id': str(diction['session_id']),
|
||||
'_id':ObjectId(str(my_inscription_id)),
|
||||
'partner_owner_recid': str(my_partner['recid']),
|
||||
'valide': '1', 'status':'1'
|
||||
}
|
||||
|
||||
|
||||
|
||||
local_Insc_retval = MYSY_GV.dbname['inscription'].find_one({'session_id': str(diction['session_id']),
|
||||
|
@ -500,6 +503,9 @@ def Init_Survey_Tab_For_All_Session_Inscrit(diction):
|
|||
server_diction['survey_type'] = diction['survey_type']
|
||||
server_diction['sending_date'] = diction['sending_date']
|
||||
|
||||
server_diction['related_collection'] = "inscription"
|
||||
server_diction['related_collection_id'] = str(local_Insc_retval['_id'])
|
||||
|
||||
|
||||
local_status, local_retval = Create_One_Survey_To_Inscrit(server_diction)
|
||||
if( local_status is False):
|
||||
|
@ -516,6 +522,186 @@ def Init_Survey_Tab_For_All_Session_Inscrit(diction):
|
|||
|
||||
|
||||
|
||||
"""
|
||||
|
||||
/!\ à l'image de la fonction "Init_Survey_Tab_For_All_Session_Inscrit",
|
||||
cette fonction permet de créer une enquete pour un related_collection et une liste de related_collection_id
|
||||
données.
|
||||
"""
|
||||
def Init_Survey_Tab_For_All_Except_Inscription(diction):
|
||||
try:
|
||||
diction = mycommon.strip_dictionary(diction)
|
||||
|
||||
"""
|
||||
Verification des input acceptés
|
||||
"""
|
||||
field_list = ['session_id', 'token', 'formulaire_id', 'survey_type', 'sending_date',
|
||||
'related_collection', 'tab_related_collection_ids', 'class_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 accepté ")
|
||||
return False, " Les informations fournies sont incorrectes",
|
||||
|
||||
|
||||
field_list_obligatoire = ['token', 'formulaire_id', 'survey_type', 'related_collection', 'tab_related_collection_ids']
|
||||
|
||||
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"
|
||||
|
||||
my_token = ""
|
||||
if ("token" in diction.keys()):
|
||||
if diction['token']:
|
||||
my_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
|
||||
|
||||
"""
|
||||
si la session est dans le dictionnaire, Verifier que la session est valide
|
||||
"""
|
||||
session_id = ""
|
||||
|
||||
if( "session_id" in diction and diction['session_id'] ):
|
||||
is_valide_session = MYSY_GV.dbname['session_formation'].count_documents({'_id':ObjectId(str(diction['session_id'])),
|
||||
'valide':'1',
|
||||
'partner_owner_recid':str(my_partner['recid'])})
|
||||
|
||||
if( is_valide_session <= 0 ):
|
||||
mycommon.myprint(
|
||||
str(inspect.stack()[0][
|
||||
3]) + " L'identifiant de la session est invalide ")
|
||||
return False, " L'identifiant de la session est invalide "
|
||||
|
||||
session_id = str(diction['session_id'])
|
||||
|
||||
"""
|
||||
si la class_id est dans le dictionnaire, Verifier que la formation est valide
|
||||
"""
|
||||
class_id = ""
|
||||
if ("class_id" in diction and diction['class_id']):
|
||||
is_valide_class = MYSY_GV.dbname['class_id'].count_documents(
|
||||
{'_id': ObjectId(str(diction['class_id'])),
|
||||
'valide': '1',
|
||||
'partner_owner_recid': str(my_partner['recid'])})
|
||||
|
||||
if (is_valide_class <= 0):
|
||||
mycommon.myprint(
|
||||
str(inspect.stack()[0][
|
||||
3]) + " L'identifiant de la formation est invalide ")
|
||||
return False, " L'identifiant de la formation est invalide "
|
||||
|
||||
class_id = str(diction['class_id'])
|
||||
|
||||
|
||||
|
||||
tab_related_collection_ids = ""
|
||||
if ("tab_related_collection_ids" in diction.keys() and diction['tab_related_collection_ids']):
|
||||
tab_related_collection_ids = diction['tab_related_collection_ids']
|
||||
|
||||
tab_related_collection_ids_splited = str(tab_related_collection_ids).split(",")
|
||||
|
||||
"""
|
||||
Verifier la validité des tab_related_collection_ids_splited
|
||||
"""
|
||||
qry_partner_owner_recid = "partner_owner_recid"
|
||||
if( str(diction['related_collection']) == "ressource_humaine"):
|
||||
qry_partner_owner_recid = "partner_recid"
|
||||
|
||||
for tmp_val in tab_related_collection_ids_splited:
|
||||
is_tmp_val_valide = MYSY_GV.dbname[str(diction['related_collection'])].count_documents({'_id':ObjectId(str(tmp_val)), 'valide':'1', 'locked':'0',
|
||||
str(qry_partner_owner_recid):str(my_partner['recid'])})
|
||||
|
||||
if( is_tmp_val_valide != 1 ):
|
||||
mycommon.myprint(
|
||||
str(inspect.stack()[0][
|
||||
3]) + " L'identifiant de "+str(diction['related_collection']) +" est invalide ")
|
||||
return False, " L'identifiant de "+str(diction['related_collection']) +" est invalide "
|
||||
|
||||
|
||||
|
||||
"""
|
||||
Verifier la validité du formulaire
|
||||
"""
|
||||
is_valide_form = MYSY_GV.dbname['formulaire'].count_documents({'_id':ObjectId(str(diction['formulaire_id'])),
|
||||
'valide':'1',
|
||||
'locked':'0',
|
||||
'partner_owner_recid':str(my_partner['recid'])})
|
||||
|
||||
if( is_valide_form <= 0 ):
|
||||
mycommon.myprint(
|
||||
str(inspect.stack()[0][
|
||||
3]) + " L'identifiant du formulaire est invalide ")
|
||||
return False, " L'identifiant du formulaire est invalide "
|
||||
|
||||
|
||||
"""
|
||||
Les inscriptions etant toutes valides, on va proceder à
|
||||
1 - suppression des data existate et
|
||||
2 - la creation de l'enquete
|
||||
"""
|
||||
|
||||
for tmp_val in tab_related_collection_ids_splited:
|
||||
MYSY_GV.dbname['survey'].delete_many({'partner_owner_recid':str(my_partner['recid']),
|
||||
'related_collection':str(diction['related_collection']),
|
||||
'related_collection_id':str(tmp_val),
|
||||
'survey_type':str(diction['survey_type'])})
|
||||
|
||||
sending_date = ""
|
||||
if( "sending_date" in diction ):
|
||||
sending_date = diction['sending_date']
|
||||
|
||||
for tmp_val in tab_related_collection_ids_splited:
|
||||
# Recuperation des données de l'inscript
|
||||
|
||||
personne_data = MYSY_GV.dbname[str(diction['related_collection'])].find_one(
|
||||
{'_id': ObjectId(str(tmp_val)), 'valide': '1', 'locked': '0',
|
||||
str(qry_partner_owner_recid): str(my_partner['recid'])})
|
||||
|
||||
|
||||
|
||||
if(personne_data is None ):
|
||||
mycommon.myprint(str(inspect.stack()[0][3]) + " L'identifiant de l'inscrit est invalide ")
|
||||
return False, " L'identifiant de l'inscrit est invalide "
|
||||
|
||||
|
||||
|
||||
server_diction = {}
|
||||
server_diction['token'] = diction['token']
|
||||
server_diction['class_id'] = str(class_id)
|
||||
server_diction['session_id'] = str(session_id)
|
||||
server_diction['inscrit_id'] = ""
|
||||
server_diction['formulaire_id'] = diction['formulaire_id']
|
||||
server_diction['survey_type'] = diction['survey_type']
|
||||
server_diction['sending_date'] = sending_date
|
||||
|
||||
server_diction['related_collection'] = str(diction['related_collection'])
|
||||
server_diction['related_collection_id'] = str(tmp_val)
|
||||
|
||||
|
||||
local_status, local_retval = Create_One_Survey_To_Except_Inscrit(server_diction)
|
||||
if( local_status is False):
|
||||
return local_status, local_retval
|
||||
|
||||
print(" ### local_status = ", local_status)
|
||||
|
||||
return True, " La demande d'enquete a été créée "
|
||||
|
||||
|
||||
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 créer le formulaire "
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
"""
|
||||
|
@ -645,6 +831,147 @@ def Create_One_Survey_To_Inscrit(diction):
|
|||
|
||||
|
||||
|
||||
"""
|
||||
Cette fonction crée un formulaire pour tous EXCEPTE les inscrit
|
||||
"""
|
||||
def Create_One_Survey_To_Except_Inscrit(diction):
|
||||
try:
|
||||
field_list_obligatoire = ['session_id', 'token', 'related_collection', 'related_collection_id', 'formulaire_id', 'survey_type',
|
||||
'sending_date', 'class_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"
|
||||
|
||||
my_token = ""
|
||||
if ("token" in diction.keys()):
|
||||
if diction['token']:
|
||||
my_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
|
||||
|
||||
"""
|
||||
Recuperer les données du formulaire
|
||||
"""
|
||||
my_formulaire_data = MYSY_GV.dbname['formulaire'].find_one({'_id':ObjectId(str(diction['formulaire_id'])),
|
||||
'valide':'1',
|
||||
'locked':'0',
|
||||
'partner_owner_recid':str(my_partner['recid'])})
|
||||
|
||||
if( my_formulaire_data is None):
|
||||
mycommon.myprint(
|
||||
str(inspect.stack()[0][
|
||||
3]) + " L'identifiant du formulaire est invalide ")
|
||||
return False, " L'identifiant du formulaire est invalide "
|
||||
|
||||
"""
|
||||
Recuperation des données de la session
|
||||
"""
|
||||
if( diction['session_id'] ):
|
||||
my_session_data = MYSY_GV.dbname['session_formation'].find_one({'_id': ObjectId(str(diction['session_id'])),
|
||||
'valide': '1',
|
||||
'partner_owner_recid': str(my_partner['recid'])})
|
||||
|
||||
if (my_session_data is None):
|
||||
mycommon.myprint(
|
||||
str(inspect.stack()[0][
|
||||
3]) + " L'identifiant de la session est invalide ")
|
||||
return False, " L'identifiant de la session est invalide "
|
||||
|
||||
|
||||
|
||||
|
||||
"""
|
||||
Recuperation des données de la formation
|
||||
"""
|
||||
if (diction['class_id']):
|
||||
my_class_data = MYSY_GV.dbname['myclass'].find_one({'_id': ObjectId(str(diction['class_id'])),
|
||||
'valide': '1',
|
||||
'partner_owner_recid': str(
|
||||
my_partner['recid'])})
|
||||
|
||||
if (my_class_data is None):
|
||||
mycommon.myprint(
|
||||
str(inspect.stack()[0][
|
||||
3]) + " L'identifiant de la formation est invalide ")
|
||||
return False, " L'identifiant de la formation est invalide "
|
||||
|
||||
|
||||
"""
|
||||
Recuperer les données de l'inscrit
|
||||
"""
|
||||
qry_partner_owner_recid = "partner_owner_recid"
|
||||
if (str(diction['related_collection']) == "ressource_humaine"):
|
||||
qry_partner_owner_recid = "partner_recid"
|
||||
|
||||
|
||||
|
||||
my_inscrit_data = MYSY_GV.dbname[str(diction['related_collection'])].find_one({'_id': ObjectId(str(diction['related_collection_id'])),
|
||||
'valide': '1',
|
||||
'locked': '0',
|
||||
str(qry_partner_owner_recid): str(
|
||||
my_partner['recid'])})
|
||||
|
||||
if (my_inscrit_data is None):
|
||||
mycommon.myprint(
|
||||
str(inspect.stack()[0][
|
||||
3]) + " L'identifiant de l'inscrit est invalide ")
|
||||
return False, " L'identifiant de l'inscrit est invalide "
|
||||
|
||||
|
||||
|
||||
new_survey_data = {}
|
||||
new_survey_data['email'] = my_inscrit_data['email']
|
||||
new_survey_data['nom'] = my_inscrit_data['nom']
|
||||
new_survey_data['prenom'] = my_inscrit_data['prenom']
|
||||
new_survey_data['inscription_id'] = str(my_inscrit_data['_id'])
|
||||
new_survey_data['formulaire_id'] = str(diction['formulaire_id'])
|
||||
new_survey_data['partner_owner_recid'] = str(my_partner['recid'])
|
||||
new_survey_data['session_id'] = str(diction['session_id'])
|
||||
new_survey_data['class_id'] = str(diction['class_id'])
|
||||
new_survey_data['survey_type'] = str(diction['survey_type'])
|
||||
new_survey_data['date_envoi'] = ""
|
||||
new_survey_data['automatique_sending_request_date'] = str(diction['sending_date'])
|
||||
new_survey_data['automatique_traitement'] = "1"
|
||||
new_survey_data['automatique_traitement_done'] = "0"
|
||||
|
||||
new_survey_data['related_collection'] = diction['related_collection']
|
||||
new_survey_data['related_collection_id'] = diction['related_collection_id']
|
||||
|
||||
new_survey_data['locked'] = "0"
|
||||
new_survey_data['valide'] = "1"
|
||||
|
||||
new_survey_data['statut'] = "0"
|
||||
new_survey_data['type'] = "1"
|
||||
new_survey_data['date_update'] = str(datetime.now())
|
||||
new_survey_data['update_by'] = str(my_partner['_id'])
|
||||
new_survey_data['created_by'] = str(my_partner['_id'])
|
||||
|
||||
print(" ### new_survey_data = ", new_survey_data)
|
||||
inserted_id = MYSY_GV.dbname['survey'].insert_one(new_survey_data).inserted_id
|
||||
|
||||
print(" ### new_survey_data inserted_id = ", inserted_id)
|
||||
|
||||
if (not inserted_id):
|
||||
mycommon.myprint(" Impossible de créer l'enquete (2) ")
|
||||
return False, " Impossible de créer l'enquete (2) "
|
||||
|
||||
|
||||
return True, " L'enquete a été créée"
|
||||
|
||||
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 créer l'enquete unitaire "
|
||||
|
||||
|
||||
|
||||
|
||||
"""
|
||||
Cette fonction permet d'envoyer la demande d'enquete à la personne concerné
|
||||
/!\ : Cette fontion permet d'envoyer toutes les demande d'enquete, que soit :
|
||||
|
@ -773,6 +1100,12 @@ def Send_Survey_TabIds(diction):
|
|||
elif ( "survey_type" in local_survey_retval.keys() and local_survey_retval['survey_type'] == "cold_eval"):
|
||||
courrier_ref_interne = "EVAL_FORMATION"
|
||||
|
||||
elif ("survey_type" in local_survey_retval.keys() and local_survey_retval['survey_type'] == "human_eval"):
|
||||
courrier_ref_interne = "EVAL_RESSOURCE_HUMAINE"
|
||||
|
||||
elif ("survey_type" in local_survey_retval.keys() and local_survey_retval['survey_type'] == "autre_eval"):
|
||||
courrier_ref_interne = "EVAL_AUTRE"
|
||||
|
||||
else :
|
||||
mycommon.myprint(str(inspect.stack()[0][3]) + " Le type d'enquete est invalide ")
|
||||
return False, " Le type d'enquete est invalide "
|
||||
|
@ -945,6 +1278,12 @@ def Send_Survey_TabIds(diction):
|
|||
elif ("survey_type" in local_survey_retval.keys() and local_survey_retval['survey_type'] == "cold_eval"):
|
||||
courrier_ref_interne = "EVAL_FORMATION"
|
||||
|
||||
elif ("survey_type" in local_survey_retval.keys() and local_survey_retval['survey_type'] == "human_eval"):
|
||||
courrier_ref_interne = "EVAL_RESSOURCE_HUMAINE"
|
||||
|
||||
elif ("survey_type" in local_survey_retval.keys() and local_survey_retval['survey_type'] == "autre_eval"):
|
||||
courrier_ref_interne = "EVAL_AUTRE"
|
||||
|
||||
else:
|
||||
mycommon.myprint(str(inspect.stack()[0][3]) + " Le type d'enquete est invalide ")
|
||||
return False, " Le type d'enquete est invalide "
|
||||
|
@ -952,9 +1291,9 @@ def Send_Survey_TabIds(diction):
|
|||
"""
|
||||
Apres que l'envoie est fait, on va loguer le traitement dans la collection : courrier_template_tracking_history
|
||||
"""
|
||||
if( "inscription_id" in local_survey_retval.keys() ):
|
||||
if( "related_collection_id" in local_survey_retval.keys() and 'related_collection' in local_survey_retval.keys()):
|
||||
# Cette demande d'enquete concerne une inscription
|
||||
local_inscription_id = local_survey_retval['inscription_id']
|
||||
local_inscription_id = local_survey_retval['related_collection_id']
|
||||
|
||||
qry = {'_id': ObjectId(str(local_inscription_id)),
|
||||
'status': '1',
|
||||
|
@ -962,23 +1301,37 @@ def Send_Survey_TabIds(diction):
|
|||
|
||||
#print(" ### qry 010101 = ", qry)
|
||||
|
||||
inscription_data = MYSY_GV.dbname['inscription'].find_one({'_id': ObjectId(str(local_inscription_id)),
|
||||
'status': '1',
|
||||
'partner_owner_recid': str(my_partner['recid'])})
|
||||
print(" #### str(local_survey_retval['related_collection']) = ", str(local_survey_retval['related_collection']))
|
||||
|
||||
|
||||
partner_owner_recid = "partner_owner_recid"
|
||||
if( str(local_survey_retval['related_collection']) == "ressource_humaine"):
|
||||
partner_owner_recid = "partner_recid"
|
||||
|
||||
print(" #### str(local_survey_retval['related_collection']) = ",
|
||||
str(local_survey_retval['related_collection']))
|
||||
|
||||
print(" #### qry = ",
|
||||
{'_id': ObjectId(str(local_inscription_id)),
|
||||
'valide': '1',
|
||||
str(partner_owner_recid): str(my_partner['recid'])})
|
||||
|
||||
inscription_data = MYSY_GV.dbname[str(local_survey_retval['related_collection'])].find_one({'_id': ObjectId(str(local_inscription_id)),
|
||||
'valide': '1',
|
||||
str(partner_owner_recid): str(my_partner['recid'])})
|
||||
|
||||
|
||||
|
||||
if( inscription_data is None or "session_id" not in inscription_data.keys() ):
|
||||
mycommon.myprint(
|
||||
" WARNING : Impossible de logguer l'historique pour l'inscrit : " + str(local_inscription_id))
|
||||
|
||||
print(" inscription_data = ", inscription_data)
|
||||
|
||||
local_status, local_retval = module_editique.Editic_Log_History_Action_From_courrier_template_type_document_ref_interne(
|
||||
my_partner, str(courrier_ref_interne), str(inscription_data['session_id']), 'inscription',
|
||||
str(local_inscription_id),"")
|
||||
if (local_status is False):
|
||||
mycommon.myprint(
|
||||
" WARNING : Impossible de logguer l'historique pour l'inscrit (2) : " + str(local_inscription_id))
|
||||
if (inscription_data and "session_id" in inscription_data.keys() and inscription_data['session_id']):
|
||||
local_status, local_retval = module_editique.Editic_Log_History_Action_From_courrier_template_type_document_ref_interne(
|
||||
my_partner, str(courrier_ref_interne), str(inscription_data['session_id']), 'inscription',
|
||||
str(local_inscription_id),"")
|
||||
if (local_status is False):
|
||||
mycommon.myprint(
|
||||
" WARNING : Impossible de logguer l'historique pour l'inscrit (2) : " + str(local_inscription_id))
|
||||
|
||||
|
||||
|
||||
|
@ -1106,6 +1459,12 @@ def Automatic_Send_Survey_TabIds(diction):
|
|||
elif ("survey_type" in local_survey_retval.keys() and local_survey_retval['survey_type'] == "cold_eval"):
|
||||
courrier_ref_interne = "EVAL_FORMATION"
|
||||
|
||||
elif ("survey_type" in local_survey_retval.keys() and local_survey_retval['survey_type'] == "human_eval"):
|
||||
courrier_ref_interne = "EVAL_RESSOURCE_HUMAINE"
|
||||
|
||||
elif ("survey_type" in local_survey_retval.keys() and local_survey_retval['survey_type'] == "autre_eval"):
|
||||
courrier_ref_interne = "EVAL_AUTRE"
|
||||
|
||||
else :
|
||||
mycommon.myprint(str(inspect.stack()[0][3]) + " Le type d'enquete est invalide ")
|
||||
return False, " Le type d'enquete est invalide "
|
||||
|
@ -1278,6 +1637,12 @@ def Automatic_Send_Survey_TabIds(diction):
|
|||
elif ("survey_type" in result.keys() and result['survey_type'] == "cold_eval"):
|
||||
courrier_ref_interne = "EVAL_FORMATION"
|
||||
|
||||
elif ("survey_type" in local_survey_retval.keys() and local_survey_retval['survey_type'] == "human_eval"):
|
||||
courrier_ref_interne = "EVAL_RESSOURCE_HUMAINE"
|
||||
|
||||
elif ("survey_type" in local_survey_retval.keys() and local_survey_retval['survey_type'] == "autre_eval"):
|
||||
courrier_ref_interne = "EVAL_AUTRE"
|
||||
|
||||
else:
|
||||
mycommon.myprint(str(inspect.stack()[0][3]) + " Le type d'enquete est invalide ")
|
||||
return False, " Le type d'enquete est invalide "
|
||||
|
@ -1330,7 +1695,7 @@ def Automatic_Send_Survey_TabIds(diction):
|
|||
"""
|
||||
Fonction pour Recuperer la liste des enquete avec les filtre suivant :
|
||||
- session_id,
|
||||
- formulaire_type - ['pos', 'hot_eval', 'cold_eval']
|
||||
- formulaire_type - ['pos', 'hot_eval', 'cold_eval', 'human_eval', 'autre_eval']
|
||||
|
||||
|
||||
"""
|
||||
|
@ -1341,7 +1706,7 @@ def Get_List_Survey_with_filter(diction):
|
|||
"""
|
||||
Verification des input acceptés
|
||||
"""
|
||||
field_list = ['token', 'session_id', 'formulaire_type' ]
|
||||
field_list = ['token', 'session_id', 'formulaire_type', 'related_collection', 'related_collection_id' ]
|
||||
|
||||
incom_keys = diction.keys()
|
||||
for val in incom_keys:
|
||||
|
@ -1379,13 +1744,20 @@ def Get_List_Survey_with_filter(diction):
|
|||
if ("session_id" in diction.keys()):
|
||||
filt_session_id = {'session_id': str(diction['session_id'])}
|
||||
|
||||
filt_related_collection = {}
|
||||
if ("related_collection" in diction.keys()):
|
||||
filt_related_collection = {'related_collection': str(diction['related_collection'])}
|
||||
|
||||
filt_related_collection_id = {}
|
||||
if ("related_collection_id" in diction.keys()):
|
||||
related_collection_id = {'related_collection_id': str(diction['related_collection_id'])}
|
||||
|
||||
|
||||
RetObject = []
|
||||
val_tmp = 0
|
||||
|
||||
qry = {"partner_owner_recid": str(my_partner['recid']), 'valide': '1', 'locked': '0'}
|
||||
query_with_filter = {'$and': [qry, filt_session_id]}
|
||||
query_with_filter = {'$and': [qry, filt_session_id, filt_related_collection, filt_related_collection_id]}
|
||||
|
||||
pipe_qry = ([
|
||||
{'$match': query_with_filter },
|
||||
|
@ -1454,7 +1826,7 @@ def Export_To_Excel_Survey_with_filter(diction):
|
|||
"""
|
||||
Verification des input acceptés
|
||||
"""
|
||||
field_list = ['token', 'session_id', 'formulaire_type' ]
|
||||
field_list = ['token', 'session_id', 'formulaire_type' , 'related_collection', 'related_collection_id' ]
|
||||
|
||||
incom_keys = diction.keys()
|
||||
for val in incom_keys:
|
||||
|
@ -1492,6 +1864,13 @@ def Export_To_Excel_Survey_with_filter(diction):
|
|||
if ("session_id" in diction.keys()):
|
||||
filt_session_id = {'session_id': str(diction['session_id'])}
|
||||
|
||||
filt_related_collection = {}
|
||||
if ("related_collection" in diction.keys()):
|
||||
filt_related_collection = {'related_collection': str(diction['related_collection'])}
|
||||
|
||||
filt_related_collection_id = {}
|
||||
if ("related_collection_id" in diction.keys()):
|
||||
related_collection_id = {'related_collection_id': str(diction['related_collection_id'])}
|
||||
|
||||
"""
|
||||
Recuperer les données de la session
|
||||
|
@ -1523,7 +1902,7 @@ def Export_To_Excel_Survey_with_filter(diction):
|
|||
val_tmp = 0
|
||||
|
||||
qry = {"partner_owner_recid": str(my_partner['recid']), 'valide': '1', 'locked': '0'}
|
||||
query_with_filter = {'$and': [qry, filt_session_id]}
|
||||
query_with_filter = {'$and': [qry, filt_session_id, filt_related_collection, filt_related_collection_id]}
|
||||
|
||||
pipe_qry = ([
|
||||
{'$match': query_with_filter },
|
||||
|
|
Loading…
Reference in New Issue