marcusgreen / moodle-qtype_wordselect

langHighlight words by clicking e.g. select all nouns in this sentence
2 stars 10 forks source link

Answers are not clickable #26

Closed valeriia-s closed 4 years ago

valeriia-s commented 4 years ago

Hi @marcusgreen,

We use the latest plugin version with Moodle 3.7. The answers are not clickable for us. We tested it in different themes, the issue is in all of them.

Here is a quick video that shows the behavior: https://www.loom.com/share/55a0961518434b13a2da2d13a06dfb69

Please let me know if there is something we are missing in the question setup.

Thank you, Valeriia

valeriia-s commented 4 years ago

Hi @marcusgreen,

We use the latest plugin version with Moodle 3.7. The answers are not clickable for us. We tested it in different themes, the issue is in all of them.

Here is a quick video that shows the behavior:

https://www.loom.com/share/55a0961518434b13a2da2d13a06dfb69

Please let me know if there is something we are missing in the question setup.

Thank you, Valeriia

I see these errors in Console:

Screen Shot 2020-01-22 at 10 02 31 PM
marcusgreen commented 4 years ago

Hi thank you for giving so much detail. Can you email me at marcusgreen at mailbox.org. One way to investigate is for you to give me a teacher account on a test course. Thanks for testing in multiple themes, that is always a first thing to eliminate. Can you also test with one question per page in case that is part of the issue.

marcusgreen commented 4 years ago

I have identified where the code was changed that caused this problem, but I don't have a fix yet. For the benefit of developers, it was during the switch from plain javascript to amd modules, between releases 2.32 and 2.42. It only occurs if you have a quiz with multiple questions per page and an even number of questions. So with four questions per page it is broken but with three it works as expected.

This is because a single click runs for each question, so with four questions it toggles on, off, on and off. But with three questions it toggles on, off and on again making it look like everything is OK, even though really it is not.

I will work on a fix and keep you informed.

AurelienDM commented 4 years ago

@marcusgreen I have the same issue on a 3.6 moodle version, answers are not clickable.

marcusgreen commented 4 years ago

I suspect that this is the version before that bug was introduced. https://moodle.org/plugins/pluginversion.php?id=18444

AurelienDM commented 4 years ago

I suspect that this is the version before that bug was introduced. https://moodle.org/plugins/pluginversion.php?id=18444

I have this version installed : 2.42 / 2019112200

marcusgreen commented 4 years ago

The version at https://moodle.org/plugins/pluginversion.php?id=18444 Is version 2018120300. I can set you up with a course that has it working if that would be useful (in about 8 hours from now).

AurelienDM commented 4 years ago

The version at https://moodle.org/plugins/pluginversion.php?id=18444 Is version 2018120300. I can set you up with a course that has it working if that would be useful (in about 8 hours from now).

Sure thing, it would be perfect ! Let me know how things are going.

marcusgreen commented 4 years ago

Hi Valerie, the version before it was broken for multi question pages is 2.32 https://moodle.org/plugins/pluginversion.php?id=18444 Is version 2018120300. You can see it working if you login to https://m.vledevelop.co.uk/course/view.php?id=22 username s1 password The one I emailed previously (which I will re-email to you)

Note that you almost certainly won't be missing out on anything by using that version as the changes since then were a mix of very minor and technical. See the release notes here. https://github.com/marcusgreen/moodle-qtype_wordselect/blob/master/changelog.md.

My apologies that this issue has consumed your time. Marcus

AurelienDM commented 4 years ago

I have re-installed the 2.32 version, but the same issue is happening.

marcusgreen commented 4 years ago

Hi Aurelien, as I am seeing two identities I am not sure if I am dealing with two people in this thread, probably best to email me at marcusgreen at mailbox.org

AurelienDM commented 4 years ago

Hi, I have sent you an email 5 days ago.

t-schroeder commented 4 years ago

Hi, we just ran into this problem as well. I see that you already fixed this. Just wanted to share the way I would have fixed it:

        // Initialize JS only once per page.
        static $jsinit = false;
        if (!$jsinit) {
            $this->page->requires->js_call_amd('qtype_wordselect/navigation', 'init');
            $this->page->requires->js_call_amd('qtype_wordselect/selection', 'init');
            $jsinit = true;
        }

This causes the JS init calls to be made only once per page and this solution wouldn't have required any changes to the selection.js file.

marcusgreen commented 4 years ago

Thanks Tim, that sounds interesting. I will take a look. The current solution is based on something used by other question types and I quite like the tidied up function names, however I also like making the minimum number of changes possible to code that currently works...

t-schroeder commented 4 years ago

If that's how other question types do it, it makes sense to do it like that. I just posted my solution because I had an older version of qtype_wordselect on my machine, so I fixed the bug there and didn't realize you already fixed it on master.

While testing I just noticed a bug with the most recent master version: When Javascript Caching is disabled in admin settings (setting name "cachejs") all amd modules are broken for me. The problem is that Moodle looks for "define(" and you have "define (" in selection.js (notice the space).

This happens with Moodle 3.7, see: https://github.com/moodle/moodle/blob/ee0a8161dd4d9893fda4f0d8619240e7fb375e17/lib/requirejs.php#L139-L143

I think this problem effects Moodle master, too, although the Code of lib/requirejs.php has changed: https://github.com/moodle/moodle/blob/master/lib/requirejs.php#L160 It looks like a space is still not tolerated after the "define".

marcusgreen commented 4 years ago

Hi Tim Would you email me at marcusgreen @mailbox.org

marcusgreen commented 4 years ago

The fix for this is in the master branch and I am currently testing, e.g. different versions of Moodle. See intended release notes here https://github.com/marcusgreen/moodle-qtype_wordselect/blob/master/changelog.md

AurelienDM commented 4 years ago

Thanks heaps. I’ve updated it, cleared the cache and it’s all working as expected.

Aurélien Darie-Matisson | ‭+31 6 05 31 46 61

On 13 Feb 2020, at 10:01, Marcus Green notifications@github.com wrote:

 The fix for this is in the master branch and I am currently testing, e.g. different versions of Moodle. See intended release notes here https://github.com/marcusgreen/moodle-qtype_wordselect/blob/master/changelog.md

— You are receiving this because you commented. Reply to this email directly, view it on GitHub, or unsubscribe.

marcusgreen commented 4 years ago

Excellent. A new version will be in the plugins database soon but there will be no significant changes. The rest of the work will be things like testing upgrades from previous versions and checking against earlier versions of Moodle. Thank you for your feedback, I am always delighted to hear of people using my plugins.

marcusgreen commented 4 years ago

It looks to me like this fix will only work with Moodle version 3.7 onwards because $qa->get_outer_question_div_unique_id() that is required by the fix was not available before that. But as 3.9 will be out soon, requiring 3.7 doesn't seem too much to ask.

marcusgreen commented 4 years ago

Closing issue as fix is now released to moodle.org/plugins.