This is a rather technical question, but I thought I would ask anyway.
In Moodle, lots of things (for example users, courses, course categories, activities, groups, ... have a filed called 'ID number' which is mostly not used by Moodle. It is there to give things a unique identity, to help refer to them, particuarly when linking with external systems. For examle user.idnumber is often used to link to the student ID in a student record system, for example when using database authentication; and that, in combination with course and group idnumbers can be used by enrolment plugins to automatically put users in the right courses, groups and cohorts.
(There are a few exceptions to the 'not used in Moodle' bit. For example activity/grade_item idnumbers are used when you are setting up gradebook calculations.)
Until now, questions and question_categories have not had idnumbers, but for a project we are working on, we think the best option is to add them, so we have created MDL-62708.
The plus side is that it gives you another way to uniquely identify questions, that is otherwise normally hidden from students. The only negative I can see is that this would then be an additional field on the Edit question form which people would have to ignore if they did not want to use it. (Which is more of a problem for activities like StudentQuiz than for the Question bank, I think.)
So, what do people think about this proposed change? Thanks in advance if you can gives your opinion.
Because this is not about quizzes. Questions live in the question bank.
The project we are working on is our own equivalent of https://moodle.org/plugins/filter_simplequestion. (And, for various reasons, we are pretty sure we need to build our own version of that plugin, rather than build on the existing one.) The issues we are trying to address are: how to uniquely identify the question you want to embed (in a way that will still work after you have made a copy of the course by backing it up and restoring it), and how can you restrict which questions can be embedded (by only making it possible to embed questions where both the question and the category have had an idnumber added).
Look forward to an improved version of Simple question. It does appear to fill a need that was out there despite its limitations. Also I was thinking about re-doing it, so saves me the trouble.
Simple lesson: https://github.com/richardjonesnz/moodle_mod_simplelesson.
In this case wouldn't the requirement be that idnumber is unique in a given course context rather than system? When the course is restored, the idnumber should belong to a restored question in the course question bank.
By context I assume that means course in this case. Then I think that adding a field to the question bank is not necessarily the right way to approach the problem. The difficulty is that defining question sets is normally done in a activity rather than a filter. An activity has the backup machinery to store the question information, but filters do not so you are trying to build it into the question bank.
A current workaround for embedding a question would be to create a one question ungraded quiz or qpractice which is set to stealth mode, enable the activity autolinking filter, and include thie quiz name in another activity. This will backup and restore properly.
That process could be improved by modifying the filter to embedded of popup the quiz and display alternate text, create simplified quiz activity that can define question by aliases.
This may not be as simple for the teachers to set up, but allows them to control other parameters like question behaviour.
I don't think you have understood our goal.
Our goal is to present students with an experience like this http://www.open.ac.uk/openmarkexamples/text-response/structured-response, which could be used anywhere, for example in a Page or Book resource, or even in a label on the course page.
I link to a quiz is not the same thing at all.
No that is what i was thinking about. Yes quiz module is overkill I know. In this case start attempt, submissions, etc. are not really desired. Rather than linking to the quiz the filter code be made to embedded the questions directly into page (and update possibly with AJAX).
My suggestion is that you define the questions that are accessible to the filter in a quiz (or qpractice), and then use the filter to embed them as you like. That could be done without changing the question bank. Every thing gets backed up and restored nicely.
I was not suggesting the current quiz and activity are experiencially the same, but more topologically homeomorphic.
That is a much more complex design, and it does not even solve the backup and restore issue: you can make a backup that includes one activity but not another. Also, how you going to identify which question from the quiz is being embedded in each place?
Sorry, but I think your suggestion creates more problems then it solves.
I know it sounds little complex, but I do not think it would be in practice. With full course backup activities and filter settings are saved and restored together already.. Individual questions could be identified as Embeded Quiz#7 meaning 7th question of quiz named Embeded Quiz.
Last night I made a filter to embed H5P questions just to test the idea. It is available at https://github.com/dthies/moodle-filter_hvp.
I do not think idnumber is bad, but I am just not convinced it will be that easy.
Well, we are the ones implementing this, and we still think that using idnumber will be the easiest thing for our teachers to use (most important) and also makes it easy to implement the filter. Implementing question and question_category idnumber in Moodle core is not entirely simple because there are some tricky things to get right (e.g. what happens if you restore a backup adding to an existing course?) but my colleagues John is working on that, and has got most of these issues addressed already (see the tracker issue if you are interested.)
Database wise it totally makes sense to have unique identifiers. In the question part, can this not come from the question name though? I thought that field was already unique? That would save an additional field and people are already using that field to create question identifiers that are understandable to them.
I think using question names that clearly and uniquely identify the question is good practice, but they are not required to be unique in the database schema, nor in the code, and there is not an index on that column.
Therefore, I think a separate field for a machine-readable seems to add some additional value.
I still like the idea of adding a general metadata system to Moodle, that allows a variety of contexts to have metadata and values added to them. ID numbers would simply be an instance of metadata.
I played with a POC for this type of system with a local metadata plugin, based loosely off of the custom user field system. For the question ID number proposal, questions and question categories simply need to be added as context subplugins.
I think a general system would be better than adding specific metadata to various pieces in Moodle. We have tags now, but metadata adds the extra ability to have specific values for each datum.
When previewing a question from the 'Editing quiz: Question name' page, the address shows an id number, for example '456' in "https://demo.moodle.net/question/preview.php?id=456&cmid=600". Isn't this a question id number, unique and automatically generated by Moodle, that you could use?
Of course, all entities in Moodle have an automatically genereated id like that. It is a unique identifier, but it is limited:
- It is an automatically generated integer. You have no control over it which is a difficulty if you want the identifier to be meaningful in some way.
- When you do something like backup and restore a course, in the restored course, the id will change, which would break any links that depend on it.
Is this a fair summary of the opinions expressed so far in this thread:
Supports the idea
- Tim Hunt
- Marcus Green
- Richard Jones
- Emma Richardson - wonders if Question name is sufficient.
- Daniel Thies - tried to suggest an alternative approach
- Dominique Bauer - wonders why we can't just use id
- Mike Churchward - since he wants a completely general metadata system
So, the balance of opinion was slighly positive, and of the reasons given to not do this, I have not yet read anything that convinces me not to continue with this.
Therefore, I am planning to submit the code (written by my colleague John in MDL-62708) for integration next week (unless someone comes up with a convincing last-minute objection). Thanks.
Hi all, I've read the discussion and it's awesome to see so many great ideas!
I really liked Mike's metadata idea, but that's something that should be done in the whole core, not just question. Daniel suggestions is also really good, something like we did for tags where you can have different tags for different contexts. But again, it would take more time and resources to implement.
Honestly, I'm leaning towards Tim's idea for starters, but in my honest opinion it should NOT be unique.
AFAIK users and others accepts an non-unique id number, so for consistency sake I'd suggest follow same behaviour on question. (actually just noticed groups require an unique id number)
Like mentioned above, this is mostly used to connect with external systems (like users for instance), so adding uniqueness to that field will help in some cases but pretty sure it can be a stress for others.
An idea would be adding a confirmation message when adding a new question, something like "There are other questions using same id number, do you want to add this question anyway? "
That would prevent duplicated id numbers on questions and would also be flexible enough to let users use that field accordingly to their needs.
Thanks for your comments.
Groups require a unique idnumber within one courseid.
Grade items and course_modules (which are sometimes the same thing, e.g. assignment and quiz) .
I never knew that user.idnumber was not forced to be unique. Since it is often used for data integration, I imagine non-unique user idnumbers woudl be really bad. Certainly they woudl cause havoc at the Open University. In practice, at the OU, we don't have any dupicate idnumbers, even though we have 998,191 rows in our user table.
So, anyway, uniqueness makes more sense to me, and is done for several other idnumbers already, so I favour keeping uniqueness.