18 Commits

Author SHA1 Message Date
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
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
4040e2dd11 MDL-47122 use insert_records to improve question engine performance. 2014-09-04 23:15:27 +01:00
Tim Hunt
c4efeb2b4b MDL-32188 question CBM: fix typos in comments.
Also one method name.
2013-10-04 17:52:24 +01:00
Tim Hunt
4e3d829350 MDL-42105 questions: let attempts have a max fraction > 1.
This parallels question_attempt->minfraction, which allows the
fractional mark to go below zere.

This is needed to allow the certainty-base marking behaviours to work
better.
2013-10-04 17:52:19 +01:00
Tim Hunt
afb1b3d03b MDL-39980 question engine: Attempt on last loses response files
When doing Each attempt builds on last, we need to copy any response
files into a draft file area, and then re-save them.

While writing the unit test for this, I had to deal with a todo in the
question engine so that questions with files in the response could be
unit-tested.

I also found an fixed a bug with qtype_essay_question::is_same_response
and fixed some notices in the existing essay/manual graded unit tests.
2013-08-15 12:55:13 +01:00
Tim Hunt
dc1ee5cb29 MDL-34640 question repsponse files: remaining tidy up of this code. 2013-03-30 21:16:18 +00:00
Mathieu Petit-Clair
d0782585c8 MDL-34640: adding code to pass contextid and question type to question_file_loader. 2013-03-30 19:57:03 +00:00
Tim Hunt
8a1e7b7756 MDL-34640 quesion reponse files: PARTIAL SOLUTION to allowing resonse files to be graded automatically. 2013-03-30 19:53:15 +00:00
Tim Hunt
03cefcc91b MDL-37506 question code: incorrect preg_quote uses.
For preg_quote to work reliably, you must pass the delimiter you are
using for your regular expression. In many places we were failing to do
that.
2013-01-18 11:18:54 +00:00
Tim Hunt
65cf651fd8 MDL-35620 question engine: should distinguish NULL and 0.
This only matters in an obscure edge case, but it is an edge case we hit
with one of the OU question types.

This load data code is processing the results of a LEFT JOIN, so is_null
is the correct logic.
2012-09-27 12:44:07 +01:00
Tim Hunt
94815ccfa0 MDL-30484 question engine: don't lose response files when regrading.
The problem was mostly that, in the past, we did not worry if
question_attempt_step.id changed during regrade (because we deleted the
old step row and inserted a new one). However, now that steps can have
associated files, we can't be that slack, becuase the step id is used as
the file itemid.

So, now, we have to update the existing rows during a regrade. We do
this by having the question engine tell the question_engine_unit_of_work
that the step has first been deleted, and then added back. Then we make
the unit-of-work spot that delete + add = update.

This also means that during regrading, we have to pass around some extra
ids so that new steps know the id of the step they are replacing.

Naturally, this requires some quite trickly logic, so I finally got
around to writing unit tests for question_engine_unit_of_work, which is
a good thing.

Along the way I also got around to renaming
question_attempt->set_number_in_usage, which got missed out when
everthing else was renamed to slot ages ago.

Finally, while working on this code, I noticed and fixed some PHPdoc
comments.
2012-01-30 16:57:23 +00:00
Tim Hunt
35d5f1c28d MDL-27948 The question engine should use recordsets to load attempt data
This should be good for performance (memory usage). It also avoids having to construct a meaningless, unique, first column, which is a pain on MyQSL.
2011-06-22 18:53:15 +01:00
Eloy Lafuente (stronk7)
36e91f1de1 MDL-20636 Whitespace fixes 2011-06-06 16:38:46 +01:00
Tim Hunt
1da821bbde MDL-27649 support question variants as a first-class concept in the question engine. 2011-05-26 21:23:56 +01:00
Tim Hunt
ab50232b7e MDL-27413 start conversion of the multianswer qtype to the new question engine. 2011-05-23 16:45:12 +01:00
Tim Hunt
9c197f4445 MDL-20636 Fix some more codechecker issues. 2011-05-14 22:53:25 +01:00
Tim Hunt
dcd03928ab MDL-20636 split question/engine/lib.php into several smaller files. 2011-05-12 10:28:09 +01:00