Moodle
  1. Moodle
  2. MDL-24142

Backup missing questions in more situations than expected

    Details

    • Type: Bug Bug
    • Status: Open
    • Priority: Critical Critical
    • Resolution: Unresolved
    • Affects Version/s: 1.9.9, 2.0
    • Fix Version/s: STABLE backlog
    • Component/s: Questions, Quiz
    • Labels:
    • Database:
      Any
    • Difficulty:
      Difficult
    • Affected Branches:
      MOODLE_19_STABLE, MOODLE_20_STABLE
    • Rank:
      985

      Description

      In the past we have had numerous reports about not all questions being included in backup, leading to restore errors. This is one example of report: MDL-16275 (sure there are more).

      Until now we thought it was one more or less uncommon situation, but reviewing the code I think it is really easy to get a non-consistent backup, missing entire categories.

      To reproduce:

      1) Just create two categories, "A" and "B", then create one course "course A" in category "A".
      2) In "course A" create one quiz and add one question to the category "A".
      3) Move the course from category "A" to "category "B".
      4) Make one backup of the course. The generated backup will be missing any question, so will break on restore for sure.

      So, any course moved to another "branch" category using questions from question banks over course level will lead to broken backups. Really horrible.

      Also, at the end... you can have one quiz using questions from any other context in the server what breaks any capability checking and friends.

      IMO this should be fixed ASAP in 1.9 and reworked in 2.0. Also, ideally... we should prevent course movements to another branches if there are category-level question banks associated, to avoid the spread of questions transversally ASAP.

      Ciao

      1. A_B.diff.txt
        2 kB
        Eloy Lafuente (stronk7)

        Activity

        Eloy Lafuente (stronk7) created issue -
        Hide
        Eloy Lafuente (stronk7) added a comment -

        Attached:

        • A.zip: Moodle 1.9 backup of course in category A
        • B.zip: Moodle 1.9 backup of same course once moved to category B
        • A_B.diff.txt: Differences of both backups, apart from the tiny ones, note the whole question category is missing in B.

        Ciao

        Show
        Eloy Lafuente (stronk7) added a comment - Attached: A.zip: Moodle 1.9 backup of course in category A B.zip: Moodle 1.9 backup of same course once moved to category B A_B.diff.txt: Differences of both backups, apart from the tiny ones, note the whole question category is missing in B. Ciao
        Eloy Lafuente (stronk7) made changes -
        Field Original Value New Value
        Attachment A.zip [ 21358 ]
        Attachment B.zip [ 21359 ]
        Attachment A_B.diff.txt [ 21360 ]
        Hide
        Pierre Pichet added a comment - - edited

        A real case is the following as used at UQAM Moodle 1.9.
        As teacher I have access to many courses some with other teachers.
        So there is a category for each different courses and an additional category for me as user PICHET_P .

        So I store in my personal category PICHET_P, questions I need in different courses and use them to create quiz in the different courses.

        I can control which can use or create question in this personal category.

        Not being an adiminstrator of the UQAM, I don't know how they handle backups.

        This get me realize that there questions are used in many courses although they are not in any courses by themselves. They are somehow in the database and any backup and restore at the course level will scramble things.

        Somehow in my case things are simpler because the questions do not imply files (i.e. images) that will need to be store in one or more courses...

        Show
        Pierre Pichet added a comment - - edited A real case is the following as used at UQAM Moodle 1.9. As teacher I have access to many courses some with other teachers. So there is a category for each different courses and an additional category for me as user PICHET_P . So I store in my personal category PICHET_P, questions I need in different courses and use them to create quiz in the different courses. I can control which can use or create question in this personal category. Not being an adiminstrator of the UQAM, I don't know how they handle backups. This get me realize that there questions are used in many courses although they are not in any courses by themselves. They are somehow in the database and any backup and restore at the course level will scramble things. Somehow in my case things are simpler because the questions do not imply files (i.e. images) that will need to be store in one or more courses...
        Hide
        Martin Dougiamas added a comment -

        Help, Tim!

        Show
        Martin Dougiamas added a comment - Help, Tim!
        Hide
        Eloy Lafuente (stronk7) added a comment -

        Pierre,

        your "personal category" PICHET_P... is it a course category containing one question category? Or one questions category under your user context?

        I hope it is the former (one course category). I really didn't know it was possible to have questions under "user" contexts?

        In any case, that question category (belonging to the PICHET_P "context") won't be being saved in backup if it is in another branch different from the one the quiz (course) is in.

        Ciao

        Show
        Eloy Lafuente (stronk7) added a comment - Pierre, your "personal category" PICHET_P... is it a course category containing one question category? Or one questions category under your user context? I hope it is the former (one course category). I really didn't know it was possible to have questions under "user" contexts? In any case, that question category (belonging to the PICHET_P "context") won't be being saved in backup if it is in another branch different from the one the quiz (course) is in. Ciao
        Hide
        Pierre Pichet added a comment -

        Hélène Bouley (which is the moodle Uqam administrator) has been added as watcher.

        Hélène could you comment on this ?

        Show
        Pierre Pichet added a comment - Hélène Bouley (which is the moodle Uqam administrator) has been added as watcher. Hélène could you comment on this ?
        Hide
        Pierre Pichet added a comment -

        see http://moodle.org/mod/forum/discuss.php?d=118732 on this subject of category used to store questions.

        Hélène will add further comments

        Show
        Pierre Pichet added a comment - see http://moodle.org/mod/forum/discuss.php?d=118732 on this subject of category used to store questions. Hélène will add further comments
        Hide
        bouley Hélène added a comment -

        so i will try to explain even if it's not quite fresh in my mind.

        We always look ways to lighten management and offer simple stuff to our students and teachers even if it could be a little more difficult to update: the hierarchical moodle context means if you want to share questions you have to do it at category level , system level or metacourse

        • but we have to deal with the fact that not every body wants to share
        • it's easy to find examples of shared question among categories (stats questions can be use in math courses, sociology , management etc ...)
          clearly categories level and metacourses can't be used.The only way is the system level we don't think it's a good idea to give hundreds roles at system level and we have the images sharing.

        So waiting better ideas, we decided to do it in a special category and give capacity to the teach to manage all that.We 've modified some backup stuff to handle this.

        Until now it's a success ....but it remains a temporary solution.
        It doesn't work if there are images included in the questions.

        Unfortunatly, I didn't have enough time to analyse all the possibilities.

        Ideally, The question bank should be some object independent containing questions and ressources as images but I don't think it's possible.

        May be a special kind of course could be suitable ; a question bank course : each teacher could create the course, link courses to it and give roles in it : the link should be part of the question bank course and the dependent course and backuped.

        Show
        bouley Hélène added a comment - so i will try to explain even if it's not quite fresh in my mind. We always look ways to lighten management and offer simple stuff to our students and teachers even if it could be a little more difficult to update: the hierarchical moodle context means if you want to share questions you have to do it at category level , system level or metacourse but we have to deal with the fact that not every body wants to share it's easy to find examples of shared question among categories (stats questions can be use in math courses, sociology , management etc ...) clearly categories level and metacourses can't be used.The only way is the system level we don't think it's a good idea to give hundreds roles at system level and we have the images sharing. So waiting better ideas, we decided to do it in a special category and give capacity to the teach to manage all that.We 've modified some backup stuff to handle this. Until now it's a success ....but it remains a temporary solution. It doesn't work if there are images included in the questions. Unfortunatly, I didn't have enough time to analyse all the possibilities. Ideally, The question bank should be some object independent containing questions and ressources as images but I don't think it's possible. May be a special kind of course could be suitable ; a question bank course : each teacher could create the course, link courses to it and give roles in it : the link should be part of the question bank course and the dependent course and backuped.
        Hide
        Tim Hunt added a comment -

        I agree that the current situation in 1.9/2.0 sucks, and it is ultimately my fault for encouraging Jamie to write this code.

        However, the theoretical problems do not seem to actually affect users very often. We have had a few bug reports, but only a few.

        Therefore, I think the most pragmatic approach is just so ensure that Moodle 2.0 is no more broken than 1.9 was. That is, re-implement the same logic for now, and get RC1 out of the door.

        Then, do a proper fix later. Where 'proper fix' and 'later' are to be defined.

        Show
        Tim Hunt added a comment - I agree that the current situation in 1.9/2.0 sucks, and it is ultimately my fault for encouraging Jamie to write this code. However, the theoretical problems do not seem to actually affect users very often. We have had a few bug reports, but only a few. Therefore, I think the most pragmatic approach is just so ensure that Moodle 2.0 is no more broken than 1.9 was. That is, re-implement the same logic for now, and get RC1 out of the door. Then, do a proper fix later. Where 'proper fix' and 'later' are to be defined.
        Hide
        Martin Dougiamas added a comment -

        Downgrading this to Critical then, as it seems not to be a blocker for now.

        Show
        Martin Dougiamas added a comment - Downgrading this to Critical then, as it seems not to be a blocker for now.
        Martin Dougiamas made changes -
        Priority Blocker [ 1 ] Critical [ 2 ]
        Martin Dougiamas made changes -
        Fix Version/s 1.9.11 [ 10410 ]
        Fix Version/s 1.9.10 [ 10407 ]
        Martin Dougiamas made changes -
        Fix Version/s 2.0.1 [ 10420 ]
        Fix Version/s 2.0 [ 10122 ]
        Martin Dougiamas made changes -
        Workflow jira [ 38593 ] MDL Workflow [ 46730 ]
        Martin Dougiamas made changes -
        Fix Version/s 2.0.2 [ 10421 ]
        Fix Version/s 2.0.1 [ 10420 ]
        Helen Foster made changes -
        Labels triaged
        Hide
        Marcus Rejås added a comment -

        This issue is a big problem for us (running 1.9). This is also the reason for (at least for us) the bugs about questions being impossible to add to a quiz.

        Our professors use Import when they creates new courses. It is a big problem when questions does not come to the new course. Especially when many courses have hundreds of questions ...

        There seems to be a difference between question types since essay questions seems to always come through. In the xml-file in the backup-file the question instance is there, but not the question.

        Please take a look at this.

        Regards,

        /Marcus

        Show
        Marcus Rejås added a comment - This issue is a big problem for us (running 1.9). This is also the reason for (at least for us) the bugs about questions being impossible to add to a quiz. Our professors use Import when they creates new courses. It is a big problem when questions does not come to the new course. Especially when many courses have hundreds of questions ... There seems to be a difference between question types since essay questions seems to always come through. In the xml-file in the backup-file the question instance is there, but not the question. Please take a look at this. Regards, /Marcus
        Hide
        Tim Hunt added a comment -

        Needs to be fixed in both 1.9 and 2.0 branches.

        Show
        Tim Hunt added a comment - Needs to be fixed in both 1.9 and 2.0 branches.
        Tim Hunt made changes -
        Fix Version/s STABLE backlog [ 10463 ]
        Fix Version/s 2.0.2 [ 10421 ]
        Fix Version/s 1.9.11 [ 10410 ]
        Martin Dougiamas made changes -
        Workflow MDL Workflow [ 46730 ] MDL Full Workflow [ 74967 ]
        Hide
        Tim Hunt added a comment -

        This issue was assigned to me automatically, however I will not be able to work on this issue in the immediate future. In order to create a truer sense of the state of this issue and to allow other developers to have chance to become involved, I am removing myself as the assignee of this issue.

        For more information, see http://docs.moodle.org/dev/Changes_to_issue_assignment

        Show
        Tim Hunt added a comment - This issue was assigned to me automatically, however I will not be able to work on this issue in the immediate future. In order to create a truer sense of the state of this issue and to allow other developers to have chance to become involved, I am removing myself as the assignee of this issue. For more information, see http://docs.moodle.org/dev/Changes_to_issue_assignment
        Tim Hunt made changes -
        Assignee Tim Hunt [ timhunt ]

          People

          • Votes:
            3 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

            • Created:
              Updated: