gtn / exacomp

exabis competencies
8 stars 2 forks source link

M4.4 / PHP 8.1 Schedule task failure | block_exacomp\task\clear_exacomp_weekly_schedule #30

Closed gemguardian closed 2 months ago

gemguardian commented 2 months ago

Debugging error

Scheduled task failed: Clear all unfinished tasks from last weeks schedule and put them into the planning storage again. Clear all tasks that are not associated to any course (course has been deleted). (block_exacomp\task\clear_exacomp_weekly_schedule),Error writing to database (Table 'moodle.mdl_block_exaportitem' doesn't exist UPDATE mdl_block_exacompschedule SET start = null, endtime = null, is_overdue = 1 WHERE id IN ( SELECT schedule.id FROM mdl_block_exacompschedule schedule JOIN mdl_block_exacompexamples ex ON ex.id = schedule.exampleid WHERE schedule.start > ? AND schedule.start < ? AND ex.blocking_event = 0 AND schedule.id NOT IN ( SELECT sched.id -- select table inside a subquery, because else we get a -- 'You can't specify target table 'schedule' for update in FROM clause' -- error FROM (SELECT id, exampleid, start FROM mdl_block_exacompschedule) AS sched JOIN mdl_block_exacompitem_mm item_mm ON sched.exampleid = item_mm.exacomp_record_id JOIN mdl_block_exaportitem item ON item_mm.itemid = item.id WHERE sched.start > ? AND sched.start < ? ) ) [array ( 0 => 1719302777, 1 => 1719907577, 2 => 1719302777, 3 => 1719907577, )]) Debug info: Table 'moodle.mdl_block_exaportitem' doesn't exist UPDATE mdl_block_exacompschedule SET start = null, endtime = null, is_overdue = 1 WHERE id IN ( SELECT schedule.id FROM mdl_block_exacompschedule schedule JOIN mdl_block_exacompexamples ex ON ex.id = schedule.exampleid WHERE schedule.start > ? AND schedule.start < ? AND ex.blocking_event = 0 AND schedule.id NOT IN ( SELECT sched.id -- select table inside a subquery, because else we get a -- 'You can't specify target table 'schedule' for update in FROM clause' -- error FROM (SELECT id, exampleid, start FROM mdl_block_exacompschedule) AS sched JOIN mdl_block_exacompitem_mm item_mm ON sched.exampleid = item_mm.exacomp_record_id JOIN mdl_block_exaportitem item ON item_mm.itemid = item.id WHERE sched.start > ? AND sched.start < ? ) ) [array ( 0 => 1719302777, 1 => 1719907577, 2 => 1719302777, 3 => 1719907577, )] Backtrace:

gemguardian commented 2 months ago

@dangerer I kind of hope you can help with this.

I figured out the issue is in the exompb/lib/lib.php file in line 14778

it refers to a table that cannot be found, does not exsist. I know too little of this plugin to know what it should be or that the line is there by mistake.

I am guessin when this is fixed it will solve the errror.

image

dangerer commented 2 months ago

@gemguardian Thank you for bringing this issue to our attention and for the analysis. Problem was that this task is only usefull in combination with our portfolioplugin. if the portfolioblock exaport is not installed, table exaportitem is missing and error is thrown. problem is fixed in new pluginversion on git and moodle.org

gemguardian commented 2 months ago

Thank you!