As teacher, create a quiz and set a close date and set When time expires to Allow a grace period to submit, but not change any responses and do not create a time limit. Set Submission grace period to a suitable amount of time to let you do the tests below.
1. As a student, start a quiz attempt and answer some questions. Then log out of Moodle. The quiz cron has not run yet.
2. Wait until the end date of the quiz has expired.
3. The quiz cron runs.
4. Log in as teacher, and you will be able to see that the attempt has been updated to be Overdue.
5. Login as a student and click the Continue last attempt button and you will be taken to the summary page, where you are told you can still submit up to a certain time.
6. Do not submit the attempt before the grace period expires. Then refresh the page and check that the attempt is set to "Never submitted".
7. Login as teacher and check that that the attempt is set to "never submitted" and has not been graded.