chamilo / chamilo-lms

Chamilo is a learning management system focused on ease of use and accessibility
https://chamilo.org
GNU General Public License v3.0
807 stars 481 forks source link

Quiz : "quiz_prevent_backwards_move" can be desactivated by students (if multiple attempts are possible). #3631

Open tanchon opened 4 years ago

tanchon commented 4 years ago

Hi,

If the teacher defines more than one attempt possible (and if the student didn't reach the max attempt), the quiz_prevent_backwards_move doesn't work properly (except at the first attempt).

For example, if the teacher set the max attempt to 2 :

To Reproduce Steps to reproduce the behavior (for a test with more than one attempt possible)

  1. the student answers the questions of his 1st attempt, one by one (as long as he is "into the test", it is not possible to go backward).
  2. At the end of the test he clicks on the orange button ("end of the test")
  3. The exercise_result.php of his 1st attempt opens
  4. From the latter, the student can go backward
  5. he can see the last question of the first attempt, but it is a new attempt (the 2nd) !
  6. In this new attempt, the "quiz prevent backward move" doesn't work !

Expected behavior When the quiz_prevent_backwards_move is activated, it shouldn't be possible to go backward when an attempt has been close by clicking on the orange button.

The only way the student could try a new attempt should be by clicking on the blue button "new attempt" on the exercise result page => then, he could do his new attempt from the beginning (not from his last question of his last attempt). And the quiz prevent backward option should work everytime.

Server This issue is reproduced on 11.chamilo.org** : see here for example : https://11.chamilo.org/main/exercise/overview.php?cidReq=COURSTANCHON&id_session=0&gidReq=0&gradebook=0&origin=&exerciseId=318

Additional context It is very confusing for student because when he goes back, he cannot guess that it is a new attempt. The quiz prevent backward option is only reliable if the teacher defined the max attempt to 1.

Thanks.

Tanchon.

tanchon commented 3 years ago

Hi,

I made a short video of an attempt with an exercise on 11.chamilo.org : click here.

Thanks.

Tanchon.

carlangas159 commented 3 years ago

hi @tanchon

Normally the action of blocking back is not avoided in the browser, I have made an adjustment for when quiz_prevent_backwards_move is active, by javascript it can block the back button

https://github.com/carlangas159/chamilo-lms/commit/d3b217b8ac7129024f73a47a9fce841b222328c8

tanchon commented 3 years ago

Hi @carlangas159,

It works for me !

I just note a (very) little problem :

_*The error message is : "Fatal error: Uncaught Error: Call to a member function getPreventBackwards() on null in /home/clients/xxxxxxxx0af45c47438a0195xxxxxxxxxx/web2/main/exercise/exercise_result.php:33 Stack trace: #0 {main} thrown in /home/clients/xxxxxxxx0af45c47438a0195xxxxxxxxxx/web2/main/exercise/exerciseresult.php on line 33"

Honestly, i think that the probability that a student discover this manipulation is very low. From my point of view, the security is good... but if it can be enhanced by avoiding the error message and its consequence, it would be a good thing.

Thanks a lot for this work.

Tanchon.

tanchon commented 3 years ago

@carlangas159

The first test i made was on Firefox (see above).

With Chrome and Edge, the fix has no effect : the issue remains (it is possible to go back from the result page).

Thanks

Tanchon

PS : all tests realized with Windows 10.

tanchon commented 3 years ago

@carlangas159

May be it's an idiot proposal, sorry by advance if it is, but do you think it is possible :

tanchon commented 3 years ago

Hi @carlangas159

I've made some tests this evening. I give you a little backup :

But with Edge/Chrome, if the exercise is "autoevaluation", previous answers are sometimes displayed in the new attempt (with "save correct answers" and "review anwers" are defined to NO) : it depends on the question type (for "fill blanks and QRM i note that previous answers are displayed... but not for hotspots...). But it is a different attempt from the 1st !

This issue is a little bit confusing :-)

Thanks.

Tanchon.

ywarnier commented 3 years ago

Hi @tanchon Thank you for your feedback. Due to the risky nature of this patch, we will not include it in Chamilo 1.11.14 (it has more harmful potential than fix potential because it modifies behaviour in a way we don't usually work - i.e. by blocking browser navigation functions). The bug will still exist in the stable 1.11.14, so preventing to go backwards should probably be combined with a "single attempt" option in the test configuration for now.