Moodle

New category import not backward compatibe. It needs to be

Details

  • Type: Bug Bug
  • Status: Reopened Reopened
  • Priority: Major Major
  • Resolution: Unresolved
  • Affects Version/s: 1.9
  • Fix Version/s: STABLE backlog
  • Component/s: Questions
  • Labels:
    None
  • Affected Branches:
    MOODLE_19_STABLE

Description

The new style category system has changed the format in GIFT and XML import files. The category now has two parts. However, this breaks old-style files that only had the category name - the help doesn't even mention the new style.

This has to be modified to handle the old style (category name only) files without error.

Issue Links

Activity

Hide
Mark Berthelemy added a comment -

Please could you explain the two part category? How should we add a category to the GIFT file?

Show
Mark Berthelemy added a comment - Please could you explain the two part category? How should we add a category to the GIFT file?
Hide
Howard Miller added a comment -

preg_match was being used incorrectly so the lack of the question context string went undetected. Sorted!

Show
Howard Miller added a comment - preg_match was being used incorrectly so the lack of the question context string went undetected. Sorted!
Hide
Tim Hunt added a comment -

Sorry, Howard, I just tested and this does not work for me in all cases. I created some questions in 1.7 and exported them including the category. Then I tried to import them into 1.9, and it failed basically because it is expecting XML like

<question type="category">
<category>
<text>$course$/Default for CF101/Essay type's questions</text>
</category>
</question>

But 1.7 outputs

<question type="category">
<category>
Default/Essay type's questions
</category>
</question>

Importing the same file to 1.8 also fails.

Importing a 1.9 export with categories into 1.8 mostly works, however, you get a top-level category called $course$.

Importing 1.9 -> 1.7 fails on essay questions because of a database error beacuse penalty is null (this is on Postgres)

Imorting 1.8 -> 1.9 seems to work fine.

The question is, how much more work is it worth doing to support old versions nicely.

Show
Tim Hunt added a comment - Sorry, Howard, I just tested and this does not work for me in all cases. I created some questions in 1.7 and exported them including the category. Then I tried to import them into 1.9, and it failed basically because it is expecting XML like <question type="category"> <category> <text>$course$/Default for CF101/Essay type's questions</text> </category> </question> But 1.7 outputs <question type="category"> <category> Default/Essay type's questions </category> </question> Importing the same file to 1.8 also fails. Importing a 1.9 export with categories into 1.8 mostly works, however, you get a top-level category called $course$. Importing 1.9 -> 1.7 fails on essay questions because of a database error beacuse penalty is null (this is on Postgres) Imorting 1.8 -> 1.9 seems to work fine. The question is, how much more work is it worth doing to support old versions nicely.
Hide
Howard Miller added a comment -

Ok... I've got a couple of days holiday... but I'll look at this again asap.

Show
Howard Miller added a comment - Ok... I've got a couple of days holiday... but I'll look at this again asap.
Hide
Tim Hunt added a comment -

Thanks Howard.

Show
Tim Hunt added a comment - Thanks Howard.
Hide
Martin Dougiamas added a comment -

Howard?

Show
Martin Dougiamas added a comment - Howard?
Hide
Howard Miller added a comment -

I'm reading this again, and what Tim seems to be saying is that files generated in 1.9 don't work in 1.8 or 1.7. Is this actually an issue? We have never guaranteed backward compatibility, anyway.

My initial complaint (which I think/hope I fixed) was that exports from earlier versions of Moodle didn't import in 1.9 - which we do say we support.

Show
Howard Miller added a comment - I'm reading this again, and what Tim seems to be saying is that files generated in 1.9 don't work in 1.8 or 1.7. Is this actually an issue? We have never guaranteed backward compatibility, anyway. My initial complaint (which I think/hope I fixed) was that exports from earlier versions of Moodle didn't import in 1.9 - which we do say we support.
Hide
Tim Hunt added a comment -

I tested all permutations, are reported all failures, but I agree 1.9 -> earlier is not required.

The serious issue is the first one. If you export questions from 1.7 they will not import into 1.9. I think that should work.

Thanks for looking into this.

Show
Tim Hunt added a comment - I tested all permutations, are reported all failures, but I agree 1.9 -> earlier is not required. The serious issue is the first one. If you export questions from 1.7 they will not import into 1.9. I think that should work. Thanks for looking into this.
Hide
Howard Miller added a comment -

Tim,

Ok, noted. I'll spark up a copy of 1.7 and give it a try. I'm quite surprised as I didn't think 1.7 was any different to 1.8!

Show
Howard Miller added a comment - Tim, Ok, noted. I'll spark up a copy of 1.7 and give it a try. I'm quite surprised as I didn't think 1.7 was any different to 1.8!

People

Vote (1)
Watch (3)

Dates

  • Created:
    Updated: