-
Notifications
You must be signed in to change notification settings - Fork 5
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Missing question causes invalidrecordunknown error, on MY (dashboard) page #7
Comments
Here is an SQL query that helped us identify all the question ids that are used in availability conditions which have deleted questions. SELECT cm.id, cm.course, cm.module, cm.instance
,m.name
,CASE m.name
WHEN 'assign' THEN (SELECT asg.name FROM mdl_assign AS asg WHERE asg.id = cm.instance)
WHEN 'forum' THEN (SELECT f.name FROM mdl_forum AS f WHERE f.id = cm.instance)
WHEN 'quiz' THEN (SELECT q.name FROM mdl_quiz AS q WHERE q.id = cm.instance)
WHEN 'questionnaire' THEN (SELECT q.name FROM mdl_questionnaire AS q WHERE q.id = cm.instance)
WHEN 'hvp' THEN (SELECT q.name FROM mdl_hvp AS q WHERE q.id = cm.instance)
WHEN 'resource' THEN (SELECT q.name FROM mdl_resource AS q WHERE q.id = cm.instance)
WHEN 'page' THEN (SELECT q.name FROM mdl_page AS q WHERE q.id = cm.instance)
WHEN 'folder' THEN (SELECT q.name FROM mdl_folder AS q WHERE q.id = cm.instance)
WHEN 'ejsapp' THEN (SELECT q.name FROM mdl_ejsapp AS q WHERE q.id = cm.instance)
WHEN 'url' THEN (SELECT q.name FROM mdl_url AS q WHERE q.id = cm.instance)
WHEN 'data' THEN (SELECT q.name FROM mdl_data AS q WHERE q.id = cm.instance)
WHEN 'tab' THEN (SELECT q.name FROM mdl_tab AS q WHERE q.id = cm.instance)
WHEN 'lesson' THEN (SELECT q.name FROM mdl_lesson AS q WHERE q.id = cm.instance)
END AS 'oer name'
,JSON_EXTRACT(cm.availability, '$.c[0].quizid') AS 'avail_quizid'
,@questionids := TRIM(TRAILING ']' FROM TRIM(LEADING '[' FROM
JSON_EXTRACT(cm.availability, '$.c[*].questionid'))) 'avail_questionid'
,(SELECT GROUP_CONCAT(q.id) FROM mdl_question AS q
WHERE q.id IN (@questionids)) 'questionid_found'
, cm.availability
FROM mdl_course_modules cm
JOIN mdl_modules m ON m.id = cm.module
WHERE cm.availability LIKE '%quizquestion%' |
Hi @timhunt , What are your thoughts about this issue? |
Hi @nadavkav |
Teacher A was using a question with a quizquestion availability condition on one of the course modules,
and then, another Teacher (B) in the same course deleted it from one of the question banks in a course.
Now, when either of them viewed the MY (dashboard) page,
They got the following JS dialog error: invalidrecordunknown
We are using Moodle 4.1.6 with availability_quizquestion version 1.3 (2022092000)
See full error, with DEBUG turned ON:
SELECT q.id, qc.id as category, q.parent, q.name, q.questiontext, q.questiontextformat,
q.generalfeedback, q.generalfeedbackformat, q.defaultmark, q.penalty, q.qtype,
q.length, q.stamp, q.timecreated, q.timemodified,
q.createdby, q.modifiedby, qbe.idnumber,
qc.contextid,
qv.status,
qv.id as versionid,
qv.version,
qv.questionbankentryid
FROM {question} q
JOIN {question_versions} qv ON qv.questionid = q.id
JOIN {question_bank_entries} qbe ON qbe.id = qv.questionbankentryid
JOIN {question_categories} qc ON qc.id = qbe.questioncategoryid
WHERE q.id = :id
[array (
'id' => 73357,
)]
Error code: invalidrecordunknown
The text was updated successfully, but these errors were encountered: