Affects Version/s: 2.5.6, 2.5.7, 2.5.8, 2.6.3, 2.6.4, 2.6.5, 2.7, 2.7.1, 2.7.2
Fix Version/s: None
Affected Branches:MOODLE_25_STABLE, MOODLE_26_STABLE, MOODLE_27_STABLE
Survey activity will have no questions if the auto_increment_increment mysql database option is set to something other than 1.
The surveys are hard coded (in db/install.php) to use the ids of the survey questions. In the survey question table the ids are auto incremented. If the auto increment is 1, this is fine. If the auto increment is not 1, e.g. 10. This results in a miss match. (The survey table has a questions column. This questions column contains the ids of the questions that belong to the survey.)
uninstall the survey activity
alter the auto_increment_increment value to 10 in the mysql server settings
re-install the survey activity
add a survey activity to a course
view the survey and the survey will complain it has no questions.
Check the database and you will see that the surveys (in the surverys table) now refer to questions that dont exist.
Alter the survey db/install.php file to loop over each question, when it inserts, make a note of that id and add that into the survey rather than hard code it.