bug in interactive video

Hi,

When I upgraded interactive video (with some extras of my own), the older videos stoped work.

After 3 days(!) I found (like in the jokes) a semi-colon in the file - "upgrades.js".

Since I didn't even know this file exists I checked the original file in your place at github and saw the semi-colon in there, in  line 195:

https://github.com/h5p/h5p-interactive-video/blob/master/upgrades.js

Please remove it, to spare others go through what I went through :)

Thanks,

Lihi

otacke's picture

Hi Lihi!

I'm not quite sure if I can follow. I don't see anything wrong with the semi-colon being at the end of line 195 -- neither on the master branch that you're referencing nor on the release branch that contains the files that will have been used when you updateted Interactive Video. Could you please provide more detail?

Best,
OIiver

I'm not entirely familiar with JS and I thought at first it's a wrong syntax. I understand now it's not.

still - without the semi-colon all interactive videos, from version 1.16 and from version 1.19, are working (I deleted the semi-colon, raised the patch version, zipped the code and upgraded the package).

with the semi-colon the videos from the older version (1.16) - fail, announcing (in console) they are unable to build a constructor for interactivevideo-1.16. (The ones from 1.19 are still working fine).

otacke's picture

Hi Lihi!

It's actually hard to say in what state your system is now and what might be wrong (especially if you have changed things yourself). If the constructor for Interactive Video 1.16 is missing, then the corresponding library is probably gone for some reason although the old content is still in need of it. You could check that on the library page.

In theory, you could add an older library yourself manually, but that would probably involve deleting caches and modifying the database. You could also try to download/retrieve the old files from your system, upload them to a blank host system with H5P but no libraries, then upgrade to a later version of Interactive Video there, download the files afterwards and upload them to your current system again. If the upgrade script failed before however, it might fail again -- but in that case your old content would remain untouched, and no libraries would be removed either way.

I really cannot say why the semi-colon would make any difference for running the content. First, the semi-colon is basically optional in JavaScript. Second, the upgrade.js file is only run if you click on the green arrow next to a library in order to upgrade old content.

Best,
Oliver

Hi Oliver,

Thank you for the detailed answer.

I‘m completely puzzled about what’s going on there. The library is definitely exists. I see it in moodledata (the moodle׳s library for installing data). I thought the upgrade, in a transparent way, is operated when I execute a lower grade library in a system with a newer version. I understand from your answer this is not the case, still it works without the semicolon and doesn׳t work without it. anyway, since it works now, I will take the advice of the programmer that answred his sun that asked him how the sun shines - It works, don’t touch it.  

Thank you very much.

Lihi

otacke's picture

Hi Lihi!

I am puzzled as well. The upgrade script doesn't run automatically, because we leave the decision about upgrading old content to the user. Design or functionality may change in later versions, and not everyone might want these changes on existing content.

Good to hear that you have a working solution. Please note however, that if there's something weird going on on your system, them upcoming upgrades might not work either.

Best,
Oliver