305 Commits

Author SHA1 Message Date
Simey Lameze
2cf7bde8e9 MDL-61364 question: adjust code and fix phpunit errors 2018-03-27 16:14:46 +08:00
Shamim Rezaie
2adefc21ac MDL-61380 Questions: Support selecting "random" by tag in question bank 2018-03-07 05:33:11 +11:00
Luca Bösch
eeb8e895da MDL-61250 questions: Omit leading space in question preview link 2018-01-25 14:24:09 +01:00
Andrew Hancox
f3d9872aa3 MDL-41090 questions: Allow embedding files in response comments 2018-01-15 11:19:06 +00:00
Andrew Hancox
fd2ce923cf MDL-41090 questions: Move editor and filepicker options into engine 2018-01-15 11:19:01 +00:00
Andrew Hancox
18e1450b4b MDL-41090 questions: Support for files in behaviour response 2018-01-09 21:12:58 +00:00
Andrew Nicols
3e4de62607 Merge branch 'MDL-60139' of git://github.com/timhunt/moodle 2017-10-31 09:14:32 +08:00
Tim Hunt
808b68835b MDL-60139 question manual grading: redisplay mark as typed if editing
When the teacher is upgrading a previously entered grade, we re-display
exactly what they typed before if possible, rather than displaying with
a set number of decimal places.
2017-10-30 12:52:02 +00:00
Tim Hunt
dae0ccfc45 MDL-59606 quiz responses: fix edge cases in the report
This patch conbines valuable contributions from Kashmira Nagwekar and
Luca Bösch. Many thanks to them. However, the final form of the fix,
and hence the blame, falls to me -- Tim.

There were several issues here:

* The load_questions_usages_by_activity method in
  question/engine/datalib.php was incorrectly treating the case
  when no data was returned. (Looks like a historic copy-pase from
  other methods that fetch one item by unique id, which therefore
  must exist.)

* The report was not correctly handling the display when the 'Which
  tries' was set to 'with, and without, attempts'.

* It was possible to select the 'All tries' option when also saying
  'Users without attempts'. This combination makes not sense, so
  a disabledIf rule was added to the form.
2017-10-27 16:57:01 +01:00
Adrian Greeve
e3909e5853 MDL-59881 question bank: Use supplied function parameters.
question_usage_by_activity::start_all_questions now uses all
three of the parameters that are defined.
2017-08-22 09:30:04 +08:00
Damyon Wiese
663640f5b3 MDL-40759 icons: convert uses of pix_url to pix_icon
Also change filepicker to use scaled svgs instead of sets of custom pngs. The svgs are taken from font-awesome.
2017-03-17 15:52:17 +08:00
Tim Hunt
2d708a7365 MDL-57588 questions: regrading should not lose flags 2017-01-30 14:31:52 +00:00
Marina Glancy
e7ba25f1b1 MDL-29332 question: calculated variables may differ in case only 2016-09-19 10:37:43 +08:00
Rajesh Taneja
52f3e060e4
MDL-55091 phpunit: Following has been deprecated.
1. getMock()
2. setExpectedException()
3. checkForUnintentionallyCoveredCode renamed to beStrictAboutCoversAnnotation
4. beStrictAboutTestSize renamed to enforceTimeLimit
5. UnitTestCase class is now fully removed.
2016-07-26 10:11:30 +08:00
Russell Smith
1fcf0ca8a5 MDL-35628 performance: Remove dirname() where possible.
dirname() is a slow function compared with __DIR__ and using
'/../'.  Moodle has a large number of legacy files that are included
each time a page loads and is not able to use an autoloader as it is
functional code.  This allows those required includes to perform as
best as possible in this situation.
2016-06-10 08:06:49 +10:00
Juan Leyva
b6c538416b MDL-52767 mod_quiz: New API for retrieving the question types 2016-03-23 00:56:05 +01:00
Tim Hunt
81e47a35e8 MDL-53304 question behaviour: don't show useless Check buttons
Previously, the Check button was often shown disabled when it
could not be used (e.g. when the question was finished, or when an
interactive question was in the try-again state). Eventually we
realised it was better usability to hide it in these cases.

Note that when a teacher reviews an in-progress quiz attempt, they will
see a disabled Check button if the student doing the quiz can see the
button.
2016-03-04 14:06:19 +00:00
Eloy Lafuente (stronk7)
fa6426a069 Merge branch 'MDL-52814' of git://github.com/timhunt/moodle 2016-02-16 16:48:04 +01:00
Tim Hunt
97e9eb203e MDL-52814 questions: Show extra info in the outcomes area not info
Currently the only use is the quiz Redo question button, and that would
be much better placed in the feedback area, not least for langages where
the button label needs to be longer.
2016-02-10 08:47:10 +00:00
Andrew Nicols
650c0086f9 MDL-52339 question: Fix question attempt removal for MySQL
Derived table support was altered in MySQL 5.7 changing the way in which
DELETE FROM works in some cases.

This change modifies the way in which deletion occurs by selecting all IDs
and batching them into groups of 1000.
2016-02-05 09:10:09 +08:00
Tim Hunt
d392b13a63 MDL-52427 questions: all parts of a Q should be clearfix
Otherwise large floated images may overflow.
2015-12-13 20:27:54 +00:00
Ankit Agarwal
c917b53a8d MDL-50269 deprecations: Properly deprecate notify() 2015-12-01 15:29:33 +08:00
Tim Hunt
e5acdcb942 MDL-51771 question engine: fix typo in SQL
Thanks to Pete at learningpool.com for finding thsi bug.
2015-10-18 16:03:29 +01:00
Eloy Lafuente (stronk7)
ca09f076f8 MDL-50182 core: add 3.0 environmental requirements
Only change from 2.9 is the modification of the slasharguments
admin setting string to recommend always to keep the setting enabled
and fix the problem in the server, warning about the drawbacks
of disabling it.

Also, there is a little phpdoc note added to one custom check
to have clearly specified when we can get rid of it.
2015-10-13 00:33:41 +02:00
Tim Hunt
ddc016830d MDL-51476 questions: manual grading validation for ungraded Qs
The change in MDL-51090 broke manually commenting on questions for which
no mark is given (max mark == 0). This fixes it, with unit tests.

Thanks to Nick Phillips for the original suggestion of the fix.
2015-09-25 14:01:33 +01:00
Tim Hunt
b2694c0219 MDL-51090 question: further refinements to validating manual grades 2015-09-01 23:05:37 +01:00
Nelson Moller
52b08f5fce MDL-51090: mod_quiz grading validation of an essay question
An invalid format is casted to 0 (if a string) or to some truncated value in other cases (ex: 10..5).
2015-08-20 19:58:49 +01:00
Eloy Lafuente (stronk7)
188458a604 MDL-50049 deprecation: Extra minor fixes.
- complete and cleanup upgrade.txt
- replace remaining uses in comments.
- fix some incorrect bulk-replacement in previous commit.
2015-07-10 01:59:31 +02:00
Tim Hunt
e7df2335b6 MDL-50373 questions: random Qs must not pick deleted or sub- questions
This was a regression caused by MDL-6340. I missed the necessary
    AND parent = 0 AND hidden = 0
in one query of the question table.
2015-05-27 20:32:47 +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
Tim Hunt
f6579bea94 MDL-40992 question engine: new ways modify question usages
* A method to change the max mark for one question_attempt in the usage

* A method to replace one question in a usage with another, moving the
old question_attempt to the end.

* Methods to set and get metadata (string name value pairs) for each
question_attempt in the usage. This gets stored in the first step in a
way that should not interfere with anything else.
2015-03-26 17:46:48 +00:00
Tim Hunt
47be39ef41 MDL-40992 qbehaviour: new type method, can Qs can finish naturally 2015-03-26 17:46:48 +00: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
bb93fc24aa MDL-6340 quiz: avoid reusing random questions between attempts
There are several improvements over what we had before:

1. We track all the questions seen in the the student's previous
quiz attempts, so that when they start a new quiz attempt, they get
questions they have not seen before if possible.

2. When there are no more unseen questions, we start repeating, but
always taking from the questions with the fewest attempts so far.

3. A similar logic is applied with variants within one question.

There is lots of credit to go around here. Oleg Sychev's students Alex
Shkarupa, Sergei Bastrykin and Darya Beda all worked on this over
several years, helping to clarify the problem and shape the best
solution. In the end, their various attempts were rewritten into this
final patch by me.
2015-03-26 17:45:49 +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
fd7a8af50b MDL-40990 qbehaviours: method to say if attempts can finish naturally 2015-03-13 14:23:02 +00:00
Tim Hunt
df44db5baa MDL-48373 behat, questions: convert tests to use the new steps
The new steps make it more efficient to create questions.

While making the changes, I took the opportunity to alter the tests to
follow Behat best practices, and only test one thing per scenario.
2014-12-05 12:22:27 +00:00
Damyon Wiese
bdb319a5b1 Merge branch 'MDL-47740' of git://github.com/timhunt/moodle 2014-10-24 11:48:01 +02:00
Tim Hunt
a8de866712 MDL-47740 question engine: let qs update variant later if appropriate
Variant has two purposes. First to determine which version of the
question the student will see. Hence it is used to set up the state
of the quetsion when the question is started. Then the internal state of
the question is saved in the first step.

Once that has been done, the variant number is purely informative, and
just used to break down the statistics.

In some cases (the one I have in mind is qtype_opaque) then there is a
complex randomisation process, which may lead to several inital variant
numbers acutally giving the same version of the question. In this case
it is nice if the question can update the stored variant number, to make
the statistics more meaningful.
2014-10-21 11:43:57 +01:00
Tim Hunt
cf256c05d8 MDL-32616 question engine: set_max_mark_in_attempts MySQL perf
The MySQL (& Maria DB) query 'optimizer' was failing to handle this
query, so for that DB only, we give it an equivalent query that it can
get right.

With unit test.
2014-10-20 12:06:39 +01:00
Tim Hunt
7ad0e2e654 MDL-32616 question engine: move unit test to better name 2014-10-20 12:06:38 +01:00
Dan Poltawski
735c7ee41a Merge branch 'MDL-47122' of git://github.com/timhunt/moodle 2014-09-08 14:28:30 +01:00
Tim Hunt
16e246ac52 MDL-47122 question_engine_data_mapper: which methods are public.
That is, which may be used from outside the question engine.
2014-09-08 13:24:17 +01:00
Tim Hunt
a7b4c96440 MDL-46761 fix PHPdocs on question_usage_by_activity::get_total_mark
Thanks to Tony Gardner-Medwin for spotting this.
2014-09-07 11:37:43 +01:00
Tim Hunt
4040e2dd11 MDL-47122 use insert_records to improve question engine performance. 2014-09-04 23:15:27 +01:00
Tim Hunt
f4fe3968a2 MDL-46212 questions: add {} whenver vars are put into "" strings
Having had one subtle bug cased be this, I decided to do a search and
fix all of these.
2014-07-03 14:02:39 +01:00
Damyon Wiese
84f08cfa9d MDL-45606 Unit test fix for MySQL and added a comment about the removed code. 2014-05-20 18:01:32 +08:00
James Pratt
038014c415 MDL-41760 quiz_statistics : response analysis for first/last/all tries 2014-03-18 18:47:19 +07:00
Tim Hunt
8011be189e MDL-33653 fix preview links on calc qtype edit forms.
Also, refactor how we render preview icons, to eliminate duplication.
2014-03-07 19:46:56 +00:00