Skip to content
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

Implement new delete_instance callback. #228

Open
wants to merge 1 commit into
base: development
Choose a base branch
from

Conversation

sumaiyamannan
Copy link

Hi,

Currently a capquiz activity cannot be deleted. It gets deleted and then goes to the recycle bin. See details here in the report issue #206

Testing instructions

  • Create a new capquiz activity with questions and publish it
  • Delete the activity and run cron. You will see the below error stack
Adhoc task failed: core_course\task\course_delete_modules,Coding error detected, it must be fixed by a programmer: The course module 6 could not be deleted. Can't find data record in database. (SELECT cm.*, m.name, md.name AS modname 
              FROM {course_modules} cm
                   JOIN {modules} md ON md.id = cm.module
                   JOIN {capquiz} m ON m.id = cm.instance
                   
             WHERE cm.id = :cmid AND md.name = :modulename
                   
[array (
  'cmid' => 3,
  'modulename' => 'capquiz',
)]): /var/www/html/lib/dml/moodle_database.php(1682) #0 /var/www/html/lib/datalib.php(1266): moodle_database->get_record_sql('SELECT cm.*, m....', Array, 2)
#1 /var/www/html/mod/capquiz/classes/capquiz.php(75): get_coursemodule_from_id('capquiz', 1, 0, false, 2)
#2 /var/www/html/mod/capquiz/lib.php(67): mod_capquiz\capquiz->__construct(1)
#3 /var/www/html/course/lib.php(907): capquiz_delete_instance(1)
#4 /var/www/html/course/classes/task/course_delete_modules.php(66): course_delete_module('6')
#5 /var/www/html/lib/cronlib.php(367): core_course\task\course_delete_modules->execute()
#6 /var/www/html/lib/cronlib.php(198): cron_run_inner_adhoc_task(Object(core_course\task\course_delete_modules))
#7 /var/www/html/lib/cronlib.php(76): cron_run_adhoc_tasks(1706240953)
#8 /var/www/html/admin/cli/cron.php(178): cron_run()

Regards,
Sumaiya

Delete all the relevant data when a capquiz activity is deleted.
            modified:   mod/capquiz/lib.php
            modified:   mod/capquiz/locallib.php
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant