09/04/2024 - 15h19

master
cherif 2024-04-09 15:28:08 +02:00
parent 428b1c1953
commit e0bd128349
5 changed files with 1947 additions and 23 deletions

View File

@ -3,9 +3,10 @@
<component name="ChangeListManager">
<list default="true" id="c6d0259a-16e1-410d-91a1-830590ee2a08" name="Changes" comment="07/04/2024 - 19h19">
<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$/formulaire_mgt.py" beforeDir="false" afterPath="$PROJECT_DIR$/formulaire_mgt.py" afterDir="false" />
<change beforePath="$PROJECT_DIR$/ressources_humaines.py" beforeDir="false" afterPath="$PROJECT_DIR$/ressources_humaines.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" />

View File

@ -690,7 +690,7 @@ Formulaire : Type de question :
- note
- entier
"""
FORM_QUESTION_TYPE = ['qcm', 'text', 'note', 'entier', 'bool']
FORM_QUESTION_TYPE = ['qcm', 'text', 'note', 'entier', 'bool', 'checkbox']
"""

File diff suppressed because it is too large Load Diff

View File

@ -147,7 +147,7 @@ def Add_Update_Question_Formulaire(diction):
"""
Verification des input acceptés
"""
field_list = ['token', 'form_id', 'question_id', 'question', 'type', 'commentaire', 'list_choix', 'max_note', 'list_qcm' ]
field_list = ['token', 'form_id', 'question_id', 'question', 'type', 'commentaire', 'list_choix', 'max_note', 'list_qcm', 'list_case_cocher' ]
incom_keys = diction.keys()
for val in incom_keys:
@ -251,25 +251,48 @@ def Add_Update_Question_Formulaire(diction):
else:
new_data['max_note'] = ""
new_data['list_choix'] = []
tab_list_choix = []
if ("list_choix" in diction.keys() and str(diction['type']) == "qcm"):
if ("list_choix" in diction.keys()):
print(" diction[list_choix] = ", diction['list_choix'])
local_JSON = ast.literal_eval(diction['list_choix'])
for local_val in local_JSON :
for local_val in local_JSON:
print(" local_val ", local_val)
reponse_qcm = {}
if ("reponse" in local_val):
if( "reponse" in local_val):
reponse_qcm['reponse_qcm'] = local_val['reponse']
else:
reponse_qcm['reponse_qcm'] = ""
if ("value" in local_val):
reponse_qcm['value'] = local_val['value']
else:
reponse_qcm['value'] = ""
tab_list_choix.append(reponse_qcm)
if (len(tab_list_choix) > 0 and str(diction['type']) == "qcm"):
new_data['list_choix'] = tab_list_choix
tab_list_case_cocher = []
if ("list_case_cocher" in diction.keys() and str(diction['type']) == "checkbox"):
print(" diction[list_case_cocher] = ", diction['list_case_cocher'])
local_JSON = ast.literal_eval(diction['list_case_cocher'])
for local_val in local_JSON :
print(" local_val ", local_val)
reponse_checkbox = {}
if( "reponse" in local_val):
reponse_checkbox['reponse_checkbox'] = local_val['reponse']
else:
reponse_checkbox['reponse_checkbox'] = ""
tab_list_case_cocher.append(reponse_checkbox)
if(len(tab_list_case_cocher) > 0 and str(diction['type']) == "checkbox" ):
new_data['list_case_cocher'] = tab_list_case_cocher
new_data['list_choix'].append(reponse_qcm)
update = MYSY_GV.dbname['formulaire'].update_one({'partner_owner_recid': str(my_partner['recid']),
'valide': '1', 'locked': '0',
@ -320,8 +343,9 @@ def Add_Update_Question_Formulaire(diction):
else:
new_data['max_note'] = ""
new_data['list_choix'] = []
if ("list_choix" in diction.keys()):
tab_list_choix = []
if ("list_choix" in diction.keys() and str(diction['type']) == "qcm"):
print(" diction[list_choix] = ", diction['list_choix'])
local_JSON = ast.literal_eval(diction['list_choix'])
@ -334,8 +358,32 @@ def Add_Update_Question_Formulaire(diction):
else:
reponse_qcm['reponse_qcm'] = ""
tab_list_choix.append(reponse_qcm)
new_data['list_choix'].append(reponse_qcm)
if (len(tab_list_choix) > 0 and str(diction['type']) == "qcm"):
new_data['list_choix'] = tab_list_choix
tab_list_case_cocher = []
if ("list_case_cocher" in diction.keys() and str(diction['type']) == "checkbox"):
print(" diction[list_case_cocher] = ", diction['list_case_cocher'])
local_JSON = ast.literal_eval(diction['list_case_cocher'])
for local_val in local_JSON :
print(" local_val ", local_val)
reponse_checkbox = {}
if( "reponse" in local_val):
reponse_checkbox['reponse_checkbox'] = local_val['reponse']
else:
reponse_checkbox['reponse_checkbox'] = ""
tab_list_case_cocher.append(reponse_checkbox)
if(len(tab_list_case_cocher) > 0 and str(diction['type']) == "checkbox" ):
new_data['list_case_cocher'] = tab_list_case_cocher
update = MYSY_GV.dbname['formulaire'].update_one({'partner_owner_recid': str(my_partner['recid']),
'valide': '1', 'locked': '0',
@ -343,9 +391,8 @@ def Add_Update_Question_Formulaire(diction):
{
'$push': {
"list_questions": {
'$each': [new_data]
}
"list_questions": { '$each': [new_data] },
}
},

View File

@ -1212,15 +1212,18 @@ def Export_To_Excel_Survey_with_filter(diction):
question_num = 1
for user_response in Survey_Data['user_response']:
worksheet.write(0, column, "question_"+str(question_num))
question = ""
if ("question" in user_response.keys()):
question = str(user_response['question'])
worksheet.write(row, column, question)
#worksheet.write(0, column, question)
#worksheet.write(row, column, question)
column += 1
worksheet.write(0, column, "response_"+str(question_num))
#worksheet.write(0, column, "response_"+str(question_num))
worksheet.write(0, column, question)
response = ""
if ("response" in user_response.keys()):
response = str(user_response['response'])
@ -1231,8 +1234,8 @@ def Export_To_Excel_Survey_with_filter(diction):
else:
question = "---"
worksheet.write(row, column, question)
#question = "---"
#worksheet.write(row, column, question)
column += 1