Totara Learn Open Discussions

Mod Assign - Strange Error

 
UnneverJohn
Mod Assign - Strange Error
UnneverJohn 发表于 2024年02月29日 Thursday 06:26
小组 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;

}

PappasPeter
Re: Mod Assign - Strange Error
PappasPeter 发表于 2024年02月29日 Thursday 17:30
 

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.

UnneverJohn
Re: Mod Assign - Strange Error
UnneverJohn 发表于 2024年02月29日 Thursday 18:57
小组 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
Eves (Totara Support)Craig 发表于 2024年03月3日 Sunday 13:21
小组 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