Allow 0 attempts

Allow 0 attempts

by Itamar Tzadok -
Number of replies: 5

Tim, I had to tweak only 3 lines in the quiz to "allow" 0 attempts. Moved the 'unlimited' -1, set the num attempts access rule accordingly, and set the confirm start message to pop above 0. So far seems to work as expected. May be worthwhile to add to core some time in the future. After all, between the infinite and the finite there must be something that is neither (or both). smile  

Average of ratings: -
In reply to Itamar Tzadok

Re: Allow 0 attempts

by Tim Hunt -
Picture of Core developers Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers

I may be missing something, but why?

In reply to Tim Hunt

Re: Allow 0 attempts

by Joseph Rézeau -
Picture of Core developers Picture of Particularly helpful Moodlers Picture of Plugin developers Picture of Testers Picture of Translators

Yes, why?

In reply to Joseph Rézeau

Re: Allow 0 attempts

by Itamar Tzadok -

Currently I can see how it may serve businesses which sell access to predefined quizzes. You set the quiz with 0 attempts so visitors can open it to see its description but not attempt. Then you override the number of attempts per user on purchase. smile

In reply to Itamar Tzadok

Re: Allow 0 attempts

by Tim Hunt -
Picture of Core developers Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers

A better way to do that is to just use roles. Give everyone mod/quiz:view, but only give paid-up students mod/quiz:attempt.

In reply to Tim Hunt

Re: Allow 0 attempts

by Itamar Tzadok -

Not necessarily better. You see, a user can purchase the same activity more than once on different occasions, which in the quiz is probably best controlled by number of attempts. What is purchased is the attempt and there is no need to muddle with roles. The quiz may offer n free/trial attempts and in some cases this n could be 0.

It's not a big issue because the quiz code already makes the hack fairly easy (thanks!). But IMO it's unnecessary to impose the constraining assumption "I allow attempts/entries therefore I exist" on the quiz and other core modules (such as the database module which could have been a nice example how an activity module could easily be set as a resource by allowing users 0 entries; implemented in the dataform). The respective DB record of the module instance, the designated DB field and the setting's UI are already there, so arguably, there is no need to add more DB records and UI clicks as in setting role permissions to achieve this simple effect. smile