-
Bug
-
Resolution: Fixed
-
Minor
-
2.3.1
-
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
q
INNER JOIN
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.