moosh icon indicating copy to clipboard operation
moosh copied to clipboard

How to add subcategory to old categories without the duplicates?

Open Jarvil opened this issue 9 years ago • 1 comments

  • moosh version: 0.23
  • moodle version: 3.1
    • database: MySQL 5.5.52
  • php version: 5.6.24
  • operating system: Debian 8

Actual behaviour

I have exported course category list from Moodle with command: moosh category-export 0

The XML file has structure


<categories>

<category oldid='1' idnumber='Miscellaneous' name='Miscellaneous'>
<category oldid='7' name='ABC'></category>
<category oldid='8' name='DEF'></category>
</category>

</categories>

Where Miscellaneous is the parent-category and ABC and DEF are subcategories. Now when I want to add new subcategory called HIJ


<categories>
<category oldid='1' idnumber='Miscellaneous' name='Miscellaneous'>
<category oldid='7' name='ABC'></category>
<category oldid='8' name='DEF'></category>
<category oldid='9' name='HIJ'></category>
</category>
</categories>

Then when I import the xml file to Moodle with moosh category-import categor-to-import.xml every course category expected the HIJ is duplicated in Moodle. So after the export the category list looks like this:

Miscellaneous ABC DEF Miscellaneous ABC DEF HIJ

It seems that category oldid= doesn't do anything.

Expected behaviour

I wish that only new subcategory would appear under the existing category, not that the every main and subcategory are duplicated with the HIJ under the new duplicate Miscellaneous-parent category

Steps to reproduce

See beginning of this message

Jarvil avatar Oct 13 '16 08:10 Jarvil

Anybody?

Jarvil avatar Oct 18 '16 06:10 Jarvil