174 Commits

Author SHA1 Message Date
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
Eloy Lafuente (stronk7)
46ed2f8b7f Merge branch 'w14_MDL-32251_m23_strict3' of git://github.com/skodak/moodle 2012-04-03 21:17:58 +02:00
Dan Poltawski
aefc7e28ff Merge branch 'MDL-32213_manual_grade_question_upgrade' of git://github.com/davosmith/moodle 2012-04-02 16:59:10 +08:00
Petr Skoda
97621c33c9 MDL-32250 fixed case typo
Thanks Dan!
2012-04-02 09:21:14 +02:00
Petr Skoda
caee6e6c26 MDL-32251 E_STRICT fixes part 3 2012-03-29 15:24:30 +02:00
Petr Skoda
0bb48cc2a1 MDL-32250 import latest SimpleTest 1.1.0 2012-03-29 15:07:53 +02:00
Davo Smith
1892a35625 MDL-32213 Question upgrade now correctly handles non-core manually-graded question types 2012-03-27 13:44:07 +01:00
Sam Hemelryk
ef844d0a15 Merge branch 'w12_MDL-32094_m23_phpstrict' of git://github.com/skodak/moodle 2012-03-20 16:47:17 +13:00
Petr Skoda
072db71c90 MDL-32094 fix question related E_STRICT problems 2012-03-18 18:33:54 +01:00
Tim Hunt
8cb7a6d512 MDL-31594 question manual grading: did not handle comma as decimal. 2012-03-15 18:46:43 +00:00
Eloy Lafuente (stronk7)
f1fbdbea33 Merge branch 'MDL-31829' of git://github.com/timhunt/moodle 2012-03-06 21:18:04 +01:00
Tim Hunt
296e1e9782 MDL-31829 question engine SQL typo breaks some regrades.
Also, some MySQL-only code had not been updated.

This problem only affected a small minority of question attempts, like
this:
1. Suppose you have a shortanswer question with correct answer 'Toad'
and some hints.
2. Suppose a student attempts this using the interactive behaviour and
on the first try responds 'Frog', and on the second try responds 'Toad'.
3. Then suppose the teacher edits the question to make 'Frog' correct.
4. Then, when the quiz is regraded, the question_attempt_step for the
second try will need to be deleted. That is where the buggy code was.
2012-03-01 12:33:14 +00:00
Tim Hunt
7a26403fc9 MDL-31828 attachements to essay questions do not work on Oracle. 2012-03-01 12:10:39 +00:00
Michael Aherne
2af7d0d8d0 MDL-31495 Performance improvement in question engine upgrade SQL 2012-02-10 15:24:43 +00:00
Eloy Lafuente (stronk7)
7ce92ac1ad Merge branch 'MDL-30484' of git://github.com/timhunt/moodle 2012-01-31 17:16:04 +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
Aparup Banerjee
fd174542e3 Merge branch 'MDL-31392' of git://github.com/timhunt/moodle 2012-01-30 14:24:31 +08:00
Tim Hunt
6401b3c5bb MDL-31392 qeupgradehelper partial upgrade support broken since 2.2 2012-01-26 16:31:44 +00:00
M Kassaei
da22c0127b MDL-31306 question preview: disable 'Fill correct' for qtypes that can't 2012-01-24 13:26:44 +08:00
Tim Hunt
3159bf92e0 MDL-31065 qtype shortanswer: refactor the unit tests to use a proper helper. 2012-01-20 17:27:55 +00:00
Petr Skoda
927010240f MDL-31006 some more PHP54 notices
PHP54 compatibility - PhpStorm IDE is the best tool for this kind of work!!
2012-01-18 01:17:25 +01:00
Dan Poltawski
a530d4a93b MDL-29091 quiz - switch to use moodle_url::out_as_local_url 2012-01-13 10:16:52 +00:00