Issue Details (XML | Word | Printable)

Key: MDL-11188
Type: Bug Bug
Status: Closed Closed
Resolution: Fixed
Priority: Major Major
Assignee: Piers Harding
Reporter: Hans de Zwart
Votes: 3
Watchers: 6
Operations

Add/Edit UI Mockup to this issue
If you were logged in you would be able to see more operations.
Moodle

SCORM module does not respect "prerequisites" like it used to

Created: 10/Sep/07 06:22 PM   Updated: 11/Nov/08 07:53 AM
Component/s: SCORM
Affects Version/s: 1.8.2
Fix Version/s: 1.8.7, 1.9.3

File Attachments: 1. Text File MDL-11188-moodle19.patch (30 kB)
2. Zip Archive prereqfix.zip (10 kB)
3. Zip Archive prereqmoodletestv0100.zip (12 kB)

Image Attachments:

1. scorm_prerequisites.png
(30 kB)

Participants: antoine faget, Arjen Vrielink, Dan Marsden, Eric Kirkpatrick, Hans de Zwart, Joseph Caplan, Piers Harding and Zoltán Szarvas
Security Level: None
QA Assignee: Dan Marsden
Resolved date: 14/Aug/08
Affected Branches: MOODLE_18_STABLE
Fixed Branches: MOODLE_18_STABLE, MOODLE_19_STABLE


 Description  « Hide
My company develops SCORM packages for corporate clients. For one particular client we have used the "prerequisites" functionality of SCORM. The SCORM file consists of a couple of lessons and each lesson has the previous lesson as a prerequisite.

In Moodle 1.6.x this worked perfectly. In the navigation menu only available lessons would be clickable (see attachment). In the current version of Moodle this does not work anymore: all lessons are always clickable. I think that this is not the expected behaviour...

Please email me privately if you need an example SCORM package for testing. I cannot post it in a public forum (the clients owns it...)

I really hope this can be resolved as soon as possible!

Kind regards,

Hans de Zwart



 All   Comments   Change History   Version Control      Sort Order: Ascending order - Click to sort in descending order
Hans de Zwart added a comment - 17/Sep/07 09:33 PM - edited
One of our programmers (Frank Kootte), has looked at the problem, and to me it seems like he solved it. There seems to be a problem in /mod/scorm/datamodels/scorm_12lib.php.

Based on his changes I have created the following (I cannot upload) an attachment! patch. I would appreciate it if somebody could check the patch, commit it to CVS and then close the bug.

Thanks!

— scorm_12lib.php 2007-06-21 04:29:31.000000000 +0200
+++ scorm_12lib_new.php 2007-09-17 15:37:14.000000000 +0200
@@ -252,8 +252,8 @@
}
$nextsco = next($scoes);
$nextisvisible = false;

  • if (($nextsco !== false) && ($optionaldatas = scorm_get_sco($nextsco->id, SCO_DATA))) {
  • if (!isset($optionaldatas->isvisible) || (isset($optionaldatas->isvisible) && ($optionaldatas->isvisible == 'true'))) {
    + if (($nextsco !== false) && ($nextoptionaldatas = scorm_get_sco($nextsco->id, SCO_DATA)))
    Unknown macro: {+ if (!isset($nextoptionaldatas->isvisible) || (isset($nextoptionaldatas->isvisible) && ($nextoptionaldatas->isvisible == 'true'))) { $nextisvisible = true; } }

    @@ -325,7 +325,7 @@
    $previd = $sco->id;
    }
    }
  • if (empty($sco->prerequisites) || scorm_eval_prerequisites($sco->prerequisites,$usertracks)) {
    + if (empty($optionaldatas->prerequisites) || scorm_eval_prerequisites($optionaldatas->prerequisites,$usertracks)) {
    if ($sco->id == $scoid) { $result->prerequisites = true; }

antoine faget added a comment - 17/Sep/07 11:07 PM
I tested your changes and it seems that works fine only for items in an unique organization :

If item prerequisites for another item is in the same organization it is not accessible while the first item isn't completed
but if the item prerequisites is in another organization, nothing appears on the tree...

I hope i was comprehensible, my english is far from being perfect..

Thanks for this first patch!


antoine faget added a comment - 17/Sep/07 11:28 PM
Sorry my comment is not really exact !!!

In fact, it's not exactly when item prerequisites is in another organisation that it's without effect, it's when the package uses item as organisation (with items under it in the tree view).....


Hans de Zwart added a comment - 18/Sep/07 02:19 PM
Hello Antoine,

I am not sure that I understand you.....

What I would like to have is the same functionality that used to be in version 1.6.

Can you confirm that your SCORM package works the same in 1.6 as in 1.8? Or are there still differences?

Kind regards,

Hans de Zwart


antoine faget added a comment - 18/Sep/07 04:26 PM
Hello Hans

First, sorry for my fuzzy explanations...I will try to be clearer ;o)

I confirm, with the patch integration, the prerequisites management by the Scorm player works fine in these case :

  • Multiple organizations with items required an item completed in the same or in another organization
  • Single organization

But in this case prerequisites are not working :

  • Single organization but with overlapping items (one item contain multiple items)

It isn't very important, i just remake all my Scorm packages...

Thanks for your help

Cordially,

A.F


Hans de Zwart added a comment - 18/Sep/07 04:32 PM
So you mean that things like & and | do not work?

This is known problem which, it seems, has never worked...

Thanks for getting back!


antoine faget added a comment - 19/Sep/07 11:59 PM
Aïe !!
In fact, pre-requisite block items without problem but ...
when the required item is completed others items are always blocked....

Have you the same problem?


Eric Kirkpatrick added a comment - 08/Nov/07 03:40 PM - edited
Hi, I just started using SCORM packages for Moodle a few days ago and I went in with the reload editor to add prerequisite tags to all of the SCOs to prevent accessing the next SCO until you had viewed the previous. I'm using Moodle 1.8.x and writing the SCORM as 1.2 compliant, everything else about the SCORM works fine but it just refuses to recognize the prerequisites, I double checked the XML in the manifest and it looks fine, does this pertain to this bug or is there something that I'm missing? All of my items are under a single organization if that clarifies the structure of what i'm talking about.

Hans de Zwart added a comment - 08/Nov/07 04:11 PM
Hello Eric,

Yes it seems that that is the problem... Have you tried the above mentioned patch?


Eric Kirkpatrick added a comment - 09/Nov/07 04:47 PM
Hi Hans, Yeah, I just tried the patch, the results essentially were that any SCORM that i was testing without prerequisites(1.2 or 2004) was perfectly fine and was unaffected, but 1.2 SCORM with prereqs ended up breaking (the SCOs didn't show up anymore) and the 2004 SCORM with sequencing just ended up the same (sequencing not working) so I guess maybe I'll just have to give up on it for now but thanks for the help though.

Zoltán Szarvas added a comment - 26/Nov/07 05:20 AM
Hi, I checked the patch, it works fine, thanks. One thing: if the aicc_script contains quotation marks (for example sco="completed"), it will not work, because the returned string contain the escape slashes (added by addslashes()). After I have added the stripslashes() call, it worked:
  • if (empty($optionaldatas->prerequisites) || scorm_eval_prerequisites($optionaldatas->prerequisites,$usertracks)) {
    + if (empty($optionaldatas->prerequisites) || scorm_eval_prerequisites(stripslashes($optionaldatas->prerequisites),$usertracks)) {

Kind regards,

Szazo


Zoltán Szarvas added a comment - 26/Nov/07 07:39 AM
Hi,

I continued debugging, I guess I found why the complex prerequisites (containing | or &) doesn't work. In the scorm_eval_prerequisites() function there are some statements like this:
if (!isset($usertracks[$item])) { return false; }

The $usertracks contain data only about scoes that have been visited. If one of the sco of the formula never been seen, the above statement will be true, and the whole prerequisites function returns false.

For example, the following formula always returns false (false means the sco is locked) if one of the scoes never been seen, even if one of the scoes is "complete":

(sco1="complete" | sco2="complete")

In the following patch a parallel $usertracks array is created with name $prerequsertracks. It contains all of the data of $usertracks and also contains an object with status 'notattempted'. So the scorm_eval_prerequisites() will continue running, even if there are scoes in formula that have never been seen.

It seems to work (but perhaps not the most nice solution), please check it.

(I also found that '&' signs are not imported correctly if they are in CDATA section, I submitted this bug about this: http://tracker.moodle.org/browse/MDL-12342)

The patch includes Hans's patch (thanks Hans):

— scorm_12lib_old.php Fri Nov 16 11:08:16 2007
+++ scorm_12lib.php Sun Nov 25 23:59:40 2007
@@ -193,6 +193,7 @@ function scorm_get_toc($user,$scorm,$lis
// Retrieve user tracking data for each learning object
//
$usertracks = array();
+ $prerequsertracks = array();
foreach ($scoes as $sco) {
if (!empty($sco->launch)) {
if ($usertrack=scorm_get_tracks($sco->id,$user->id,$attempt)) { @@ -200,6 +201,11 @@ function scorm_get_toc($user,$scorm,$lis $usertrack->status = 'notattempted'; }
$usertracks[$sco->identifier] = $usertrack;
+ $prerequsertracks[$sco->identifier] = $usertrack;
+ } else { + // set default 'notattempted' status for scoes have never been seen. + $usertrack->status = 'notattempted'; + $prerequsertracks[$sco->identifier] = $usertrack; }
}
}
@@ -254,8 +260,8 @@ function scorm_get_toc($user,$scorm,$lis
}
$nextsco = next($scoes);
$nextisvisible = false;

  • if (($nextsco !== false) && ($optionaldatas = scorm_get_sco($nextsco->id, SCO_DATA))) {
  • if (!isset($optionaldatas->isvisible) || (isset($optionaldatas->isvisible) && ($optionaldatas->isvisible == 'true'))) {
    + if (($nextsco !== false) && ($nextoptionaldatas = scorm_get_sco($nextsco->id, SCO_DATA)))
    Unknown macro: {+ if (!isset($nextoptionaldatas->isvisible) || (isset($nextoptionaldatas->isvisible) && ($nextoptionaldatas->isvisible == 'true'))) { $nextisvisible = true; } }

    @@ -328,7 +334,7 @@ function scorm_get_toc($user,$scorm,$lis
    $previd = $sco->id;
    }
    }
  • if (empty($sco->prerequisites) || scorm_eval_prerequisites($sco->prerequisites,$usertracks)) {
    + if (empty($optionaldatas->prerequisites) || scorm_eval_prerequisites(stripslashes($optionaldatas->prerequisites),$prerequsertracks)) {
    if ($sco->id == $scoid) { $result->prerequisites = true; }

Dan Marsden added a comment - 23/Feb/08 10:53 AM
assigning to me - will test fix(es) and look at patching

Dan


Joseph Caplan added a comment - 03/Mar/08 10:36 PM
I need to try this for my setup, but no time to mess with code. Does anyone have a complete and updated version of the above code that has been corrected in the scorm_12lib.php module. Basically just need the updated / corrected version of scorm_12lib.php

Please attach here wit the Attach File option in the top left of this page.

Thanks

Joe C.


Zoltán Szarvas added a comment - 03/Mar/08 10:53 PM
Dear Joseph!

I have attached my version of the patch and patched files. It also includes the bugfix for http://tracker.moodle.org/browse/MDL-12342 BUG (scormlib.php)

Note that Moodle 1.8.3+ version required to use this bug fix.

The patch can be found in .zip under the bugfix\patch directory with name prereqfix.patch. Applying this patch:
1. Copy this file into the moodle/mod/scorm/datamodels directory of the installed Moodle..
2. Go to the moodle/mod/scorm/datamodels directory.
3. Apply the patch using the following command: patch -i prereqfix.patch

Instead of patching, you can copy the already patched files. These files can be found in .zip, under the bugfix\patchedfiles directory. Just copy these files into the moodle/mod/scorm/datamodels directory of the installed Moodle (please create backup, before overwriting files).

Regards
Szazo


Dan Marsden added a comment - 28/Jul/08 05:46 AM
we really need a test scorm object that contains pre-requisites that we can use to reproduce this bug, can someone please either upload an object to this tracker item, or e-mail myself or Piers with a scorm object to use for testing?

thanks,

Dan


Hans de Zwart added a comment - 28/Jul/08 05:55 AM
Hey Dan,

Thanks for going through all these SCORM bugs! I am still watching them all (good that the missing database field will be picked up). I am on a holiday but have asked one of my co-worker to find one of the SCORM objects that used this functionality and post it to you.

Thanks again,

Hans


Dan Marsden added a comment - 28/Jul/08 06:02 AM
great! - thanks Hans, we're slowly making some headway!

Dan


Arjen Vrielink added a comment - 04/Aug/08 09:30 PM
Basic SCORM for testing functionality described in this bug-report

Arjen Vrielink added a comment - 04/Aug/08 09:32 PM
Dan: fyi, I'm a colleague of Hans and I uploaded a SCORM object containing pre-requisites so you can reproduce the bug. I think it works pretty straight-forward; if you upload the scorm you shouldn't be able to do Item 2 and Item 3. Item 2 should become available only after completing item 1, item 3 after item 2.

Hope this helps


Dan Marsden added a comment - 05/Aug/08 05:36 AM
Thanks Arjen!

We really need more objects to be added to the Scorm Repository here:
http://moodle.org/mod/data/view.php?d=50
would be great if you could add this object or others if you are happy with them being publicly available!

Piers - can you please have a look at this one?

thanks!

Dan


Piers Harding added a comment - 07/Aug/08 10:30 AM
Hi Arjen - thanks for attaching the test SCORM - I have taken this and created a couple of other prerequisite tests based on it (2*{...} and && and || etc), are you OK with me uploading these and your SCORM object attached to this issue, in the database here: http://moodle.org/mod/data/view.php?d=50 ?

Cheers,
Piers Harding.


Arjen Vrielink added a comment - 07/Aug/08 10:07 PM
Please feel free to add it to the repository. I just uploaded it myself but I'm not sure whether you need more descriptive data.

Piers Harding added a comment - 08/Aug/08 05:50 AM
Hans -
Patch file MDL-11188-moodle19.patch contains the complete set of changes required for the rewrite of prerequisite handling for STABLE19. Because the file upload handling is currently being redeveloped in HEAD (and currently doesnt work), I have not been able to test this there, although I have done a good amount of testing in STABLE19.

It would be very helpfull if you could test this independently for me, before I proceed with committing to STABLE19 and STABLE18.

Thanks.
Piers Harding.


Piers Harding added a comment - 14/Aug/08 07:30 AM
This has been fixed in HEAD, 1.9 and 1.8.

Hans de Zwart added a comment - 22/Aug/08 02:06 AM
Hello Piers,

I only now see your request to me (back from holidays). Is testing still relevant? Or can I just try it whenever next one of our clients uses the functionality?

Thank you very much for your efforts!

Kind regards,

Hans


Piers Harding added a comment - 22/Aug/08 03:05 AM
Hi Hans - this should have made it into the weekly downloadable update for Moodle, so if you upgrade to that then it should be possible to test it.
Cheers,
Piers Harding.

Dan Marsden added a comment - 11/Nov/08 07:53 AM
closing - thanks for everyones help getting this sorted!