195 Commits

Author SHA1 Message Date
Tim Hunt
c7fbfe46f9 MDL-38538 question autosave: fix sequencecheck handling. 2013-04-04 15:32:32 +01:00
Dan Poltawski
ac8bc0f947 Merge branch 'MDL-34640' of git://github.com/timhunt/moodle 2013-04-03 13:57:02 +08:00
Tim Hunt
d122fe3245 MDL-38538 question autosave: fix missing method.
Also change the unit tests to detect this problem.
2013-04-02 16:53:25 +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
0a606a2be2 MDL-38538 question auto-save back end.
1. Autosave works in some ways just like a normal save. We ultimately
call $behaviour->process_save() to do the work, and create a new step to
hold the data.

2. However, we come in through a completely different route through the
API, starting with separate auto-save methods. This keeps the auto-save
changes mostly separate, and so reduced the chance of breaking existing
working code.

3. When the time comes to store the auto-save step in the database, we
save it using a negative sequence number.

This is a clever trick that not only distinguises these steps, but also
avoids unique key errors when an auto-save and a real action happen
simultaneously. (There are unit tests for these tricky edge cases.)

4. When we load the data back from the database, most of the time the
auto-save steps are loaded back as if they were a real save, and so the
auto-saved data is used when the question is then rendered.

5. However, before we process another action, we remove the auto-saved
step, so it does not appear in the final history.
2013-03-28 16:51:59 +00:00
Tim Hunt
eca230b521 MDL-38538 question unit tests: improve things a bit.
1. Split the question_attempt tests into one class per file.
2. Imporve the API to give tests more control, and to test more of the
   important code. Some of this is not used here, but it is about to be.
2013-03-28 16:05:34 +00:00
Tim Hunt
770e4a467f MDL-38311 question manual grading: comment fixes. 2013-03-06 09:27:11 +00:00
Tim Hunt
53b8e25626 MDL-38311 questions: manual grading API should accept commentformat
Comment format (FORMAT_...) was correctly being processed when the
manual grading happened as the result of a form submission. It was only
when done using the question_usage or question_attempt API method that
there was no way to specify the format. (Although I think the only place
this API as used was in the unit tests.)

Note that question_attempt::manual_grade API had to change, but I don't
think that is a real API change. Calling code should be using
question_usage::question_attempt, which is backwards compatible.

Note that now, if you don't pass format, then no error is generated, but
a developer debugging message is generated.
2013-03-05 11:51:47 +00:00
Tim Hunt
2d2018abda MDL-37896 qtype_essay: correct PARAM_CLEANHTML -> PARAM_RAW.
It turns out that you should almost never use PARAM_CLEANHTML.
2013-02-08 12:51:21 +00:00
Tim Hunt
c0d12fc1cd MDL-37847 plain text essays were screwing up HTML special chars.
This was incorrect use of PARAM_CLEANHTML for these inputs.

This fix also adds some unit tests to try to verify that this does not
break again in future.
2013-02-04 12:54:10 +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
Frederic Massart
c384744304 MDL-36638 usability: Core changes for new quiz/question icons 2012-11-29 12:41:29 +08:00
Tim Hunt
a560d636f4 MDL-34399 questions: cache to help load question definitions.
At the moment, it takes several DB queries to load each question definition,
so this cache is potentially a big win.
2012-10-26 11:58:02 +08:00
Dan Poltawski
c07189ebe8 Merge branch 'MDL-35693' of git://github.com/timhunt/moodle 2012-10-02 11:47:50 +08:00
Tim Hunt
1c80e79ac6 MDL-35693 question engine: set id when saving a new question_attempt 2012-09-28 15:28:27 +01: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
2c76c89422 MDL-35419 question manual grading: valdiation must handle 0,5
Yet another , as decimal separator issue!

To fix this nicely, I refactored some code into question_utils.
2012-09-13 16:33:15 +01:00
Aparup Banerjee
2cdd5d8571 MDL-34549 added IGNORE_MISSING to context call for bc 2012-08-28 12:29:17 +08:00
Ankit Agarwal
d197ea4300 MDL-34549 libraries: Replace get_context_instance_by_id() by context::instance_by_id() 2012-08-24 11:30:10 +08:00
Tim Hunt
2ec325c252 MDL-29847 question preview: garbage collect old preview data.
This adds cron code which looks for question previews that have not been
touched for more than 24 hours, and deletes them.

We try to delete previews immediately. For example if the user clicks
start again, then we immediately delete their previous preview. However,
we can't do that if they just close the preview window. Hence we need
some cron code to clean up old preview that have got left lying around.

Normally, this code will not have much to do, so it will be very fast,
so we can afford to run it every cron.

This has been implemented in such a way that in future it will be easy
to add other cron code to the question bank.

Sadly, to make this work on MySQL, we require a horrible hack in the
already hacky delete_usage_records_for_mysql function.
2012-08-16 17:02:01 +01:00
Tim Hunt
4c16e191e1 MDL-34862 question preview: improve preview ownership check.
Users should only be able to access their own quetion preview. In the
past, for reasons I can no longer remember, this was enforced
using the session. It is much better to set the question_usage to belong
to the user's context.
2012-08-13 16:53:15 +01:00
Frederic Massart
21c08c63ca MDL-34458 Librairies: Replaced deprecated get_context_instance() 2012-07-24 16:58:17 +08:00
Dan Poltawski
5082d87c03 Merge branch 'wip-mdl-32940' of git://github.com/rajeshtaneja/moodle 2012-07-24 13:39:59 +08:00
Rajesh Taneja
61cca0b7fc MDL-32940 libraries: Replaced deprecated PARAM_NUMBER with PARAM_FLOAT 2012-07-23 17:21:05 +08:00
Dan Poltawski
3fb8128fb6 Merge branch 'MDL-34251' of git://github.com/timhunt/moodle 2012-07-23 14:01:59 +08:00
Petr Škoda
c8b3346cfd MDL-33180 delete the last traces of SimpleTest - ciao and thanks 2012-07-21 10:11:50 +02:00
Tim Hunt
dd7aa58386 MDL-34251 question engine: possible infinite loop loading usages
In the case where either a question_attempt had not steps, or a
question_usage had not question_attempts, the load_from_records methods
could get stuck in an infinite loop.

This fix ensures that does not happen, with unit tests to verify it. At
the same time, I noticed an error in the existing tests, which this
patch fixes.
2012-07-19 12:51:00 +01:00
Tim Hunt
05038fcba0 MDL-34065 questions: also fix two typos in comments.
Amended to change 2 accordin => according
2012-07-05 13:49:05 +02:00
Tim Hunt
bf92acc253 MDL-32062 question engine: fixup tests that this change broke.
The test data was wrong, and was triggering the work-around code that
MDL-32062 introduced. I fixed the test data.

Also, I fixed one of the tests, that had been broken.
2012-07-04 10:47:03 +01:00
Sam Hemelryk
74abe5ce15 Merge branch 'MDL-32062' of git://github.com/timhunt/moodle 2012-07-04 09:54:06 +12:00
Tim Hunt
9212fe7a79 MDL-32062 question engine: fix re-grading attempts from 2.0
The code to upgrade attempts from before Moodle 2.0 to 2.1 created
attempt data that was not exactly the same as a new attempt created in
2.1+. This did not matter very much - revew and the quiz reports all
worked OK - but it broke on re-grade.

These changes detect the problem data in the re-grade code, an apply a
work-around so that the re-grade gives the correct result.
2012-06-26 10:11:15 +01:00
Tim Hunt
f1b3d3e08e MDL-30883 question flags: aria attributes for accessibility
Also, update code to use html_writer, and fix pointer style when not
editable.
2012-06-26 09:58:11 +01:00
Tim Hunt
ba6425ab3d MDL-33779 question: code clean-up 2012-06-15 14:02:15 +01:00
Dan Poltawski
8119141b91 Merge branch 'MDL-33020' of git://github.com/timhunt/moodle 2012-05-25 10:14:17 +08:00
Tim Hunt
5ef18d8250 MDL-33020 qtype unit tests: improve failure messages. 2012-05-15 17:55:29 +01:00
Dan Poltawski
eca95b639d Merge branch 'MDL-32375' of git://github.com/timhunt/moodle 2012-05-14 20:42:12 +08:00
Dan Poltawski
2edce32ad4 Merge branch 'MDL-32910' of git://github.com/timhunt/moodle 2012-05-14 10:10:03 +08:00
Tim Hunt
6cdef715df MDL-32375 question unit tests: fix breakage from phpunit coversion.
Three things:

1. Fixes to select expectation.

2. Fixes to match walkthrough tests (No idea how these managed to pass
under Simpletest!)

3. Fix expected values for multianswer upgrade tests.
2012-05-11 14:59:58 +01:00
Tim Hunt
1921d47b0a MDL-32910 MDL-32569 broke unit tests in third-party qtypes 2012-05-10 11:16:06 +01:00
Davo Smith
d50e8a1bda MDL-32698 Question - Fixed typos in load_question_attempt 2012-05-01 10:17:08 +01:00
Eloy Lafuente (stronk7)
d3cb25dfef Merge branch 'MDL-32322' of git://github.com/timhunt/moodle
Conflicts:
	mod/quiz/report/simpletest/testreportlib.php
	mod/quiz/report/statistics/simpletest/test_qstats.php
2012-04-25 03:02:14 +02:00
Petr Skoda
4ca04fb58b MDL-32569 remove remaining references to simpletest and improve events test 2012-04-21 17:08:30 +02:00
Petr Skoda
2338458ac5 MDL-32569 drop all migrated question simpletests 2012-04-21 16:43:34 +02:00
Tim Hunt
ac4d91575a MDL-32322 quiz reports: name improvement attempt_report -> attempts_report. 2012-04-20 10:07:22 +01:00
Dan Poltawski
7a1ed64587 Merge branch 'w15_MDL-32323_m23_phpunit3' of git://github.com/skodak/moodle 2012-04-11 09:32:58 +08:00
Petr Skoda
a4d53e4b26 MDL-32323 make base test case classes abstract to prevent empty testcase warnings, fix property access 2012-04-10 18:51:34 +02:00
Petr Skoda
603bd00112 MDL-32323 convert question tests
1/ type/match/tests/walkthrough_test.php - tests are failing randomly, looks like some weird randomisation is going on there - see TODOs

2/ type/multianswer/tests/upgradelibnewqe_test.php contains invalid expected value - see TODO
2012-04-10 15:27:11 +02:00
Tim Hunt
b9832f2b87 MDL-32318 question preview: fix php stric syntax error
Also, cheating, and committing a whitespace fix in the same commit.

Conflicts:

	question/engine/questionusage.php
2012-04-05 16:42:23 +01:00