Calculating final grades

Calculating final grades

by Gustav W Delius -
Number of replies: 40

Christmas is approaching and soon it will be time to combine all those grades from individual activities into a final coursework grade. Currently Moodle simply adds all the individual grades together to get a Total. That is of course not good enough. At our department we need the following steps:

1) each activity gets a weighting factor which multiplies the number of points. This allows in particular to ignore some activities alltogether by giving them a weight of 0,

2) marks from several activities may be grouped together, for example to arrive at one mark per week or per topic,

3) the weighted total mark from each group of activities will be converted into percentage points, so each group will have points out of 100,

4) only the best n of the marks obtained by steps 1 to 3 will be added together, where n is some number that for us in York usually is around 3/4 of the total number of marks,

5) the resulting total for the course will then be normalized. For example if the course is assessed 30 % by coursework and 70% by final exam then one would probably normalize the final coursework mark to be out of 30.

I would be interested to hear whether a scheme like this would be flexible enough also for other users.

After agreeing on how flexible the scheme should be we will have to figure out how to implement it. Clearly there needs to be some form interface where the lecturer can set the information needed, in the scheme above that would be the weights, the groupings, the number n and the final maximum mark. This information would then have to be stored for each course in the database.

That is all straightforward but there is one point of philosophy to be decided: the weighting factors for example are clearly associated with an activity, so naturally would be stored with the activity. However that would require updates to all modules that give grades together with some definition of how the modules would communicate this information to Moodle. I would therefore opt for the slightly less clean but much more easily implemented solution of storing all the information about how to calculate the final grade in the course database.

Average of ratings: -
In reply to Gustav W Delius

Re: Calculating final grades

by Tom Murdock -
Gustav, your good ideas raise some other questions.thoughtful

How much of Moodle innovation time should be spent on grades?  The ease of the excel dump seems to allow for maximum flexibility in manipulation..  I'm usually the guy who wants all of the functionality inside Moodle (avoiding helper apps), but in the case of grades, I can't imagine how much time it might take to sort out the various wish lists for functionality.

It is true, that I wish the forums would dump differently into a table, etc., but maybe what Moodle can coordinate is the grading scheme, rather than the manipulative device that handles overall weights, etc.. ?

But maybe not.  I'm always amazed at what good code can do.wide eyes

-Tom
In reply to Tom Murdock

Re: Calculating final grades

by Gustav W Delius -

Spreadsheets was indeed how final grades were calculated here in the past. This was extremely time-consuming. Luckily the lecturers did not have to do it themselves, it was done by the secretaries. Saving time is however not the only reasons for why we want the final grades to be calculated within Moodle: it allows students to see their final grades on the system and they really like that idea.

Whether this calculation of grades will make it into the Moodle CVS will of course depend on how diverse people's requirements are. I would like to hear from people whether the proposed scheme is flexible enough.

In reply to Gustav W Delius

Re: Calculating final grades

by Martin Dougiamas -
Picture of Core developers Picture of Documentation writers Picture of Moodle HQ Picture of Particularly helpful Moodlers Picture of Plugin developers Picture of Testers
As I read it, this scheme still seems a little specific. I always envisaged solving this the same way WebCT did, using "Calculated" columns.

Basically, each existing column in the gradebook is given a variable name - it could be as simple as A, B, C etc. Then a little GUI on the grades page allows the teacher to "Add" a new Calculated column. Part of the editing form is a field where you can type a formula. It could be something like:

(A*0.8) + B + C + E

or it could be even more advanced - there must be some sort of open source code out there for parsing maths notation.

For massive flexibility (at some cost to security) we could even let teachers type PHP code in there, so one could have if-else statements etc

For per-student fudge factors etc you can use a manual column. These are already possible in a slightly circuitous way using offline assignments, but it would good to just "add" them to the gradebook in the same way as calculated columns.

Note that all this can be done in the gradebook and doesn't require any changes to the modules.
In reply to Martin Dougiamas

Re: Calculating final grades

by Gustav W Delius -

Thanks for the link to the feature request. It is good to know that my plans are aligned with your old plans.

I don't see how the "calculated column" thing is more flexible than my "weight and group" scheme. Certainly your example of (A*0.8) + B + C + E is the same as weighting A by 0.8 and B,C,E by 1 and then grouping them together. A calculated column would only begin to be more general if one allowed a non-linear formula (excuse the mathematicians speak), i.e., if one has things like A times B or sin(A), but I see absolutely no use for that.

So the difference between the schemes are only in the user interface. And here I like the idea of extra "calculated columns". After all the calculation of the final grade should be transparent to the student and this will be achieved by showing the extra columns. Each column, whether from an activity, calculated, or manual, should also have a tick box to determine whether it is to be used in final assessment or not.

The conversion of the individual grades to percentage points, which not everyone will want, could be integrated into the formula for the calculated columns. For example p(A) could stand for "grade of A converted into percentage points". Perhaps even p(A,n) where n is some integer could stand for "convert grade of A into points out of n". While the same could be achieved with a scale factor, this may be more intuitive in some circumstances.

I am sure you are right that there must be some sort of open source code out there for parsing simple maths notation like (A*0.8) + B + C + E. Does anyone know where I should look?

In reply to Gustav W Delius

Re: Calculating final grades

by Martin Dougiamas -
Picture of Core developers Picture of Documentation writers Picture of Moodle HQ Picture of Particularly helpful Moodlers Picture of Plugin developers Picture of Testers
I think once a calculation method exists then people will find new things to add that go beyond linear expressions ... imagine perhaps a max(A,B,C) function, or normalize(A, 20, 4) etc etc ... I'm not sure what's needed, but from a programming perspective I like how it would all be concentrated in a separate module from all the others, and so can progress independently.

One change that might eventually be necessary is to cache the grades somewhat. Currently the gradebook is constructed on the fly by "asking" all the activities for the latest grades. As the gradebook gets complicated it might make sense to change the focus so that the activities "write" new grades into the gradebook. But this is more of a performance issue that can be solved later...
In reply to Martin Dougiamas

Re: Calculating final grades

by Williams Castillo -
...and allow me to add that it will help A LOOT the interfacing with external grading systems/gradebooks and even administrative systems.

I think it should not be extremelly hard to start giving the first steps towards this functionality (beside of lack of time, of course)...

(at least from my limited scope of moodle)

Will
In reply to Williams Castillo

Re: Calculating final grades

by Martin Dougiamas -
Picture of Core developers Picture of Documentation writers Picture of Moodle HQ Picture of Particularly helpful Moodlers Picture of Plugin developers Picture of Testers
Cool, Will!

Which part are you referring to ... the calculations or the cached version?
In reply to Martin Dougiamas

Re: Calculating final grades

by Williams Castillo -
... And (evil thoughts flying on my mind evil)...

It will help us NOW with the chaining/locking of activities and resources...

In reply to Williams Castillo

Re: Calculating final grades

by Bernard Boucher -
Hi Will,
            welcome to the darkness side of Moodle evil.

You will find  here     a first attempt with  the chaining/locking of activities  and resources....

The lastest version works fine but like Dark Vador we can't see it face ( no user interfaceblush  )

It is not intended for Calculating final grades but it link and verify if someone really have accesss to a ressource or a quiz.

If you need a better security  to access Moodle ressources.

May the Force be with you,

Bernard
In reply to Martin Dougiamas

Re: Calculating final grades

by Gustav W Delius -

I have now entirely bought into your "calculated columns" scheme. It does allow for maximum flexibility, in particular if further functions like bestsum(3,A,B,C,D,E) to sum the best 3 for example are added. Your scheme has collapsed my original 5 steps into just one concept.

When you say that this would all be concentrated in a separate module I assume you do not mean module in the Moodle sense. I guess you mean that it is good to keep this calculation separate from the activity modules that produce the raw marks. It will all be done in cvs:/moodle/course/grades.php, right?

I agree with your observation that eventually the gradebook should stop being generated on the fly. I don't think that the calculation of the calculated columns will take much time, but the collection of the grades from all the activity modules is very inefficient already now. Students and teachers like to look at the grades quite a lot, so improvements here will have a real impact on the overall server load.

In reply to Gustav W Delius

Re: Calculating final grades

by Tony Ruggiero -

Gustav:

We love this idea. We have wanted a way to manually put in a column for attendance. Our Instructors use a point system to total their grades. A scale is then used to add points for good attendance and a total is acheived and a final percentage is calculated. We also assign a letter grade based on the percentage.

We assign an attendance value to various online tasks but their is the need to manually add some attendance values. I hope this makes sense.

A final term report that could be printed out, with student names, ID numbers, final point total, final percentage and letter grade would make our Registrar a happy person. It could also be provided on a student-by-student basis for them to print out their grade report.

Great idea - I hope I make sense with my suggestions,

Tony

In reply to Tony Ruggiero

Re: Calculating final grades

by Gustav W Delius -

So there are now actually 5 separate projects relating to the gradebook:

1) improving the presentation of the grade table (I would like to see sorting and paging added to your scrolling),

2) the addition of manual columns to the grade table which will address the first point you raise above,

3) the printing of final term reports as in your second suggestion above,

4) caching of the grade table rather then generating it each time by querying all modules, suggested by Martin in this thread,

5) the addition of  "calculated columns" to the grade table, allowing in particular to calculate a final grade.

I will concentrate on 5) , you are already working on 1) and I just saw that Williams is volunteering for 4) big grin

In reply to Gustav W Delius

Re: Calculating final grades

by Williams Castillo -
Oh!!! No, no no... I'm just throwing more weight on Martin's shoulders!!! evil

Just kidding... Anything I can help, I will...

Will
In reply to Williams Castillo

Re: Calculating final grades

by Gustav W Delius -

That is very generous of you approve ...

This thread is getting a bit too long and off-topic, so I will start a new one about "Central grades table".

In reply to Gustav W Delius

Re: Calculating final grades

by Dennis Daniels -
the list is very active right now... let's cut the lag time and go to the irc

irc://freenode/moodle

just a thought

Denny
In reply to Dennis Daniels

Re: Calculating final grades

by Martin Dougiamas -
Picture of Core developers Picture of Documentation writers Picture of Moodle HQ Picture of Particularly helpful Moodlers Picture of Plugin developers Picture of Testers
The problem with IRC is that it has no memory and it's not searchable.  At least use the chat room here.
In reply to Gustav W Delius

Re: Calculating final grades

by Martin Dougiamas -
Picture of Core developers Picture of Documentation writers Picture of Moodle HQ Picture of Particularly helpful Moodlers Picture of Plugin developers Picture of Testers
And note that (2) is possible already using offline assignments ... not ideal but it does work.
In reply to Tony Ruggiero

Re: Calculating final grades

by Tony Ruggiero -

Well, here I go complicating matters tongueout

I wonder if the current Atttendance module could be hacked to provide the attendance column I wanted to create????

One more question, Martin, I played with the Forums to try to add an attendance value to the "Update this Forum" screen but couldn't find where the text box was created to insert a value.

Thanks, I will start to work on the new and improved framed version with sorting.

Tony

In reply to Tony Ruggiero

Re: Calculating final grades

by Martin Dougiamas -
Picture of Core developers Picture of Documentation writers Picture of Moodle HQ Picture of Particularly helpful Moodlers Picture of Plugin developers Picture of Testers
At the risk of repeating myself, Tony, did you try an offline assignment?  You could set up a scale like "Attended, Did not attend" and then use it in the assignment as a grade.  Setting these values for all students is then trivial, and it shows up in the gradebook.
In reply to Martin Dougiamas

Re: Calculating final grades

by Tony Ruggiero -

Martin:

Our Accreditation Commission is really sticky about attendance (and quite a few other things) so we have to give an hour-by-hour account of a student's attendance. I tried using the offline assignment but it puts the # of hours in the grade book as a grade and totals it up with the rest of the actual grades.

I am looking to hack the update assignment (also forum, and quiz) to add a field in there for attendance hours and then keep them in a separate table on the db.

Make sense?

Tony

In reply to Tony Ruggiero

Re: Calculating final grades

by Gustav W Delius -

With the new calculated columns in the grade book you can simply choose not to include the marks from the attendance module in the final grade.

I'll post the modified grade book tonight.

In reply to Martin Dougiamas

Re: Calculating final grades

by Tony Ruggiero -

Martin ( or anyone that can help):

Well, I have everything up to this point working on my desire to assign hourly attendance to assignments except the display of these hours in the array for the student "grade book". I can supply all the updated files if you need them but I provided a couple of screen shots and the grades.php file.

I know I am missing something or just don't have the know-how to finish this part of it.

Once this is done I will work on the forums, journals, & quizes

Thank you to anyone that can help,

Tony

In reply to Tony Ruggiero

Re: Calculating final grades

by Gustav W Delius -
Tony, can you explain this idea of having an hourly attendance record for assignments? How do students "attend" at an assignment? thoughtful Similarly I don't understand why or how you want to introduce such hourly attendance records for forums, journals or quizzes.
Average of ratings: Useful (1)
In reply to Gustav W Delius

Re: Calculating final grades

by Tony Ruggiero -

Gustav:

The way the programs work at our college is that the students must attend for 20 hours per week in the traditional setting. In order to get an online program approved by the Acrediting Commission, we had to equate online tasks with hourly attendance.

Example:

Forum = 2 hours

Assignment  varies from 1 hour to 8 hours (the 8 hour part is an actual in-class hands-on session)

Quiz = 1 hour

Our Instructors to this point have tracked the attendance in a paper grade book and the students really don't get to see the results. This need may be unique to us and if so, I would just create a hack for our school.

This is not my perfect solution, but I am stuck with it. Moodle fits every other need we have, so this one piece can be avoided - but I guess I just want it to be complete for the students and easier for the teachers.

Is Moodle definitely going to move to a central grades table? If so, then maybe my hack should incorporate a central hours (or attendance table).

Thanks,

Tony

In reply to Tony Ruggiero

Re: Calculating final grades

by Gustav W Delius -

Do I interpret correctly that when you write things like

Forum = 2 hours

then you mean that a student is automatically credited with two hours worth of attendance credit if they visit (or post?) the forums at some time during a week? Sounds strange but maybe that is your system.

There still is no need for a separate attendance table. You can simply store your attendance hours in the central grades table and add a calculated column adding up just the attendance hours. I posted the calculated columns update at http://moodle.org/mod/forum/discuss.php?d=3784. Have a play with it and see if it meets your needs.

In reply to Gustav W Delius

Re: Calculating final grades

by Tony Ruggiero -

Gustav:

You raise a good point and this way I can stay within the CVS upgrades. I know it's a strange way to do things but, this is my life!

I am going to work on your update and see it will meet our needs.

BTW, when I downloaded your new Calculated Gradebook, I didn't see a DB update happen when I logged in as admin and visited the Admin page.

Tony

In reply to Gustav W Delius

Re: Calculating final grades

by Tony Ruggiero -

Gustav:

I like it!!!

Could the MaxGrades be totalled as well? I agree that a way to add columns would be nice. Also, would it be possible to add a piece of text (as a descriptor) after the formula:

A1+A2 "Points"

I will work on the framed representation of your work. I have an idea for that I will e-mail you with some ideas first and see if you agree.

Tony

In reply to Tony Ruggiero

Re: Calculating final grades

by Gustav W Delius -

Could the MaxGrades be totalled as well?

That is a good idea. There should be some extra variables that one can use in the formula:

MA1, MA2, .....  for the maximum grades in activities 1, 2,....

AA1, AA2, ....    for the average grade obtained in activities 1, 2, ....

This would be easy to implement. But before I do it I will wait if someone else has other similar requests (and perhaps a better naming scheme).

I just noticed that his belongs in a different thread: http://moodle.org/mod/forum/discuss.php?d=3784

In reply to Tony Ruggiero

Re: Calculating final grades

by Bernard Boucher -
Hi Tony,
for the timed part of your needs I used something that may be a good hint for you.

For taking in account time I already use something like this in course/lib.php:

$dtime = $logtimea-$log->time ;
if ($dtime>=0){
if ($dtime<1800){ //seconds
$ttime=$ttime+$dtime/60; //minutes
} else {
$ttime=$ttime+30;
}
}
$logtimea=$log->time;

The 1800 sec or 30 minutes was adjusted with 20 students working continiously during 3 hours.

It depends of the type of activities implied.

It need refinement but it give a good idea of the time used by students.

The cumulative time is displayed in a new column in the course log aside time.
( see attached image )

That way if we choose one particular student we can see for one day the estimated time attended. If we choose all the days we see all the time attended.

You may adapt that script to fit yours needs for particular activities or period ( week ) .

I hope it may help you,

Bernard

Average of ratings: Useful (2)
In reply to Bernard Boucher

Re: Calculating final grades

by Tony Ruggiero -

Bernard:

We can use this to track the students. Unfortunately, we deal in set (teacher input) attendance for each activity. I am playing with a duplicate function like assignment with hours to accomplish what we need done.

Thanks,

Tony

In reply to Bernard Boucher

Re: Calculating final grades

by Timothy Takemoto -
Dear Bernard
Five years later, are you still using this hack? It looks good. Please can you be a little more specific about the code?
Tim
In reply to Timothy Takemoto

Re: Calculating final grades

by Bernard Boucher -
Hi Timothy,
nice to see you again after all these years big grin

.

3 years later the code has evolved a little bit to give some small statistics and it get also a "friend" : check these posts.



The 2 versions are not yet combined.

My version is stuck ( like me shy ) to moodle 1.6.1. If you are interested I will check ( I don't remember right now ) wich files are modified to achieve that and it will be relatively easy, if you want, to apply theses changes to your installation.

Salutations from Québec,

Bernard




In reply to Bernard Boucher

Re: Calculating final grades

by Timothy Takemoto -

Hi Bernard,

Thank you for noticing my post. I would not notice one addressed to me out of the blue.

My version is stuck on 1.6.2 or 3, so it should be compatible. I think that I should just be able to drop in the files. If you would be so kind as to email them to me, that woudl be great.

I could try the other one but it is more a way of assessing the study time per login rather than study time per student. I (or rather my boss) would like to know how much each student has studied. But it would be nice to combine them. I will see if I can do that.

Salutations from Japan

Tim

In reply to Timothy Takemoto

Re: Calculating final grades

by Bernard Boucher -
Hi Timothy,
sorry for the delay, an overloaded semester here sad.

I just checked my system and only the file moodle/course/lib.php seemed to be modified for the statistics. But I did'nt try to reinstall it from a fresh moodle 1.61 to confirm if it is true.

Around line 360 you will see:

if ((($log->ip < 207) and ($log->ip > 203)) or (($log->ip < 193) and ($log->ip > 191))){
$USER->ttimecegep=$USER->ttimecegep+$dtime/60;
$USER->ttimecegephour=intval($USER->ttimecegep/60);
$USER->ttimecegepmin=intval($USER->ttimecegep) % 60;
} else {
$USER->ttimeext=$USER->ttimeext+$dtime/60;
$USER->ttimeexthour=intval($USER->ttimeext/60);
$USER->ttimeextmin=intval($USER->ttimeext) % 60;
}


The conditions in the if only check the ip address of the log to see if the work was done inside my organisation with the acronym Cegep ( Collège d'Enseignement Général et Professionnel ). If you want to keep that distinction you will have to adjust the ip addresses to match those of your organisation.

Please don't forget to try it on a test system.

Let me know if some files are missing.

I hope it may help you and maybe Moisés too.

Salutations du Québec,

Bernard


Average of ratings: Useful (1)
In reply to Bernard Boucher

Re: Calculating final grades att Bernard Boucher

by Timothy Takemoto -

Dear Bernard,

Thank you very much!

I am sorry I took so long with this. We are not in a rush. We are thinking of using it from April, since my boss wants to know how long students spend online doing some online tests that we are purchasing from Jamie Pratt.

I guess that the bit you quote above does the calculation. And since I don't need to know where the students are working....

$USER->ttimeext=$USER->ttimeext+$dtime/60;
$USER->ttimeexthour=intval($USER->ttimeext/60);
$USER->ttimeextmin=intval($USER->ttimeext) % 60;

Is all there is...eh?

But it looks like I will need to add more.

1) Do I need to add items $USER->ttimeext, $USER->ttimeexthour, $USER->ttimeextmin to the database first?
2) Somewhere that prints them out
(ideally for me the printout would be in the gradebook but I can see that you have hacked the logs)

Perhaps I should just put the lib.php in and see what happens.

I am using 1.6.3.

Tim

In reply to Bernard Boucher

Re: Calculating final grades

by Steve Bilton -
Hello Bernard,

I don't suppose you have an updated version of this hack for moodle 1.8? The code seems quite different between 1.6 & 1.8 moodles.

Thanks

Steve
In reply to Gustav W Delius

Re: Calculating final grades

by Marilyn Fleming -

Don't know if this comment fits here, but ...

I work with untimed , competency training courses, rather than formal semseter-type courses. A student doesn't completes a course at the end of an academic term. He completes it when he has finished all the assignments and taken all the tests. Also, he doesn't necessarily start the course on a calendar schedule.

As a result, there is a more-or-less continuous stream of grades coming out of Moodle. I already hacked grades.php so the total grade for a course reports "incomplete" (instead of a number) when any graded activity in the course doesn't have a grade yet. Ultimately, I need to get a report not just for one course, but something that covers all students, all courses, all real final grades (excluding incompletes). I then have to export that data to an offline program. I think folks want daily updates. Certainly no less frequently than weekly.

I'm eagerly awaiting the gradebook db, since it ought to make this a lot easier to do.

In reply to Marilyn Fleming

Re: Calculating final grades

by P J -
Hi Marilyn, I have a question regarding something I've been trying to do. You stated:

>I already hacked grades.php so the total grade for a course reports "incomplete"
>(instead of a number) when any graded activity in the course doesn't have a grade yet.

I would really like to do this. Would you mind sharing the hack with me? Thank you!
In reply to P J

Re: Calculating final grades

by Itamar Tzadok -
Note the date of the post you replied to. With recent versions you should be able to achieve that by using letter grades or outcomes and without hacking the code. smile