Quiz IDs

Quiz IDs

by Blair F. -
Number of replies: 4
Picture of Particularly helpful Moodlers

I feel really dumb having to ask this, but I've been struggling with this for about an hour and it's the end of my day and I'm just so over it and I'm quite willing to be embarrassed. 

In this.. "/mod/quiz/view.php?id=77408" ... WHAT is the 77408 and in what table will I find it? It would seem obvious that it's the quiz ID but it is not. Not that it matters, but the quiz id for this one is actually 6603. 

Happy holidays, all.


Average of ratings: -
In reply to Blair F.

Re: Quiz IDs

by Tim Hunt -
Picture of Core developers Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers
77408 is the course_module id.

In Moodle, you have got activities of all different types (quizzes, forums, pages, books, ...). They all have some settings in common, and those things are stored in the course_modules table. Then they have settings that are specific to the type of activity, and they are stored in tables like quiz, forum, page, ... (except for historical anomalies like that fact that name is stored in each separate table. Life would be easier (as a Moodle developer) if it was in course_modules, but it is too painful to change now, so we are stuck with it.

In course_modules, the 'module' column links to the 'modules' table, which tells you which type of activity it is, then the 'instance' column links to the id in the relevant table.

So, in your example, row 77408 of the course_modules table should contain 6603 in the instance column.
Average of ratings: Useful (1)
In reply to Tim Hunt

Re: Quiz IDs

by Blair F. -
Picture of Particularly helpful Moodlers
Thank you!! I greatly appreciate your explanation. Happy Holidays, Tim. smile
In reply to Blair F.

Re: Quiz IDs

by Marcus Green -
Picture of Core developers Picture of Particularly helpful Moodlers Picture of Plugin developers Picture of Testers
You can get an idea of how stuff links together from my Moodle database ER diagrams here
https://examulator.com/er/
Average of ratings: Useful (1)
In reply to Marcus Green

Re: Quiz IDs

by Blair F. -
Picture of Particularly helpful Moodlers
Thanks, Marcus. I use that all the time. Daily, even. I just wasn't able to figure this one out. Maybe my brain is in Christmas mode.