Totara Learn Open Discussions

Mod Assign - Strange Error

 
John Unnever
Mod Assign - Strange Error
by John Unnever - Thursday, 29 February 2024, 6:26 AM
Group Partners

We have a unique issue where only 1 of our users (System Admin role) is getting an error when trying to 'View all submissions' on a course. Tried multiple other users and this action works as expected. Permissions for mod/assign look identical for this user as other users who do not get the error. Any thoughts?


Url - /mod/assign/view.php?id=9641&action=grading

(when clicking the view all submissions button below)

The next page throws the below error for them. (Note - also on this page where the error is thrown, all CSS / theme / images etc are gone)


Debug info:

Coding error detected, it must be fixed by a programmer: Improper use of the assignment class. Cannot load the grade item.
 
Debug info:
Error code: codingerror
 
Stack trace:
line 1438 of /mod/assign/locallib.php: coding_exception thrown
line 265 of /mod/assign/gradingtable.php: call to assign->get_grade_item()
line 4135 of /mod/assign/locallib.php: call to assign_grading_table->__construct()
line 4214 of /mod/assign/locallib.php: call to assign->view_grading_table()
line 589 of /mod/assign/locallib.php: call to assign->view_grading_page()
line 55 of /mod/assign/view.php: call to assign->view()



This appears to be the code that is throwing the error, i'm just not sure why for this user it's not able to create this grade item?

public function get_grade_item() {

if ($this->gradeitem) {

return $this->gradeitem;

}

$instance = $this->get_instance();

$params = array('itemtype' => 'mod',

'itemmodule' => 'assign',

'iteminstance' => $instance->id,

'courseid' => $instance->course,

'itemnumber' => 0);

$this->gradeitem = grade_item::fetch($params);

if (!$this->gradeitem) {

throw new coding_exception('Improper use of the assignment class. ' .

'Cannot load the grade item.');

}

return $this->gradeitem;

}

Peter Pappas
Re: Mod Assign - Strange Error
by Peter Pappas - Thursday, 29 February 2024, 5:30 PM
 

Hi John,


I would check that debugging is disabled in the config file or in developer settings(/admin/settings.php?section=debugging). there is a setting to turn on debugging for specific users in the config check that $CFG->debugusers = '2,5'; where 2 or 5 is the id of debug users. I had a similar message on our system after I updated the site to version 18 and I was troubleshooting some other issues. Other than the message, uploading submissions and grading them worked fine.

John Unnever
Re: Mod Assign - Strange Error
by John Unnever - Thursday, 29 February 2024, 6:57 PM
Group Partners

Appreciate the response! Unfortunately, debugging is set to None and there are no additional debug settings turned on in the config.php file.

Craig Eves
Re: Mod Assign - Strange Error
by Craig Eves (Totara Support) - Sunday, 3 March 2024, 1:21 PM
Group Totara

Hi John

Are you able to submit a support ticket to fix this including the Totara version with recreation steps and settings in the Assignment activity 


regards