What happens in the 1.9 gradebook when students are unenrolled from a course

What happens in the 1.9 gradebook when students are unenrolled from a course

by Tim Hunt -
Number of replies: 8
Picture of Core developers Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers
Here are some scenarios:

A. Mistaken unerollment

We have a course with some custom grade columns. A user Fred is enrolled in this course as a student, and has some manually assigned grades in these custom columns.
  1. Fred is unenrolled from the course.
  2. Will Fred be listed in the gradebook now?
  3. If the grades for one of the custom columns is exported (let's say to XML) Will Fred's grade be included in the export file?
  4. You realise that unenrolling Fred was a mistake, so you re-enrol him.
  5. Will Fred's custom marks have been remembered?

B. Importing a file with extra users in it

In a school, every student has to study the compulsory course Tadpoles. Then, they may, or may not to go on to the optional follow-up course Frogs. The teacher on the course Frogs wants to see the score for course tadpoles in the gradebook for course Frogs. So they:

  1. Export the course grade for course Tadpoles in XML format.
  2. Go to the gradebook for course Frogs, and add a custom column called 'Tadpoles final score'.
  3. Import the XML export they just did.
  4. The XML export contains the results for more users than there are enrolled in course Frogs. When the import is done, how much data is stored in the database?
  5. Suppose Fred originally decided not to do course Frogs, then changed his mind. When he is enrolled late on course Frogs, will his score in the 'Tadpoles final score' column already be present, or will it need to be copied manually?

C. Import from an external source

You have an file of grades in Moodle XML format, but this came from an external source, and it contains the ids of some users that are known to Moodle, and some that are not in the Moodle database. What happens when you try to import this file? It would be good if you could import all the scores of people know to Moodle, while ignoring those who are not (but may have a list of ignored users printed on screen as the import progresses).

In reply to Tim Hunt

Re: What happens in the 1.9 gradebook when students are unenrolled from a course

by Tim Hunt -
Picture of Core developers Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers
Some answers, based on experimentation.

A.2 No, Fred is not displayed in the gradebook after he has been unenrolled.
A.3 And he is not included in an export.
A.5 When Fred is re-enrolled, we find that his grade has been retained.

Therefore, we see that the database retains all grades once they have been awarded. That prompts a follow-up question:

Under what circumstances are orphan grades like this cleaned up?
In reply to Tim Hunt

Re: What happens in the 1.9 gradebook when students are unenrolled from a course

by Petr Skoda -
Picture of Core developers Picture of Documentation writers Picture of Peer reviewers Picture of Plugin developers
They are removed only when you delete or reset the course.
In reply to Petr Skoda

Re: What happens in the 1.9 gradebook when students are unenrolled from a course

by Séverin Terrier -
Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Testers Picture of Translators
In fact, everything just acts like in previous versions smile wink
In reply to Tim Hunt

Re: What happens in the 1.9 gradebook when students are unenrolled from a course

by John Moore -

Very informative.  Perhaps this is a bad question, but is there a way to view records/grades of students unenrolled so one can know which students have completed training in the past?  Seems if Moodle is used in acedemia, one would want to be able to refer to historical data from classes gone by without searching for a printed record.

In our case, we use Moodle for safety training and would like to refer to employee training records not only after they've unenrolled, but even if they've left the company.

In reply to John Moore

Re: What happens in the 1.9 gradebook when students are unenrolled from a course

by Jeff Snyder -
John--i wish there was an easier way too, but the only way to see grades of currently unenroled students (afaik) is to use Tim's customsql plug-in and execute the "show all grades of all users" query. I can help you with filering out the courses you don't want to view if you need, as we're using it currently for the same purpose as you.

--Jeff
In reply to John Moore

Re: What happens in the 1.9 gradebook when students are unenrolled from a course

by Elena Ivanova -
Hi John,
You can use this workaround.
Set up a new role, which should an exact replica of a student one, and which should be set to appear in the gradebook, e.g. we name it Participant, so we can re-use it later for various other reasons (Administrator of you system will have to do that, plus you as a teacher should be allowed to override and/or assign roles).

Step 1:

1. Go to Administration > Assign Roles.
2. Click Override Permissions tab.
3. Click Participant.
4. Locate View courses capability, and set it to Prevent.
5. Scroll down and Save changes. From now on, any user who has a Participant role in this site, will not be able to see the site anymore.

Step 2:

1. Click Locally Assigned Roles tab.
2. Click Participant.
3. Search for students that you want to deny access to. Add them to the Participant role.

This way those users will not longer see your moodle course, but you will still see them and their records in the gradebook, quizzes and assignments.
In reply to Tim Hunt

Re: What happens in the 1.9 gradebook when students are unenrolled from a course

by Tim Hunt -
Picture of Core developers Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers
After more experimentation (and a sing through of the Faure Requiem)

B.4 The scores for all users are stored in the database, so.
B.5 If you later enrol a user whose score was previously imported, then that user's score shows up immediately.

(Testing this, I discovered MDL-12912)

Wouldn't it be useful if, in the Import process, there was some user interface that let you say "The score that is stored in the file with idnumber 'xyz1', please import it into column with idnumber 'pqr7'". Perhaps I should file that as a feature request.
In reply to Tim Hunt

Re: What happens in the 1.9 gradebook when students are unenrolled from a course

by Tim Hunt -
Picture of Core developers Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers
And testing C.

If you you have a user in the XML file that Moodle does not recognise, then you just get the error 'Supplied user is invalid' and nothing is imported.

I can see that being a real pain if you have an XML file with thousands of users, and it does not tell you which one is invalid. I think I am about to go and check in some more helpful error messages.