Uploaded image for project: 'Moodle'
  1. Moodle
  2. MDL-47563

Survey activity fails when auto_increment_increment is altered due to hard coded id's

    XMLWordPrintable

    Details

    • Type: Improvement
    • Status: Open
    • Priority: Minor
    • Resolution: Unresolved
    • 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
    • Component/s: Survey
    • Labels:
      None
    • Affected Branches:
      MOODLE_25_STABLE, MOODLE_26_STABLE, MOODLE_27_STABLE

      Description

      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.)

      To replicate:

      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.

      Potential solution:
      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.

        Attachments

          Activity

            People

            Assignee:
            Unassigned
            Reporter:
            mchaney2010 Mark Chaney
            Participants:
            Component watchers:
            Amaia Anabitarte, Carlos Escobedo, Ferran Recio, Sara Arjona (@sarjona), Víctor Déniz Falcón
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Dates

              Created:
              Updated: