Imported Hot Pot links not converted to new course ID

Imported Hot Pot links not converted to new course ID

by Carly Born -
Number of replies: 7
Hello, HotPot Experts!

I recently had an issue that made me wonder why it worked this way. Here's the scenario:

I had a course that had a ton of stuff in it, HotPots and many other kids of resources and assignments. We imported this course from last term into this upcoming terms course site.

Because the prof was frustrated with some of Moodle's basic concepts, he created a very large Label at the top of the course that contained absolute links to all of the resources and assignements, etc that were in boxes lower in the course.

When we imported this course into a new site a curious thing happened: the absolute links to resources and assignments seemed to be automatically converted by Moodle to link to the files in the new course (i.e. the course ID that is part of the link was updated to be the new course ID). However, Moodle did not do this for the HotPot items.

I was not expecting any of them to be updated, but was pleasantly surprised that some of them were. But now my question is, why were other links to internal resources updated but not the links to the HotPot exercises?
Average of ratings: -
In reply to Carly Born

Re: Imported Hot Pot links not converted to new course ID

by Gordon Bateson -
Picture of Core developers Picture of Peer reviewers Picture of Plugin developers
Hi Carly,
the HotPot module is missing the backup and restore function which fixes up those links.

The functions are called "hotpot_encode_content_links()" in "mod/hotpot/backuplib.php" and "hotpot_decode_content_links()" in "mod/hotpot/restorelib.php".

I am adding these functions to the QuizPort module at the moment, and while I am at it I may well add them to the HotPot module too.

thanks for alerting me to this issue
Gordon
In reply to Gordon Bateson

Re: Imported Hot Pot links not converted to new course ID

by Carly Born -
Gordon,

Ah, that's excellent! Is there a patch we can apply? We just setup our server for the school year and it would be excellent if we could get this fix in place ASAP. We have a large number of HotPot exercises in some of our courses and I don't want the faculty to get discouraged from using them!

Thanks !
In reply to Carly Born

Re: Imported Hot Pot links not converted to new course ID

by Gordon Bateson -
Picture of Core developers Picture of Peer reviewers Picture of Plugin developers
> Is there a patch we can apply?

Not yet, but I think there will be soon.

I did the QuizPort functions yesterday and they seem to be working well. It should not take too long to do the HotPot functions once I get started on them.

My "ASAP list" has a number of items on it already though, so please be patient a little longer wink
In reply to Gordon Bateson

Re: Imported Hot Pot links not converted to new course ID

by Gordon Bateson -
Picture of Core developers Picture of Peer reviewers Picture of Plugin developers
Thank you for waiting ...

I have added the necessary encode/decode functions to the backup and restore scripts for the HotPot module in Moodle 1.5 -> 2.0. You can download the updated scripts from the Moodle CVS depository in due course

If you are in a hurry and want the scripts ASAP you can download the latest version of the HotPot module for Moodle 1.9 from my server:
Please note that the adjusting of links to HotPots will not work on backups you have already made. It will only work on backups that you make from now on, using the new HotPot backup scripts.

all the best
Gordon
In reply to Gordon Bateson

Re: Imported Hot Pot links not converted to new course ID

by Carly Born -
Wow, you must work at lightening speed if that is what you call 'needing a bit longer'! Thanks a bunch for this, I really appreciate it!
In reply to Carly Born

Re: Imported Hot Pot links not converted to new course ID

by Carly Born -
Hey Gordon,

The patch seems to work, except.....

  1. When linking to an HP activity from within a Label (and maybe a webpage),
  2. and then importing that label from one course to another
the link is initially malformed. Instead of linking to the actual path, it seems to be storing the link as a variable.

The link appears as:
/course/$@HOTPOT*view*id*62767@$

when it should be:
https://moodle.test.carleton.edu/mod/hotpot/view.php?id=86496

Editing the label and saving it (without making any actual changes) fixes the issue.

I saw this before and after your recent patch.

Just thought you'd want to know!
In reply to Carly Born

Re: Imported Hot Pot links not converted to new course ID

by Gordon Bateson -
Picture of Core developers Picture of Peer reviewers Picture of Plugin developers
Hi Carly,
thanks for the extra info.

I had the same experience, and not just with HotPots. Interactivity links in Labels *always* behave like this. Probably it because the course page cache is generated before the links are replaced.

As you have discovered, the workaround is to force Moodle to regenerate the cache, by editing the Label or hiding and then unhiding a course topic/week

all the best
Gordon