adaptlearning / adapt-contrib-xapi

TinCan/xAPI extension for the Adapt Framework
GNU General Public License v3.0
12 stars 27 forks source link

wait doesn't return when switching languages #85

Closed chucklorenz closed 4 years ago

chucklorenz commented 4 years ago

[FW v3.3.0; xapi v0.8.2; language picker v2.0.0]

While xAPI is enabled, the course in unable to switch to another language.

To replicate:

  1. Configure course with 2 languages, language picker, and xapi.
  2. Run course, choosing any language in order to load the menu.
  3. Click the language picker icon in the navbar, choose a language, and proceed through usual popups.

Expected behaviour: After last popup closes, one expects the new language to load. Actual behaviour: After last popup closes, the original language remains in place. (Pls note, icons have disappeared from the navbar, and inspection reveals that the lang attribute in the html tag has updated to the new language.)

The code gets stuck on a wait that doesn't end, so triggerDataReady(newLanguage) is never called.

This seems to be the result of a mismatch of on and once in some code:

cahirodoherty-learningpool commented 4 years ago

I think I can offer a solution to this (I'll link a PR shortly) If the loading of the adapt-offlineStorage-xapi is moved to within the index initialize instead of being kicked off on import in the index, then we can avoid the problem with Adapt.offlineStorage.initialize setting the ready status to false and never being re-set to true

brian-learningpool commented 4 years ago

Hi @chucklorenz, Cahir's PR resolves the issue for us.

Would it be possible for you to test https://github.com/adaptlearning/adapt-contrib-xapi/archive/offlineStorageLanguageIssue.zip to confirm it resolves it for you?

chucklorenz commented 4 years ago

@brian-learningpool @cahirodoherty-learningpool I couldn't get it to work for my situation. I tested locally; sorry, can't test on my client's server. I reverted to xapi v0.8.2 to verify the original problem. Then replaced xapi with this offlineStorage version. Cleaned the build; rebuilt, and served. Received pop-up that I'm not connected to LRS. Selected English from the language picker. Entered first menu item. Selected the change language icon in the navbar. Selected espanol from drawer. Confirmed the selection in the pop-up, but English remains after the pop-up cleared.

Happy to try again. If you see an issue in my steps, pls advise.

chucklorenz commented 4 years ago

@brian-learningpool @cahirodoherty-learningpool Ah, looks like there is a console error. Hold on, pls

chucklorenz commented 4 years ago

@brian-learningpool @cahirodoherty-learningpool Console errors are focused on the xapi query string (actor, endpoint, etc) provided to me by the client months back. The testing account may have been disabled. Getting a 404 error now. I'm not skilled enough to figure out a work around.

brian-learningpool commented 4 years ago

Hi @chucklorenz, thanks for testing. How are you passing in the actor? SCORM Cloud (https://cloud.scorm.com/) is a good platform to test this on.

cahirodoherty-learningpool commented 4 years ago

Hi @chucklorenz The PR for this (https://github.com/adaptlearning/adapt-contrib-xapi/pull/86/files?w=1) has been updated again now. Could you take a look when you get a chance to confirm it resolves the issue for you? Thanks

chucklorenz commented 4 years ago

@cahirodoherty-learningpool @brian-learningpool Yes, Cahir, this new version works in my situation, resolving my issue. I tested locally as mentioned above and the language picker worked as expected; languages switched as expected. 👍

moloko commented 4 years ago

should be fixed in v0.8.3