[FIX] Small fix in answer recording

bzr revid: rim@openerp.com-20131218072004-jzo8ozonyxv9a0jw
This commit is contained in:
Richard Mathot (OpenERP)
2013-12-18 08:20:04 +01:00
parent 5bf9954eb5
commit b5de38f287
2 changed files with 9 additions and 0 deletions
+2
View File
@@ -205,6 +205,8 @@ class WebsiteSurvey(http.Controller):
answer_value = answer.value_number.__str__()
elif answer.answer_type == 'date':
answer_value = answer.value_date
elif answer.answer_type == 'suggestion':
answer_value = answer.value_suggested.id
# TODO mettre les QCM ici
if answer_value:
ret.update({answer_tag: answer_value})
+7
View File
@@ -962,6 +962,7 @@ class survey_user_input_line(osv.osv):
'question_id': question.id,
'page_id': question.page_id.id,
'survey_id': question.survey_id.id,
'skipped': False
}
if answer_tag in post and post[answer_tag].strip() != '':
vals.update({'answer_type': 'free_text', 'value_free_text': post[answer_tag]})
@@ -983,6 +984,7 @@ class survey_user_input_line(osv.osv):
'question_id': question.id,
'page_id': question.page_id.id,
'survey_id': question.survey_id.id,
'skipped': False
}
if answer_tag in post and post[answer_tag].strip() != '':
vals.update({'answer_type': 'text', 'value_text': post[answer_tag]})
@@ -1004,6 +1006,7 @@ class survey_user_input_line(osv.osv):
'question_id': question.id,
'page_id': question.page_id.id,
'survey_id': question.survey_id.id,
'skipped': False
}
if answer_tag in post and post[answer_tag].strip() != '':
vals.update({'answer_type': 'number', 'value_number': float(post[answer_tag])})
@@ -1025,6 +1028,7 @@ class survey_user_input_line(osv.osv):
'question_id': question.id,
'page_id': question.page_id.id,
'survey_id': question.survey_id.id,
'skipped': False
}
if answer_tag in post and post[answer_tag].strip() != '':
vals.update({'answer_type': 'date', 'value_date': post[answer_tag]})
@@ -1046,6 +1050,7 @@ class survey_user_input_line(osv.osv):
'question_id': question.id,
'page_id': question.page_id.id,
'survey_id': question.survey_id.id,
'skipped': False
}
if answer_tag in post and post[answer_tag].strip() != '':
vals.update({'answer_type': 'suggestion', 'value_suggested': post[answer_tag]})
@@ -1062,6 +1067,8 @@ class survey_user_input_line(osv.osv):
return True
# def save_line_multiple_choice:
def dict_keys_startswith(dictionary, string):
'''Returns a dictionary containing the elements of <dict> whose keys start
with <string>.