Gradebook with calculated columns in Moodle 1.3?

Red ERROR and multiple Total columns

by Jill Kaminski -
Number of replies: 5

I think I've come up with the solution for both of these problems.

In the readme file on CVS, it says to "append" some code to the mysql.php file. Here's what the bottom of the file looks like before you do this:

        ....
        }
    }

    return $result;
}

?>

Most programmers would (correctly) put the code before the "return $result;". I say "most", because I'm a programmer, but I still screwed this up today. Most non-programmers would think that "append" means "append", and put it either right before or right after the ?> (I incorrectly put it right before, knowing that it needed the end tag).

If you paste the code right before the return line, AND you change the version in this file and in version.php, and you visit the Admin page, you'll get several complaints about recreating the database. But it will work! No more ERROR and no more new Total column everytime you go to the Admin page.

Also, being a dorky programmer, I wanted to be able to use the modulus operator in my formulas. Here is the line I changed to allow %.

// Sum may contain the following characters:
$check = strtr($check, '0123456789+-*/%(),:N', "                    ");

I added a % within the single quotes, and an extra space within the double quotes.

smile

In reply to Jill Kaminski

Re: Red ERROR and multiple Total columns

by W Page -
Hi Jill!

You should not have gotten the error message with the zip address I gave you (Was it you I gave it to? I cannot remember) Anyway, I will try the code/hack you provided for %. If it works, that is a nice hack of a hack.

WP1
In reply to W Page

Re: Red ERROR and multiple Total columns

by Jill Kaminski -
I used the CVS code, not the ZIP code. It seemed more "official". But yeah, that was me.
In reply to Jill Kaminski

Re: Red ERROR and multiple Total columns

by Marc Dastous -

Thank you so much Jill, I no longer get the extra column every time.  However, I would still like to know how to only calculate using columns that have grades in them, or that have values.

For example, 1000 points possible, 10 assignments for the entire class, student finishes assignment #1 with 100, grade should be 100.0, not 10. 

Has anyone figured out how to only use the columns that have a grade?

Marc

In reply to Marc Dastous

Re: Red ERROR and multiple Total columns

by Genner Cerna -
For may case I wanted to get the average not the total...
In reply to Marc Dastous

Re: Red ERROR and multiple Total columns

by Jill Kaminski -

I think that the sum of all 10 assignments will give you 100 in this case, Marc. Blank scores (that don't have grades or values in them yet) calculate as zeros.