192 Commits

Author SHA1 Message Date
Tim Hunt
fc9d2e0843 MDL-54907 quiz: better timefinish for attempts finished asynchronously
There are serveral ways a quiz attempt can be submitted:

1. The student click the Submit and finish button. In this case,
   no problem. We record the current time as the finish time
   for the quiz attempt.

2. The student is activly working away at the quiz, and the
   count-down timer reachers zero. In this case, we also record
   the current time. Note that, if the server is under high load,
   then this could well end up being a few seconds after the
   theoretical end time, so you could have a quiz with a 30 minute
   time limit, with an attempt that lasted 30:07. However, this
   is just an accurate reflection of what happened, so should
   be recorded like this.

3. If the student is offline when the time expires, then
   (depending on the quiz settings) the attempt may be
   automatically submitted by cron, but this will happen with
   at least some delay (to prevent race conditions between cron
   and a student working online) and if cron is running slow
   on the server, it could be a lot later. Previously, this led
   to, say, a 30 minute quiz where an attempt seemed to have
   lasted 67 minutes, which confused people.

   Now, in this situation, the finsh time for the quiz attempt is
   recorded as the time when the time limit ran out. This is not
   just less confusing for teachers looking at the quiz report,
   it is also more accurate. That is the latest time at which
   students could have made any changes to their responses.
2020-11-27 17:51:55 +00:00
Bas Brands
d910726704 MDL-66587 mod_quiz: visible quiz timer 2020-09-16 15:21:27 +02:00
Bas Brands
91de0ed823 MDL-67874 theme_boost: make focus outline accessible 2020-05-26 09:54:12 +02:00
Andrew Nicols
4e9641c2d1 Merge branch 'MDL-57240' of https://github.com/timhunt/moodle 2020-05-22 11:37:38 +08:00
Tim Hunt
64207dab65 MDL-67183 questions: get_question & get_behaviour only init if required
This reviews all the code code, and sets $requirequestioninitialised
whenever possible in these calls, which should improve performance.
2020-05-19 20:52:07 +01:00
Tim Hunt
07d90238c6 MDL-57240 quiz: don't show useless links on overdue attempt summary page 2020-04-22 21:38:19 +01:00
Eloy Lafuente (stronk7)
986c5283cf Merge branch 'MDL-67832' of https://github.com/timhunt/moodle
(fixed a couple of typos in the merge commit)
2020-02-06 00:01:07 +01:00
Tim Hunt
1aacbb72d3 MDL-67832 quiz: fix lots of PHPdoc in attemptlib.php 2020-01-31 19:09:03 +00:00
Tim Hunt
a33e0b4d84 MDL-67830 quiz: notice in grade details redirect script 2020-01-29 18:34:39 +00:00
Tim Hunt
b04b6ae1ab MDL-66764 quiz: redo question should not repeat random questions
Before this fix, it was only considering questions seen in previous attempts.

It should avoid the questions in the current attmept too.
2019-09-25 11:04:38 +01:00
Shamim Rezaie
5641b98133 MDL-35939 mod_quiz: phpdoc fix 2019-08-15 12:07:38 +10:00
Shamim Rezaie
41bfed56fc MDL-35939 mod_quiz: new functions to generate title for attempt pages 2019-08-15 12:07:34 +10:00
Simey Lameze
589c4f9474 MDL-65883 mod_quiz: fix quiz navigation buttons href 2019-06-14 07:27:02 +08:00
Shamim Rezaie
80c360d573 MDL-65630 mod_quiz: Allow redo within an attempt with random questions 2019-05-20 23:10:30 +10:00
Peter
286631e7c0 MDL-64238 mod_quiz: Check enrollment on calendar_action generator
* Updated unit tests to account for participants
2019-02-08 06:40:52 +08:00
Simey Lameze
9b1fc262d8 MDL-63185 mod_quiz: make CiBoT happy again
Part of MDL-62610
2018-09-28 11:07:21 +08:00
Simey Lameze
5c0654d7ff MDL-63185 mod_quiz: change APIs to handle attempts on behat
Thanks to Tim Hunt for all the help.

Part of MDL-62610
2018-09-28 11:07:21 +08:00
Shamim Rezaie
66aa172cbb MDL-61614 Quiz: Maintain slot tags when editing random questions 2018-04-18 13:07:08 +10:00
dinhloc
f4695ec722 MDL-61033 quiz: Editing a quiz while a preview is open
Editing a quiz while a preview is open in another browser tab can leads to a cryptic error that is hard to recover from
2018-03-27 10:47:32 +07:00
Shamim Rezaie
f3f21c995c MDL-61380 Quiz: Re-attempting the same "random" question by tag
Some question behaviours allow the same question to be re-attempted several times during a quiz attempt.
This commit takes care of the case where a "random" question is re-attempted during a quiz attempt.
2018-03-07 05:43:44 +11:00
Shamim Rezaie
2a1c9daccd MDL-61380 Quiz: build attempt from "random" questions by tag 2018-03-07 05:43:38 +11:00
Shamim Rezaie
82c67ac7f0 MDL-61380 Quiz: Fix url generation in notenoughrandomquestions exception 2018-03-07 05:33:11 +11:00
Tim Hunt
ff456b59ea MDL-60162 quiz reports: too many rows fetched on download
This happened if one user had multiple enrolments in a course, and was
quite inefficient.
2017-10-24 18:06:44 +01:00
Neill Magill
078484f2e2 MDL-60300 Quiz: Offline update time not set correctly 2017-10-06 13:43:42 +01:00
Juan Leyva
8a972ab377 MDL-53870 mod_quiz: New settings for quiz attempts in the mobile app 2016-09-28 09:25:18 +01:00
Andrew Nicols
df89940e5d MDL-53858 quiz accessibility: Correct aria-labelledby attribute 2016-04-29 12:17:57 +01:00
Tim Hunt
5b444ee987 MDL-53858 quiz accessibility: nav block should have role='navigation' 2016-04-18 17:37:03 +01:00
Juan Leyva
b6c538416b MDL-52767 mod_quiz: New API for retrieving the question types 2016-03-23 00:56:05 +01:00
Juan Leyva
3e5c19a0ed MDL-52888 mod_quiz: New Web Service mod_quiz_view_attempt_review 2016-03-18 09:50:06 +01:00
Juan Leyva
d9ef6ae0c2 MDL-52888 mod_quiz: New Web Service mod_quiz_view_attempt_summary 2016-03-18 09:49:29 +01:00
Juan Leyva
899983ee58 MDL-52888 mod_quiz: New Web Service mod_quiz_view_attempt 2016-03-18 09:27:43 +01:00
Juan Leyva
4911b5b254 MDL-52863 mod_quiz: Move processattempt.php code to new API 2016-03-17 16:49:39 +01:00
Juan Leyva
1d57e4fea5 MDL-52813 mod_quiz: New method for getting the type of a question 2016-03-11 10:28:17 +01:00
Tim Hunt
293f5d1b11 MDL-53065 quiz redo question: avoid PHP notice in edge case
When selecting the variant of the new question, we need to add the
new question to the usage before trying to select a variant.

Also, we need to acutally use the selected variant number!
2016-02-19 12:10:39 +00:00
Tim Hunt
1f0f413187 MDL-46091 quiz start attempt: rationalise confirmations.
1. Don't show a warning if there are a limited number of attempts, only
   if there is a time limit.
2. Merge that time-limit warning into the same form that is used for
   entering a password, etc.
3. Make that form an JavaScript dialogue when you click the start attempt
   button.

AMOS BEGIN
  MOV ['confirmstarttimelimit', 'mod_quiz'], ['confirmstart', 'quizaccess_timelimit']
AMOS END
2016-01-18 22:12:41 +00:00
Dan Poltawski
8440c780bd MDL-52471 quiz: remove broken code question_print_comment_fields() 2015-12-10 15:47:11 +00:00
Tim Hunt
857e2a6f8c MDL-50996 quiz: fix review error with unusual permissions 2015-08-24 09:53:52 +01:00
Tim Hunt
377ce9938b MDL-49814 quiz: make question dependency clear in the nav 2015-04-27 13:55:40 +01:00
M Kassaei
5d949702f8 MDL-40988 quiz: ability to break quizzes into sections
The sections are created on the edit quiz page, and then appear in the
navigation panel when the quiz is being attempted to help students find
their way around.

The 'Shuffle questions' setting has been moved from being per-quiz
to being a per-section.

This commit is actually the joint work of Mahmoud Kassaei and Tim Hunt
from The Open University. We could only use one persons name for the
commit and this time Mahmoud gets the credit/blame.
2015-04-05 14:30:53 +01:00
Tim Hunt
5e63b335fe MDL-40992 quiz: option to let students redo questions within an attempt
This feature is designed for use on pracice or formative quizzes.
It is available for quizzes that use Interactive or Immediate feedback
behaviour.

If the teacher turns this on in the quiz settings, then once a student
has finished a question, they get a 'Redo question' button beside the
question. If they click it, then the question they finished is replaced
by a new one so they can try again to practise that particul skill or
bit of knowledge a bit more.

When randomisation is involved, the studnets will be given a question or
variant that they have not seen before if possible.
2015-03-31 14:12:48 +01:00
M Kassaei
1700bd4dea MDL-40992 quiz: let students to redo questions within an attempt 2015-03-26 17:46:47 +00:00
Tim Hunt
441d284ada MDL-40990 quiz: option to require prev Q finished before next shown
Further improvements to this code, including resolving edge cases:

* The new feature can only be used when it is possible for the
previous question in the quiz to be complete.

* Also, this new feature cannot be used in combination with shuffle
questions, because that make no sense; nor in combination with
sequential navigation, because to make that work properly would be a lot
of effort. If someone needs that to work later, it should be possible
for them to implement it.

* There were changes in the edit renderer API, to try to make things
more  consistent, and to make it less likely we will need to change
things again in the future. See mod/quiz/upgrade.txt.

* As part of this change, the styling of the Edit quiz page was tweaked
to make slighly more efficient use of the horizontal space, and to be
more symmetrical.
2015-03-17 17:16:22 +00:00
M Kassaei
f7785e42b3 MDL-40990 quiz: option to require prev Q finished before next shown 2015-03-17 17:10:13 +00:00
Tim Hunt
2e4e8d16c7 MDL-48829 quiz nav: add a data attr to buttons giving the page
This way, if you need to know which page each button goes to in
JavaScript, you can find out.
2015-01-15 10:20:55 +00:00
Tim Hunt
1c2e05c060 MDL-47691 quiz: only warn re overdue attempts if a Q has been answered
If a quiz is set to have a grace period when time has expired, we only
email studnets to warn them about their overdue attempt if they have put
in an answer to at least one question that is worth some marks.
2014-10-20 12:11:10 +01:00
Colin Chambers
e1a2d0d92d MDL-43089 quiz: improved interface for building quizzes
This commit is actually the joint work of Mahmoud Kassaei, Colin
Chambers and Tim Hunt from The Open University. We could only use one
persons name for the commit, and this time Colin gets the credit/blame.

The goal of this work was to increase usability, and also clean up
the page enough that it will be possible to add new features in future.

Display of mod/quiz/edit.php is now entirely generated by
mod_quiz\output\edit_renderer. This uses a helper class
mod_quiz\structure to provide details of the structure of the quiz, and
mod_quiz\repaginate to alter that structure. (Acutally, there are still
some modification methods on mod_quiz\structure. Expect that to be
cleaned up in future.)

The new code uses much more ajax, and there are new scripts
mod/quiz/edit_rest.php and mod/quiz/repaginate.php to handle this.
(Again, don't be surprised if those two scripts get merged in future.)
Also questionbank.ajax.php (which may, in future, be made more generic,
and moved into the core question bank code.)

Most of the new JavaScript code has intentionally copied the way things
are done when editing activities on the course page.

As a result of this, mod/quiz/editlib.php is now much shorter than it
was. (In future, expect the remaining code in here to move into
mod/quiz/classes.)
2014-10-02 17:22:23 +01:00
Tim Hunt
097dbfe11a MDL-46093 quiz review should default to showing everything on one page
... as long as the quiz is not too big. At the moment, that limit is
set to 50 questions.
2014-06-27 17:14:51 +01:00
Tim Hunt
6a981b45c3 MDL-31262 fix quiz review capability check.
This change is logically the same as changing
    $this->has_capability('mod/quiz:viewreports')
to
    $this->has_capability('mod/quiz:viewreports') || $this->has_capability('mod/quiz:preview')
in the original code. However, I rewrote the logic so that we test the
most common and performance-critical case first - that of a student
lookign at their own attempt.
2014-03-28 18:37:21 +00:00
Tim Hunt
ccba5b8805 MDL-43749 normalise quiz database structure.
The sequence of questions that made up a quiz used to be stored as a
comma-separated list in quiz.questions. Now the same information is
stored in the rows in the quiz_slots table. This is not just 'better' in
a database design sense, but it allows for the future changes we will
need as we enhance the quiz in the MDL-40987 epic.

Having changed the database structure, all the rest of the code needs to
be changed to account for it, and that is done here.

Note that there are not many unit tests for the changed bit. That is
because as part of MDL-40987 we will be changing the code further, and
we will add unit tests then.
2014-03-02 10:00:40 +01:00
Rajesh Taneja
fdc729ea57 MDL-43736 Events: event->contextinstanceid should be used where possible
While restoring event context might not be present (deleted)
So before using context api's check context or use event properties
2014-01-29 11:39:44 +08:00