catalyst / moodle-MDL-72752

GNU General Public License v3.0
0 stars 2 forks source link

Activity question bank: question sharing flag/method #43

Open mattporritt opened 3 years ago

mattporritt commented 3 years ago

Activity (mod_*) level question banks should be able to declare by Flag (or method) if they support question sharing.

For example:

mattporritt commented 3 years ago

@timhunt Is this a fair summary, anything that you can think of that needs to be added?

timhunt commented 3 years ago

This looks right.

What is the modern way to handle this? (The old way would be yet more callbacks in lib.php.)

Should we have a standard class somewhere like mod/quiz/classes/question/... I don't quite know what the class name should be, but it would sub-class a standard base class and have the methods that core needs to call to know how the quiz wants to use the question bank.

(Though the very top level, does the quiz use questions bank at all would still be through the old plugin_supports('mod_quiz', USES_QUESTIONS) and plugin_supports('mod_quiz', HAS_OWN_QUESTIONS).)

abonaccorso commented 3 years ago

sounds good also from a users point of view.

For the moment I guess it is fine if users don't see this information. If there are further plugins added, it might become necessary to have an overview/easily way to see, if a question bank shares it's questions or not. I am not sure we have to implement something here of if this could be done by the plugin itself @brendanheywood and @timhunt?

mattporritt commented 3 years ago

@safatshahin do you have any thoughts on how to best implement this?

safatshahin commented 3 years ago

Hi @mattporritt

I thought about it a bit and this is how think about the implementation: (my sincere apologies if i am thinking it totally wrong)

At the moment, all the question banks are just a thin wrapper around a question category, for ex, every quiz starts with a top category and default for quiz category. Now how i see it is, to implement the sharing of a question bank, there should be flag in the top question category object which will be saved in the database as a flag value, like share => 0 or => 1. Quiz relies on the category (which is potentially the managecategories plugin) to create categories everywhere, now while using that, quiz can mention if it want to implement the sharing. If it mentions the flag as not shareable for the top category, all the child category should be able to follow the path regardless of the location it is created. I think mod_qbank can do the same.

Now from the question bank api. it can depend on that flag while implementing the sharing feature for that specific question bank. If the flag is not sharing, then it should not implement the sharing feature and also restrict that feature if anyone tries to access the sharing feature by bypassing the url or something. I think we can move some features from questionlib to quesion/classes/local to have a better flexibility and handling on those, like the navigation node, some question bank capability checking etc. At this point, export plugin should follow the flag and act accordingly as well as the navigation loader to show or hide the export feature. (what i mean by sharing feature? please see after the next bit.)

One important point i see is, when sharing is enabled, is that a global flag for all its subcategories? or users will be the flexibility to share a subcategory instead of the top one or the whole bank, the more flexibility, the more complex it might become in the logic handling.

Now with the sharing, I can see in the wireframe it says need to be remodeled, if we are going to do a user level sharing, I was thinking of a plugin like this in the question bank: shared

The first section will be available to the users with context level permission, ex a teacher from the course, who will be able to share that question bank and also see the list of the users the question bank is shared to with the specified capabilities.

Where, the validation will need to be done in the question capability checker function in the questiolib and also in the context checker class to check if the user has context level permission or if the user has user level permission set from the question bank with view, edit, copy, comment etc.

Like for view, while the api is called, the mod_quiz plugins also check the permissions, the magic need to be done there where it will accept both context and user level permission.

For edit: same way, it should accept both type of permission and give access to the user accordingly and then version control plugins keep the records according to the user object, Same goes for comment as well.

Now the big one, use/copy, as you said, to use that user will need to copy the question bank, then i think we can use the import plugin to implement that. Import plugin does import from file, now we can use to import from question banks the user has access to. For example, i am a teacher of course A, but matt shared his question bank of a mod_qbank/mod_quiz of course B with me, now i can view, edit and i also have copy permission and i want to use it. I go to the import section, from the dropdown i see the list of question banks shared with me, i select the question bank, select the category i want to import the questions to and finally get those in my question bank in Course A. Same flexibility question here, should the user be able import specific subcategories, specific questions? or the whole bank? the more flexibility, the more complex i think.

Now the second section from the screenshot is a user level section which will show all the question banks shared with the user, it will rely on the user object regardless of the question bank you're in, and list all the banks user has access to, including the list of capabilities for that bank.

I apologize for a big reply, just wanted to share my thoughts about the sharing of question bank. I might be entirely wrong, apologies in advance for that.

Thanks

abonaccorso commented 3 years ago

@safatshahin, @mattporritt and @brendanheywood regarding sharing of toplayer of subcategories, for this project I would restrict the possibility the sharing(or not sharing) only top layer and not subcategories. The reason is that we are trying to create a well woring, flexible but simple thing. So the complexitiy of being able to share subcategories should be added in a later project. Correct me, it I am wrong @timhunt and @lucaboesch.

abonaccorso commented 3 years ago

for import I think it makes sense to have the more fine grained possibilities to import a whole bank, one or several subcategories or one or several questions. The decision if to use import plugin for this, is beyond my knowledge and abilities. But the process described by @safatshahin to me sounds too complex for an average user who does not know about the data schemes and processes behind and just wants to copy some questions from one question bank to another. Maybe we can an easier solution from a users perspective?

mattporritt commented 3 years ago

Hi, I need to re-review user stories relating to this, but I wanted to capture the basic requirements around sharing of questions as it relates to a question bank “flagging” it can share its questions. To this end I have made the following points:

Are these points correct?

There will need to be separate work for the way we carry out the sharing such as the import question plugin etc. There will also need to be work around consideration and having a fast lookup of question banks that are shared with a user. But first I just want to get the basics correct.

timhunt commented 3 years ago

Matt's summary is not right. Let me give a very developer-y answer, because I think that in terms of database Schema, it is quite clear.

So, we have to to combine two things:

And, they key bits of the DB schema (https://moodle.org/mod/forum/discuss.php?d=417599#p1688163 second image) are:

So, in these terms, the question sharing flag means: You can only create question_references (question_set_references) pointing at a question (or set of questions) if the question is in a context where this flag says sharing is allowed.

That interracts with the capabilties in this way:

So, in terms of what this means for users:

I hope that is clear, and makes sense.

mattporritt commented 3 years ago

Hi @timhunt Yes that's a clear summary and in line with our discussion on 29/06/21. For my benefit (if nothing else) I'm copying the last part of your summary below:

To be able to add questions to a quiz:
** the context where the question is needs to return true for the question sharing flag
** AND you need the USE capability in the context where the question is.
To be able to export questions:
** You need the VIEW capability (or EDIT) in the context where the question is (that's all).
To import questions (from a file you have) is only controlled by moodle/question:add where you are trying to add the questions.
safatshahin commented 3 years ago

Hi, This ticket has all the important information for qbank_sharing implementation. I have made following issues to split this work into different parts: catalyst/moodle-MDL-72752#42 catalyst/moodle-MDL-72752#41 catalyst/moodle-MDL-72752#40 catalyst/moodle-MDL-72752#39 catalyst/moodle-MDL-72752#38 Moving this ticket to the backlog with those tickets as we are going to use this for reference while implementing that feature. Cheers!