studentquiz / moodle-mod_studentquiz

Moodle-Plugin
GNU General Public License v3.0
38 stars 38 forks source link

Studentquiz: Fix toggle-checkbox #391

Closed JBThong closed 2 years ago

JBThong commented 2 years ago

Hi Tim,

I have created this commit to fix the issue toggle checkbox in Studentquiz. Steps to reproduce:

  1. Log in and go to the StudentQuiz activity above on the Firefox browser and observe the checkboxes on the question list -> All checkboxes selected
  2. Refresh the page -> All checkboxes unselected
  3. Refresh the page again and observe the checkboxes -> All checkboxes selected again

Actual result: Checkboxes are checked/unchecked when refreshes the page Expected result: All checkboxes on the question listing should be selected consistently when refreshing the page.

Could you please help me to review it? Thanks,

JBThong commented 2 years ago

So sorry, the cibot is failed I will check it and send it back to you later.

JBThong commented 2 years ago

Hi @timhunt,

I have completed this commit and run the cibot without failure. Could you please help me to review it?

Many thanks,

timhunt commented 2 years ago

I'm sorry, but this fix makes no sense (as far as I can see).

Do you know what the core/pending library is for? Try re-writing your 'fix' using the underlying M.util.js_pending/js_complete and you may see why the code you have written is mostly senseless.

I suspect that lurking at the middle of your commit is the small chance acutally required to fix this, but no point obfuscating it with all the other stuff.

JBThong commented 2 years ago

Thanks for helping me correct my mistake, Tim. I had a big mistake in understanding js_pending. Hieu has reminded me, and I have updated my code. Could you please help me to review it again?

Many thanks.

timhunt commented 2 years ago

Thanks. That fix makes sense now. Merging.