Grade being set to -1 when viewing

Grade being set to -1 when viewing

by Nikki Macfarlane -
Number of replies: 1

I have a problem with assignments being added to the mdl_assign_grades table when they have not been graded yet. I am using Moodle 2.8.

I have two assignments - assignment A and assignment B. Both use a scale that has a grade of 1 for resubmit and a grade of 2 for Completed. The grade required to pass is 2.

If I look at Assignment A and choose to view all submissions, then click on Edit and then Grade, it shows me the students assignment. I can then download it, and view it. This has no affect on the mdl_assign_grade table.

If I look at Assignment B in exactly the same way, when I click on Edit and then Grade, it adds a record to the mdl_assign_grade table with a  grade of -1. The assignment still shows as "No grade" when I go in to view it again, but the grade has been changed on the grades table.

This would not be a problem except I am using the Grade Me block which relies on nothing being in the mdl_assign_grade table in order to display outstanding assignments that are awaiting grading.

As it stands now, if a teacher clicks Edit and then Grade for Assignment B but does not immediately assign a grade, the assignment disappears from the Grade Me block.

This is not a Grade Me block issue as I checked - the problem happens whether I look at the assignment through the Grade Me block or if I go into the assignment directly.

First, any idea why one assignment would be causing a problem and another would not? I set up Assignment A before upgrading to 2.8 so used the assignment conversion program. But Assignment B was set up since then just using the Assign module. I have checked all the assignment settings for both assignments and they look identical.

I think this is happening on line 2908 of locallib.php:

if ($create) {
            $grade = new stdClass();
            $grade->assignment   = $this->get_instance()->id;
            $grade->userid       = $userid;
            $grade->timecreated = time();
            $grade->timemodified = $grade->timecreated;
            $grade->grade = -1;
            $grade->grader = $USER->id;
            if ($attemptnumber >= 0) {
                $grade->attemptnumber = $attemptnumber;
            }

            $gid = $DB->insert_record('assign_grades', $grade);
            $grade->id = $gid;
            return $grade;

What I don't understand is why this is being activated for one assignment but not for the other.

Is this a bug? Should viewing the assignment be adding a record to mdl_assign_grades with a value of -1?

Hoping someone can help!

Thanks,

Nikki

Average of ratings: -
In reply to Nikki Macfarlane

Re: Grade being set to -1 when viewing

by erika alarcon -
Picture of Testers

Hi, I have the same problem, I am also using the grade_me block and generating reports with Crystal so the grade -1  is causing me errors.

Any advice?