I have built a custom script that alerts teachers/managers when a student needs to retake their yearly quiz. Ever morning, the cron script looks in the grades table for all 10/10 grades, looks at the the date the record was created, then sends out an email to the corresponding teacher/manager if it was recorded 351 days ago. This script is working as intended.
Here is my problem: My client has asked me to insert some older (pre-moodle) grades into the system. I was provided a pretty organized spreadsheet which appears to have all of the info I need. I looked into converting it to CSV and doing a grade import through the UI. However, I am not seeing the ability to retain the date that the grade was recorded. This information is essential.
So, since the moodle UI doesn't appear to support the ability to retain dates when inserting grades, I can develop a script that will manually insert grades into the grades table. However, when looking at the userids for each grade, and referencing them with the users table, I am seeing that some users have null userids.Some have userids and some don't.
If I can match a name to a user ID I can insert the grades with my script, but since some users do not have userids recorded I am not sure what my next step is.
Can someone please explain the best way to do a batch insert into the grades table, while retaining the date recorded, and connecting that grade to the proper user?
My spreadsheet my client provided contains the full first and last name, the grade, the highest grade possible (100%), the date is was recorded and the quiz name. All of this data is formatted identical to the data in the DB.
Any ideas? Your help is GREATLY appreciated.