4## Current behaviour without patch.
6### scales doesn't allow 0 values. And this scales are saved with the scale value - 1 in the table "svy_answer"
11Repository home -> create
new survey, create
new page with any of
this "Question type":
12- Multiple Choice Question (Single Response)
13- Multiple Choice Question (Multiple Response)
16**In the answers section:**
22We can put as scale values everything without restrictions. Strings, numbers and symbols are allowed.
23After pressing the save button we
get the
success message
"Modifications saved."
24But in the database table
"svy_variable" the column scale
has "NULL".
28If we go to edit
this answer we can see that the javascript filled the Scale with the first number available in the
29scale values. Therefore we have NULL in the DB and one
new number in the edit form.
33Everytime one answer is added, the javascript clones exactly the same row above. Therefore we have to
delete the text
34and scale before write.
38Can
't store the value "0"
42Editing the question answers. If we delete one answer with "-" button. In the table "svy_category" this answer remains available.
43this answer is perfectly deleted in "svy_variable" table.
45 select * from svy_question;
46 +-------------+-----------------+--------+----------+-------------------+-------------+-----------+------------+----------+------------+-------------+------------+---------------------+-------+
47 | question_id | questiontype_fi | obj_fi | owner_fi | title | description | author | obligatory | complete | created | original_id | tstamp | questiontext | label |
48 +-------------+-----------------+--------+----------+-------------------+-------------+-----------+------------+----------+------------+-------------+------------+---------------------+-------+
49 | 50 | 2 | 277 | 6 | My first question | NULL | root user | 1 | 1 | 1475171583 | NULL | 1475174823 | This is my question | NULL |
50 | 51 | 2 | 277 | 6 | NULL | NULL | root user | 1 | 0 | 1475172649 | NULL | 0 | NULL | NULL |
51 | 52 | 2 | 277 | 6 | NULL | NULL | root user | 1 | 0 | 1475174096 | NULL | 0 | NULL | NULL |
52 | 53 | 2 | 277 | 6 | NULL | NULL | root user | 1 | 0 | 1475174194 | NULL | 0 | NULL | NULL |
53 | 54 | 2 | 277 | 6 | NULL | NULL | root user | 1 | 0 | 1475174292 | NULL | 0 | NULL | NULL |
54 | 55 | 2 | 277 | 6 | NULL | NULL | root user | 1 | 0 | 1475175261 | NULL | 0 | NULL | NULL |
55 +-------------+-----------------+--------+----------+-------------------+-------------+-----------+------------+----------+------------+-------------+------------+---------------------+-------+
56 6 rows in set (0.00 sec)
59**In the Questions page (Drag and drop section)**
61Only the GUI files are affected:
62- Modules/SurveyQuestionPool/classes/class.SurveySingleChoiceQuestionGUI.php
63- Modules/SurveyQuestionPool/classes/class.SurveyMultipleChoiceQuestionGUI.php
64- Modules/SurveyQuestionPool/classes/class.SurveyMatrixQuestionGUI.php
67- Modules/SurveyQuestionPool/classes/class.SurveySingleChoiceQuestion.php
68- Modules/SurveyQuestionPool/classes/class.SurveyMultipleChoiceQuestion.php
69- Modules/SurveyQuestionPool/classes/class.SurveyMatrixQuestion.php
71Here que can create pages, add from pool etc...
75Here we are passing to the template, the scale -1. Therefore all the radio buttons, checkboxes will have the scale value as scale -1
76Also if we need store 0 values this if statement is not valid.
78 $template->setVariable("VALUE_SC", ($cat->scale) ? ($cat->scale - 1) : $i);
83- getWorkingForm (horizontal,vertical and combobox options)
91## EXAMPLE: Table comparation
93For the "question_fi" 50
95We have 2 scales, 11 and 22:
97 select * from svy_variable;
98 +-------------+-------------+-------------+--------+--------+----------+------------+-------+-------+
99 | variable_id | category_fi | question_fi | value1 | value2 | sequence | tstamp | other | scale |
100 +-------------+-------------+-------------+--------+--------+----------+------------+-------+-------+
101 | 291 | 123 | 50 | 2 | NULL | 1 | 1475174823 | 0 | 22 |
102 | 290 | 122 | 50 | 1 | NULL | 0 | 1475174823 | 0 | 11 |
103 +-------------+-------------+-------------+--------+--------+----------+------------+-------+-------+
104 2 rows in set (0.00 sec)
106User answered but the scale is saved as value 10: (scale -1)
108 select * from svy_answer;
109 +-----------+-----------+-------------+-------+------------+----------+------------+
110 | answer_id | active_fi | question_fi | value | textanswer | rowvalue | tstamp |
111 +-----------+-----------+-------------+-------+------------+----------+------------+
112 | 54 | 3 | 50 | 10 | NULL | 0 | 1475178660 |
113 +-----------+-----------+-------------+-------+------------+----------+------------+
114 1 row in set (0.00 sec)
118##Tables documentation.
121* table svy_question (What is the difference between tstamp and created?)
122 * question_id: sequence value -> svy_question_seq (PK)
123 * questiontype_fi: question type -> svy_qtype
124 * obj_fi: survey or survey pool object -> object_data (MUL)
125 * owner_fi: author user -> usr_data and object_data (MUL)
126 * title: question text (MUL)
130 * complete: 1 or 0 depending if the user saved any data
136 INSERT: Modules/SurveyQuestionPool/classes/class.SurveyQuestion.php - saveToDb
137 UPDATE: Modules/SurveyQuestionPool/classes/class.SurveyQuestion.php - saveToDb
138 DELETE: Modules/SurveyQuestionPool/classes/class.SurveyQuestion.php - delete
139 UPDATE: Modules/SurveyQuestionPool/classes/class.SurveyQuestion.php - delete
140 UPDATE: Modules/SurveyQuestionPool/classes/class.SurveyQuestion.php - _changeOriginalId
141 INSERT: Modules/SurveyQuestionPool/classes/class.SurveyQuestion.php - createNewQuestion
142 UPDATE: Modules/SurveyQuestionPool/classes/class.SurveyQuestion.php - saveCompletionStatus
143 UPDATE: Modules/Survey/classes/class.ilObjSurvey.php - setObligatoryStates
144 UPDATE: Modules/SurveyQuestionPool/classes/class.ilObjSurveyQuestionPool.php - setObligatoryStates
147 * category_id: sequence value -> svy_category_seq (PK)
149 * defaultvalue: is set to "1" for categories predefined by the system? or for user defined phrases
156 * variable_id: sequence value -> svy_variable_seq (PK)
157 * category_fi: general answer option -> svy_category (MUL)
158 * question_fi: question -> svy_question (MUL)
159 * value1: for metric q: min value
160 * value2: for metric q: max value
161 * sequence: order of the options in the question presentation
163 * scale: scale value (positives or NULL. Here the scale have the real value entered, not scale -1 )
166 * phrase_id: sequence value -> svy_phrase_seq (PK)
173* table svy_phrase_cat
174 * phrase_category_id: sequence value -> svy_phrase_cat_seq (PK)
175 * phrase_fi -> phrase in svy_phrase (MUL)
176 * category_fi -> general answer option in svy_category (MUL)
177 * sequence: order of the options in the question presentation
179 * scale: always NULL?, editing provides only disabled input fields
183 * questionblock_id: sequence value -> sv_qblk_seq (PK)
185 * show_questiontext: enables to show/hide question texts for questions of the block
188 * show_blocktitle: show/hide title of the block in presentation
191 * qblk_qst_id: sequence value -> sv_gblk_qst_seq (PK)
192 * survey_fi: survey -> svy_svy
193 * question_fi: question -> svy_question (could have pointed to svy_svy_qst instead, but does not do)
194 * question_block_fi: block -> svy_qblk
196* table svy_relation (fixed set of relations, should be moved from table to class constants)
197 * relation_id: sequence value -> sv_relation_seq (PK)
198 * longname: e.g. less
202* table svy_constraint
203 * constraint_id: sequence value -> svy_constraint_seq (PK)
204 * question_fi: "source" question -> svy_question (MUL)
205 * relation_fi: relation -> svy_relation (MUL)
206 * value: scale value - 1 !?
207 * conjunction: or/and (but why on this level?)
209* table svy_qst_constraint
210 * question_constraint_id: sequence value -> svy_qst_constraint_seq (PK)
211 * survey_fi: survey -> svy_svy (MUL)
212 * question_fi: "target" question -> svy_question (MUL)
213 * constraint_fi: constraint definition -> svy_constraint (MUL)
216 * finished_id: sequence value -> svy_finished_seq (PK)
217 * survey_fi: survey -> svy_svy (MUL)
218 * user_fi: user -> usr_data (and object_data)(MUL)
219 * anonymous_id: (MUL)
220 * state: 1 if finished? 0 otherwise?
225 * material_id: sequence value -> svy_material_seq (PK)
226 * question_fi: question -> svy_question (MUL)
236* table svy_qst_metric
237 * question_fi: question -> sv_question (PK)
241 * id: sequence value -> svy_times_seq (PK)
242 * finished_fi: survey run -> svy_finished (MUL)
243 * first_question: first question id of page/block -> svy_question (does not seem to point to svy_svy_qst)
244 * entered_page: timestamp when page has been rendered
245 * left_page: timestamp when answers of page have been saved
248 * answer_id: sequence value -> svy_answer_seq (PK)
249 * active_fi: survey run -> svy_finished
250 * question_fi: question -> svy_question (does not point to svy_svy_qst)
251 * value: scale value of corresponding "variable" -1?
257 * question_fi: question -> svy_question (PK)
258 * orientation: horizontal, vertial or combobox
261 * question_fi: question -> svy_question (PK)
262 * orientation: horizontal, vertial
266* table svy_qst_matrix
267 * question_fi: question -> svy_question (PK)
271 * neutral_column_separator
272 * column_placeholders
274 * singleline_row_caption
275 * repeat_column_header
276 * column_header_position
286*table svy_qst_matrix_rows
287 * id_svy_qst_matrixrows: sequence value -> svy_qst_matrix_rows_seq (PK)
290 * question_fi: question -> svy_question (MUL)
295 * id_questionpool: sequence value -> svy_qpl_seq (PK)
301 * invited_user_id: sequence value -> svy_inv_usr_seq (PK)
302 * survey_fi: survey -> svy_svy (MUL)
303 * user_fi: user -> usr_data (MUL)
307 * question_fi: question -> svy_question (PK)
312* table svy_anonymous:
313 * anonymous_id: sequence value -> svy_anonymous_seq (PK)
315 * survey_fi: survey -> svy_svy
An exception for terminatinating execution or to throw for unit testing.