Mobile Site 1.0 - Saving data in a Mixed question (Support #3449)
Description
When looking in "View respondent answers for printing" for questionnaire ID="1242" (questionnaire name ="MixedQuestions"),
for most respondent I don’t see data in the first question and only for some respondent I see data in the second question
Can you check to see if the data that you get from mobile site is in the format that you need
and if not please post it here and tell Nadav what he needs to change
History
Updated by Eugene Nechaev almost 2 years ago
Of course system will not save so strange data
Example:
This is question description from API:
{"id":"4","result":
{"code":"8002","question":
{"q":
{
"num":"1","id":"63941","text":"Close Mixed Question","multi":false,"qtype":"3","open_type":"1",
"answers":[
{"num":1,"text":"1","a_id":378515,"answered":0},
{"num":2,"text":"2","a_id":378516,"answered":0},
{"num":3,"text":"3","a_id":378517,"answered":0},
{"num":4,"text":"4","a_id":378518,"answered":0},
{"num":5,"text":"5","a_id":378519,"answered":0},
{"num":6,"text":"","a_id":378520,"answered":0,"label":"Other"}
]
},"type":"11"
},"currentIndex":1
}
}
This is veri interesting "answer" from mobile site:
/survey_engine/se_sabi.php?&sabi_id=5&
sabi_type=11&
h_questiontypeid={"63941":"3"}&
h_questionid={"63941":"63941"}&
currentIndex=1&
h_ismulti={"63941":"0"}&
answers_id={"63941":{"1":"378515""2":"378516""3":"378517""4":"378518""5":"378519""6":"378520"}}&
sabi_sid=8bef7c42a61e591c386e387611516c21&sabi_ac=next&openanswer={"63941":""}&answers={"63941":"1"}
Please fix next:
1. & must not be first simbol in request. Part "se_sabi.php?&sabi_id=5&" is incorrect by any standarts! Must be se_sabi.php?sabi_id=5&"
2. When you use JSON you must use "," for separate list of elements!
answers_id={"63941":{"1":"378515""2":"378516""3":"378517""4":"378518""5":"378519""6":"378520"}}& - is not list! This is something very strange. Must be
answers_id={"63941":{"1":"378515","2":"378516","3":"378517","4":"378518","5":"378519","6":"378520"}}&
- Assignee changed from Eugene Nechaev to Nadav Avidan
- Status changed from Assigned to Feedback
Updated by Eugene Nechaev almost 2 years ago
One more updates for Mix Multi List question:
When answered with "open" answer mobile site sent incorrect string. Example for Q2:
API response with question description:
2012-09-27 11:39:14 - {"id":"5","result":{"code":"8002","question":{"q":{"num":"2","id":"63942","text":"Mixed Multi list","multi":true,"qtype":"3","open_type":"1","answers":[{"num":1,"text":"1","a_id":378521,"answered":0},{"num":2,"text":"2","a_id":378522,"answered":0},{"num":3,"text":"3","a_id":378523,"answered":0},{"num":4,"text":"4","a_id":378524,"answered":0},{"num":5,"text":"5","a_id":378525,"answered":0},{"num":6,"text":"","a_id":378526,"answered":0,"label":"Other"}]},"type":"12"},"currentIndex":2}}
We can see that type=12 (Mix Multi List)
Request for "Next and save" from mobile site:
/survey_engine/se_sabi.php?&sabi_id=6&sabi_type=12&h_questiontypeid={"63942":"3"}&h_questionid={"63942":"63942"}¤tIndex=2&h_ismulti={"63942":"1"}&sabi_sid=4b156f5d0429e24853a3bd26911db936&sabi_ac=next&openanswer={"63942":{"6":"test test test"}}&answers={"63942":{"":""}}
again:
1. remove "&" from leading of parameters list
2. see that answers={"63942":{"":""}} - It is incorrect. In API description present format and example:
Correct format from description of type=12
Link: /survey_engine/se_sabi.php
Parameters:
sabi_ac=next
&sabi_type="12"
&sabi_sid=SESSION_ID
&h_questionid={QUESTION_ID:QUESTION_ID}
&openanswer={QUESTION_ID:{OPEN_ANSWER_NUM:ENTERED_OPEN_ANSWER_TEXT}},
&answers={QUESTION_ID:{ANSWERED_NUM:ANSWERED_ID,...}
&h_ismulti={QUESTION_ID:"1"}
¤tIndex=INDEX_OF_CURRENT_QUESTION
&h_questiontypeid={QUESTION_ID:"3"}
&sabi_id=UNIQUE_REQUEST_ID
Example for 2 selected answers, regular number 2 and open number 5
sabi_ac=next&h_questiontypeid={"60045":"3"}&sabi_sid=a30e34788df26a38a44471baa1248d2f&h_questionid={"60045":"60045"}&openanswer={"60045":{"5":"answer other 9"}}&h_ismulti={"60045":"1"}¤tIndex=9&answers={"60045":{"2":"358774","5":"358777"}}&sabi_type=12&sabi_id=48
Updated by Nadav Avidan almost 2 years ago
Example for 3 answers 2 closed and one open. seem like a correct request:
sabi_id=6&sabi_type=12
&h_questiontypeid={"63942":"3"}
&h_questionid={"63942":"63942"}
¤tIndex=2&h_ismulti={"63942":"1"}
&sabi_sid=7181091092d312dc32cb7980418df983&sabi_ac=next
&openanswer={"63942":{"6":"NADAV"}}
&answers={"63942":{"2":"378522","4":"378524"}}
- Assignee changed from Nadav Avidan to Shlomi Lanton
- Status changed from Feedback to Resolved
Updated by Eugene Nechaev almost 2 years ago
Yes, answer to Q2 is correct, but answer to Q1 is incorrect.
/survey_engine/se_sabi.php?&sabi_id=5&sabi_type=11&h_questiontypeid={"63941":"3"}&h_questionid={"63941":"63941"}¤tIndex=1&h_ismulti={"63941":"0"}&answers_id={"63941":{"1":"378515","2":"378516","3":"378517","4":"378518","5":"378519","6":"378520"}}&sabi_sid=b54a6a9bacfd28e7b061bf1462790dab&sabi_ac=next&openanswer={"63941":{"378520":"other_answer 1"},}&answers={"63941":"378520"}&openanswer={"63941":""}&answers={"63941":"6"}
1. 2 times &openanswer=""
2. Incorrect format for first &openanswer={"63941":{"378520":"other_answer 1"},}
redundant "coma"
answer_id instead of answer_num. Must be
....
&openanswer={QUESTION_ID:{OPEN_ANSWER_NUM:ENTERED_OPEN_ANSWER_TEXT}},
...
&openanswer={"63941":{"6":"other_answer 1"}}
I explained that all information gathered and saved to database after last question. If part of has incorrect data it could corrupt part of SQL. Like now
I’ll try to make example of exactly this problem code tomorrow.
- Status changed from Resolved to Feedback
Updated by Eugene Nechaev almost 2 years ago
I mistaked. Answer to Q2 is not corect too. See please:
/survey_engine/se_sabi.php?sabi_id=6&sabi_type=12&h_questiontypeid={"63942":"3"}&h_questionid={"63942":"63942"}¤tIndex=2&h_ismulti={"63942":"1"}&sabi_sid=b54a6a9bacfd28e7b061bf1462790dab&sabi_ac=next&openanswer={"63942":{"6":"Other_answer_2"}}&answers={"63942":{"2":"378522","4":"378524"}}
We interested part: &answers={"63942":{"2":"378522","4":"378524"}}
You said system that answered only 2 and 4. Need to say about answer 6 too.
Correct string will be answers={"63942":{"2":"378522","4":"378524","6":"378526"}}
and full correct POST is:
/survey_engine/se_sabi.php?sabi_id=6&sabi_type=12&h_questiontypeid={"63942":"3"}&h_questionid={"63942":"63942"}¤tIndex=2&h_ismulti={"63942":"1"}&sabi_sid=b54a6a9bacfd28e7b061bf1462790dab&sabi_ac=next&openanswer={"63942":{"6":"Other_answer_2"}}&answers={"63942":{"2":"378522","4":"378524","6":"378526"}}
This is for Mix Multi list with open answer. You have to set all numbers of answers in answers={} list. It is important
Updated by Idan Geva almost 2 years ago
- Assignee changed from Shlomi Lanton to Nadav Avidan
Updated by Nadav Avidan almost 2 years ago
To put this aside - now on I can’t pass mixed list (11),
I get :
[code] ⇒ 7021
[message] ⇒ openanser error format
This wasn’t happening before.
- Assignee changed from Nadav Avidan to Eugene Nechaev
Updated by Idan Geva almost 2 years ago
- Priority changed from High to Urgent
- Assignee changed from Eugene Nechaev to Nadav Avidan
Updated by Nadav Avidan almost 2 years ago
- Assignee changed from Nadav Avidan to Idan Geva
- Status changed from Feedback to Resolved
Updated by Idan Geva almost 2 years ago
OK the DATA seemed ok, but now there’s some problem that gives an empty question again:
Project is "MixedQuestions"
1. Answer Q1 with some open answer (doesn’t matter what. I wrote "F U A hole"
2. Click next
3. Answer Q2 with answer 2,3, and also the open answer (I wrote "Oh yah? F U!"
4. Click next
5. Get an empty question.
- Assignee changed from Idan Geva to Nadav Avidan
- Status changed from Resolved to Feedback
Updated by Idan Geva almost 2 years ago
I made a more comprehensive test. the problem seems to occur only when an open value is inserted on Q2. for any other case it seems to work fine.
Doesn’t matter what you do on Q2, if you selected the open answer and put in text, it goes to the empty question.
Updated by Nadav Avidan almost 2 years ago
- Assignee changed from Nadav Avidan to Idan Geva
- Status changed from Feedback to Resolved
Updated by Idan Geva almost 2 years ago
- Status changed from Resolved to Closed