Uploaded image for project: 'Plugins'
  1. Plugins
  2. CONTRIB-3898

Questionnaire: add screen displays duplicate records found warning

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Minor Minor
    • 2.3.2
    • 2.3.1
    • Module: Questionnaire
    • None
    • MOODLE_23_STABLE
    • MOODLE_23_STABLE

      Did you remember to make the first column something unique in your call to get_records? Duplicate value '7' found in column 'id'.

      line 746 of /lib/dml/pgsql_native_moodle_database.php: call to debugging()
      line 730 of /mod/questionnaire/lib.php: call to pgsql_native_moodle_database->get_records_sql()
      line 749 of /mod/questionnaire/lib.php: call to questionnaire_get_survey_list()
      line 113 of /mod/questionnaire/mod_form.php: call to questionnaire_get_survey_select()
      line 173 of /lib/formslib.php: call to mod_questionnaire_mod_form->definition()
      line 71 of /course/moodleform_mod.php: call to moodleform->moodleform()
      line 266 of /course/modedit.php: call to moodleform_mod->moodleform_mod()

      In order to reproduce this you'll need quite a few questionnaire instances set up across multiple courses, where some are public and some are template surveys. I think the deciding factor in triggering this warning is the re-use of a public survey in a second course.

      The offending code is in questionnaire_get_survey_list() creating the list of template & public questionnaires for you to choose from on the "add questionnaire" screen - which I think works fine despite this error, but I'm not sure.

      The SQL generated is

      SELECT s.id,s.name,s.owner,s.realm,s.status,q.id as qid
      FROM

      {questionnaire}

      q
      INNER JOIN

      {questionnaire_survey}

      s ON s.id = q.sid
      WHERE status != ? AND owner = ?
      ORDER BY realm,name

      and because the same public survey is used in two different questionnaires, the survey table row is returned twice.

            jenny-gray Jenny Gray (Inactive)
            jenny-gray Jenny Gray (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved:

                Error rendering 'clockify-timesheets-time-tracking-reports:timer-sidebar'. Please contact your Jira administrators.