Commit Graph

52 Commits

Author SHA1 Message Date
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 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
Frederic Massart 21c08c63ca MDL-34458 Librairies: Replaced deprecated get_context_instance() 2012-07-24 16:58:17 +08:00
Davo Smith d50e8a1bda MDL-32698 Question - Fixed typos in load_question_attempt 2012-05-01 10:17:08 +01:00
Tim Hunt ac4d91575a MDL-32322 quiz reports: name improvement attempt_report -> attempts_report. 2012-04-20 10:07:22 +01: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
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
Sam Hemelryk f67911b6ac Merge branch 'MDL-30760' of git://github.com/timhunt/moodle 2011-12-20 13:39:54 +13:00
Tim Hunt c83ed025ef MDL-30760 question engine: question summary can be longer than 64k!
1. So we will truncate the question summary to 65000 chars if necessary.

2. Also, fix one minor error in mutlianswer save_question_options.

question_bank::MAX_SUMMARY_LENGTH is not the most logical class to add
the constant to, but it needs to be accessible during upgrade, so I was
lazy and put it there.
2011-12-16 15:56:23 +00:00
Tim Hunt ad73a2cb4e MDL-30734 question engine: sum_usage_marks_subquery edge-case.
When all qas in a useage are 'gaveup' state, it gives NULL, not 0.0, for the total.
2011-12-14 14:29:00 +00:00
Tim Hunt 94c0ec2159 MDL-30185 question engine reporting: add redundant where to query for perf.
Without this, MySQL fails to cope.
2011-11-15 11:19:15 +00:00
Eloy Lafuente (stronk7) 35454bd55d Merge branch 'MDL-29815' of git://github.com/timhunt/moodle 2011-10-25 17:43:51 +02:00
Tim Hunt deef04a44e MDL-29339 Manually cast objects to string before calling dmllib. 2011-10-24 11:08:10 +01:00
Tim Hunt 304f0d850f MDL-29815 question engine DB: bad group-by clause detected by Oracle.
Thanks to Yanfei Lu for finding this and suggesting the fix.
2011-10-20 11:14:14 +01:00
Eloy Lafuente (stronk7) 033d656617 MDL-29520 - mysql multitable delete, outer join some tables 2011-10-09 22:15:27 +02:00
Tim Hunt f0bfd964ba MDL-29520 question engine: work-around bad MySQL delete performance.
This is a temporary fix, until the new API from MDL-29589 is available.

(amended to fix comments)
2011-10-04 12:03:41 +02: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
Tim Hunt 5f79a9bcb6 MDL-27898 fix question/engine/simpletest/testdatalib.php unit tests.
Now that MDL-27897 is fixed.
2011-06-17 11:28:05 +01:00
Tim Hunt 3b049b7626 MDL-27747 question engine stupid typo in DB query broke regrading. #472 2011-06-07 16:22:10 +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 9c197f4445 MDL-20636 Fix some more codechecker issues. 2011-05-14 22:53:25 +01:00
Tim Hunt a2ac234956 MDL-20636 Merge remote-tracking branch 'moodle/master' into upgrade
Conflicts:
	lib/filestorage/file_storage.php
	mod/quiz/attemptlib.php
	mod/quiz/lib.php
	mod/quiz/mod_form.php
	mod/quiz/report/overview/overview_table.php
	mod/quiz/report/overview/report.php
	mod/quiz/report/responses/report.php
	mod/quiz/report/responses/responses_table.php
	mod/quiz/report/statistics/db/install.xml
	mod/quiz/report/statistics/qstats.php
	mod/quiz/report/statistics/report.php
	mod/quiz/report/statistics/statistics_question_table.php
	mod/quiz/report/statistics/statistics_table.php
	mod/quiz/report/statistics/version.php
	mod/quiz/review.php
	mod/quiz/reviewquestion.php
	mod/quiz/startattempt.php
	mod/quiz/styles.css
	mod/quiz/view.php
	question/type/essay/questiontype.php
	question/type/match/backup/moodle2/backup_qtype_match_plugin.class.php
	question/type/match/backup/moodle2/restore_qtype_match_plugin.class.php
	question/type/numerical/display.html
	question/type/numerical/questiontype.php
	question/type/questiontype.php
	question/type/random/questiontype.php
	question/type/shortanswer/questiontype.php
	theme/base/style/question.css
2011-05-11 20:29:49 +01:00
Tim Hunt c749527bec MDL-20636 Finished backup and restore of attempt data. Yay 2011-05-05 21:26:25 +01:00
Tim Hunt d2c69d9373 MDL-20636 Fix query so that it works on MySQL. 2011-04-23 12:56:47 +01:00
Tim Hunt 48d9c17db3 MDL-20636 Essay questions can now handle files in the HTML editor. #216 2011-03-31 12:45:36 +01:00
Tim Hunt 6b5f24d376 MDL-20636 Handle deleting response files when the usage is deleted. #216 2011-03-31 12:45:17 +01:00
Tim Hunt cd3557e64c MDL-20636 Essay question type, make is_same_response consider files. #216 2011-03-31 12:45:07 +01:00
Tim Hunt 217f9a618c MDL-20636 Essay submission now handles attachments. #216 2011-03-31 12:45:02 +01:00
Tim Hunt 56b0df7eac MDL-20636 Kill Left over addslashes in the question engine code. #223 2011-03-11 13:45:38 +00:00
Tim Hunt 07f8858406 MDL-20636 Cannot really delete questions that were only used in previews #196 2011-03-07 16:23:11 +00:00
Tim Hunt 2daffca554 MDL-20636 Fix 30 TODOs 2011-02-24 17:47:51 +00:00
Tim Hunt 5e8a85aa64 MDL-20636 Massively reduce the number of references to quiz in the question code.
This mostly involves moving lang strings around, but I don't have time to do an AMOS script now.
2011-02-23 18:53:50 +00:00
Tim Hunt 88f0eb1546 MDL-20636 Reveiw all throw statements. 2011-02-23 16:50:09 +00:00
Tim Hunt f7970e3ca7 MDL-20636 Eliminate integer and boolean in PHPdoc comments. should be int and bool. 2011-02-23 16:25:25 +00:00
Tim Hunt a17b297d60 MDL-20636 Add missing defined('MOODLE_INTERNAL') || die(); 2011-02-23 16:00:20 +00:00
Tim Hunt 017bc1d9f3 MDL-20636 Fix @package names in question/behaviour, question/engine and question top level. 2011-02-22 20:50:18 +00:00
Tim Hunt 0ff4bd0877 MDL-20636 Fix new stdClass -> stdClass(), and trailing whitespace. 2011-02-21 18:10:19 +00:00
Tim Hunt e24ee794b2 MDL-20636 Convert the overview report. 2011-02-16 17:33:51 +00:00
Tim Hunt 2a3bdbf98e MDL-20636 Fix some minor bugs. 2011-02-16 14:06:12 +00:00
Tim Hunt 0f33deafaa MDL-20636 Fix question/enigne/datalib.php unit tests. 2011-02-15 18:19:55 +00:00
Tim Hunt 04853f273a MDL-20636 Convert quiz statistics report. 2011-02-15 17:22:31 +00:00
Tim Hunt 9b40c540ee MDL-20636 Responses report mostly working. 2011-02-14 17:57:47 +00:00
Tim Hunt cf3b65686a MDL-20636 Finished conversion of the manual grading report. 2011-02-14 17:57:44 +00:00
Tim Hunt f9b0500f7f MDL-20636 Quiz editing now works, as does the random question type.
However, all this needs more testing.

Also, a bit of a purge of training whitespace and global .
2011-02-10 20:50:18 +00:00
Tim Hunt f86390dc94 MDL-20636 Bug 11396 better handle manually graded questions that are graded out of 0.
The key point is that 0 * Ungraded should equal 0, rather than Ungraded.
2011-01-27 17:43:50 +00:00
Tim Hunt 7a7197482d MDL-20636 Fix if the use of the File API so images work in questions. 2011-01-13 18:35:57 +00:00
Tim Hunt 32d8935c8d MDL-20636 Conversion of the description question type. 2011-01-13 18:35:54 +00:00
Tim Hunt c76145d3e4 MDL-20636 Previewing a truefalse question in deferred feedback mode now works. 2011-01-13 18:35:43 +00:00