Taking a closer look at "Import course data"

Taking a closer look at "Import course data"

by Scott Krajewski -
Number of replies: 16
As we transition to our second semester of moodle the issue of content copying is coming up.  In the version we're running, Moodle 1.5.2 + (2005060222), the "Import course data" seems to the have following shortfalls:
  1. topic summaries aren't copied
  2. course files aren't copied (though references to them are)
  3. exercise module kills it
Have there been any updates in the code since our version was released?  Or are there plans to fix some of the shortfalls of the feature?  It's a great feature that institutions like mine really need to empower faculty to manage their own courses.
Average of ratings: -
In reply to Scott Krajewski

Re: Taking a closer look at "Import course data"

by Martín Langhoff -
Scott,

There have been some improvements on MOODLE_15_STABLE (just look at the release notes!). Limitations of backup/restore still apply (such as limitations wrt quiz attempts). OTOH, I haven't seen the problems you mention -- could you give us more detail on those?

For example, does performing a manual backup/restore do things better/different than using 'import course data'? Should have the exact same results, as it uses the same code...

In reply to Martín Langhoff

Re: Taking a closer look at "Import course data"

by Michael Penney -

However, it seems section titles and course structure import is still not supported in import course data.

It seems to me there should be an option to 'duplicate previous course'.

Here is the scenario: say your institution uses LDAP or other method of automatically setting up course shells. So you taught My Course 101 in the fall semester, and you had it set up how you liked it.

So your course shell gets automatically setup for My Course 101 for the spring semester, and of course it is empty as the 'template' course was.

Cool, you'll use 'import course data' to bring in 'My Course 101' from the previous semester. But that loses all your section titles and your course organization (if you had more/less sections than the template course)8-(.

So instead, you have to go into your fall course, backup the fall course, download it, upload to your spring course, and do a 'restore to current course, deleting it first', to get a duplicate of your fall course in your spring course. This is a real problem with large courses.

It seems to me the best solution would be for an option in import course data, for teachers to duplicate a course they are a teacher of, over the course they are in (with a warning of course).

A second, more awkward solution would be for teachers to be allowed to use the admin feature of copying one course over another course (Restore to existing course, deleting it first), if they are a teacher of both courses.

In reply to Michael Penney

Re: Taking a closer look at "Import course data"

by Martín Langhoff -
> It seems to me there should be an option to
> 'duplicate previous course'.

Meh, I think we should fix the bug instead wink

With two reports, it sounds like we do have a bug in there... unless you two are conspiring! The thought!
In reply to Martín Langhoff

Re: Taking a closer look at "Import course data"

by Michael Penney -
Hi Martin import course data is still not importing topic/week summaries in 1.5.3+.

We need to fix this now, do you all have a planned approach? Two choices seem to be:

1) Add a check box for summaries which allows teachers to import the entire course.

2) Fix backup/restore so that teachers can backup (replace completely) into any of the courses they own (why in the world can't they?).
In reply to Michael Penney

Re: Taking a closer look at "Import course data"

by Scott Krajewski -
I wanted to second this.  As we're moving into our second full trimester of all moodle the moving of course data between courses is becoming a bigger request.  "Import course data" is almost there.  If can just get the last few pieces working it will be super great for faculty.

--S
In reply to Scott Krajewski

Re: Taking a closer look at "Import course data"

by Michael Penney -
Mark and I just made an edit, replacing iscoursecreator with isteacheredit  ($id) in the backup and restore form. This lets teachers restore a course they are a teacher of into another course they are a teacher of. It still seems pretty silly to prevent them from doing this. It would be easier if replacing the contents of a course shell with the contents of a previous course were handled by import course data.

How does NZVLE handle semester transitions without this?
In reply to Michael Penney

Re: Taking a closer look at "Import course data"

by Bryan Williams -
We will start calling him St. Michael if this feature gets addressed! smile  I have clients routinely tearing their hair out over the way Moodle's import course data feature mostly doesn't work (the way they thought or should work). NOW would be a really great time to get this fixed as many teachers are ramping up for summer school in the northern hemisphere and later fall classes.
In reply to Bryan Williams

Re: Taking a closer look at "Import course data"

by Art Lader -
Amen, Bryan.

It would be hugely helpful for the import course data feature to work well.

-- Art
In reply to Martín Langhoff

Re: Taking a closer look at "Import course data"

by Michael Penney -
Hi Martin, is NZLVE going to fix the problem with import course data? If not we are going to start working on this.

The idea would be an addition to our "Course Wizard", which lets facult show/hide their courses and cross-list courses (make meta-courses) from one screen. The course recycle wizard would give a list of previous courses on one side, and let them copy a previous course into an existing (empty) course shell.

In the background it would run the backup and restore code, without user data, and replace completly the empty course shell with the previous course.

That is the plan, anyway.

But we don't want too spend time on this if NZVLE is going to fix import course data in the core (currently I would call it broken as it only imports some course data, and leaves at least our faculty quite confused when it is through, since they end up with content seemingly randomly distributed in their course shell rather than a copy of the previous course strurture, block layout, etc).

It seems to me a simple fix for icd would be to include a check box for "Completely replace current course with imported course" or some such. This would be be a little more complex, but I would rather use something that is a standard feature than develop our own tool that we'll have to support.

Jeff is going to start looking at 1.6 to see if this is addressed and/or what it will take to fix it, but it would be great if you could let us know where you all are planning to go with the feature.
In reply to Martín Langhoff

Re: Taking a closer look at "Import course data"

by Jeff Graham -
Hi Martin L.,

I'm taking a look into resolving the issue of sections and blocks not being imported via import course data. Upon reviewing 1.6 it appears that there is a potential security issue as the datadir is exposed via a get URL
http://127.0.0.1/~jgraham/moodlehead/backup/restore.php?backup_unique_code=1146267612&launch=form&file=FULL_PATH_TO_DATA_DIR_AND_FILE!&id=3

To fix the mentioned 'bug' I was thinking of adjusting the script to add the following drop down options (like in a normal restore) to do the following
  • restore to existing course, deleting it first (include sections and blocks)
  • restore to existing course, adding data to it (current behavior)
Does this sound like the right approach? If so I will update and provide a patch.
In reply to Jeff Graham

Re: Taking a closer look at "Import course data"

by Martín Langhoff -
Jeff -- only becoming aware of this after seeing the bug. Looks like I got unsub'd from this forum during my holidays sad

I am happy to take patches for this, feel free to email me directly if I don't reply in the forums!
In reply to Martín Langhoff

Re: Taking a closer look at "Import course data"

by Scott Krajewski -
Martin,
The manual backup/restore is better.  The exercises are still skipped but the Topic Summaries and Course files are OK.  Additionally, the backup/restore grabs the right number of topics (with 'import course data' if you have fewer topics in the receiving shell items get dumped in topic 0) and the blocks transfer (no block transfer in 'import course data').

Something slightly different is going on in each action, at least on my box.

--Scott
In reply to Scott Krajewski

Fixing "Import course data"

by Jeff Graham -
Attached is a proposed fix for the deficient import course data as discussed in this thread.

Using the new course import structure in 1.6, I was able to fix the problems with the course import. Thanks to whomever implemented the new format. smile

The attached fix will allow the instructor of a course to import all course data into/over the existing course. Just untar the attached file into $CFG->dirroot/course/import it will be called course.

Also you will need to define the string 'importcourse' in /lang/en_utf8/moodle.php or whichever lang for your installation

This is also listed as bug 5509

Could someone review and consider it for 1.6?

regards
Jeff
In reply to Jeff Graham

Re: Fixing "Import course data"

by James Dugal -
Jeff/Martin: I gather that the preferred fix is to change the import behaviour, when possible, to do a better job.  I took a look at Jeff's patches, and also at the import restore logic, and I noted a few things:

1. No effort is presently made to import section summaries.  I have a patch for 1.5.4/1.6 that catenates the from and to course topic summaries, that works especially well when the 'to' course is empty, but at least prevents the loss of the summary text.  Perhaps this behaviour should be configurable?  It would be problematic if repeated imports were done, ie, summary text would then be duplicated.

I could have copied a 'from' summary only if the 'to' summary were empty... what's the right choice?  Maybe this is why it wasn't done originally smile ?

2. As to blocks being lost in the import, this is an explicit choice in that restore_create_blocks() isn't invoked when restoreto == 1 (ie, import).  Is this truly desirable, and again, if rectified, should it be configurable?

I liked Jeff's addition of sections/topics to the 'to' course when needed to match the section count of the 'from' course, and so I include a patch to import in both 1.5.4 and 1.6.

--James
In reply to James Dugal

Re: Fixing "Import course data"

by Jeff Graham -
Hi James,

Is the version you looked at the same as the attached version here? There were a few different versions floating around.


Also, this doesn't address an option to "backup everything and stop nagging me" that Martin and I had discussed.

This version should be a bit more organic than some of my earlier ideas.
In reply to Jeff Graham

Re: Fixing "Import course data"

by James Dugal -
HI Jeff!  I believe that is what I saw (from the bug report).  I noticed that the fifth-to-last line constructed a URL containing deleteexisting=1 but the ampersand separator seemed to be missing.

--James