52 Commits

Author SHA1 Message Date
Tim Hunt
de3d216c5a MDL-69246 questions: allow for float issues when validating manual marks
As well as fixing the bug, I also rewrote the test to use
data providers, which should lead to more useful failure messages.

And, I moved the magic number we used as the float tolerence to
be a named constant.
2020-08-27 17:37:31 +01:00
Tim Hunt
64207dab65 MDL-67183 questions: get_question & get_behaviour only init if required
This reviews all the code code, and sets $requirequestioninitialised
whenever possible in these calls, which should improve performance.
2020-05-19 20:52:07 +01:00
Tim Hunt
6c91e515b0 MDL-65245 question_attempt: fix PHPdoc and other PHPstorm warnings 2019-04-02 16:32:36 +01:00
David Monllaó
6f5d32ea4d Merge branch 'MDL-64590' of https://github.com/timhunt/moodle 2019-02-12 12:45:48 +01:00
Shamim Rezaie
029d3b471b MDL-52132 qbehaviour_manualgraded: no change when comment is left blank 2019-01-24 16:20:01 +08:00
Tim Hunt
d387f50fcd MDL-64590 questions: wrong comments shown in the state history table 2019-01-18 18:00:42 +00:00
Andrew Nicols
f93e2c5c1e MDL-52132 core_question: Comment is different if format has changed 2019-01-15 18:56:12 +11:00
Andrew Hancox
f3d9872aa3 MDL-41090 questions: Allow embedding files in response comments 2018-01-15 11:19:06 +00:00
Tim Hunt
6b3bd52fae MDL-51090 question manual grading: fixing for testing issues 2015-09-02 15:09:34 +08:00
Tim Hunt
b2694c0219 MDL-51090 question: further refinements to validating manual grades 2015-09-01 23:05:37 +01:00
Tim Hunt
312dce0ebc MDL-50341 quiz statistics: non-attempted questions broke first-try stats
For behaviours that allow multiple tries, and when the teacher had chosen to
generate statistics for the first tries only, and when a student had not
attempted one question, then an error occurred. It should have been classified
as no response.
2015-05-31 13:36:53 +01:00
Tim Hunt
fd7a8af50b MDL-40990 qbehaviours: method to say if attempts can finish naturally 2015-03-13 14:23:02 +00:00
James Pratt
96a0b9aaaa MDL-45373 quiz response analysis : count all tries at question
don't filter repeated tries.
2014-05-06 12:26:02 +07:00
James Pratt
038014c415 MDL-41760 quiz_statistics : response analysis for first/last/all tries 2014-03-18 18:47:19 +07:00
James Pratt
99caa248a8 MDL-43478 quiz responses report : display last / first / all tries
when using multiple try question behaviour
2014-02-23 13:39:08 +07:00
Tim Hunt
1eb470fc42 MDL-43929 question manual grading: keep comment when validation fails.
If the validation failed, so the manual grading page was re-displayed
with a validation error, then any comment that had just been typed in
was getting lost. This fixes that.
2014-02-07 21:55:05 +00:00
Tim Hunt
8b9ef25ea2 MDL-32188 question CBM: use short certainty name in response summaries. 2013-10-04 21:46:47 +01:00
Tim Hunt
2bf83cb218 MDL-32188 question CBM: minimal handling of certainty -1
Certainty -1 has never been used in standard Moodle, but is
used in Tony-Gardiner Medwin's patches to mean 'No idea' which
we intend to implement: MDL-42077. In the mean time, these changes
avoid errors for people who have used TGM's patches.
2013-10-04 21:46:46 +01:00
Tim Hunt
e74aa0aa97 MDL-32188 question CBM: compute summary stats for CBM behaviours
We now compute the average CBM score, accuracy, CBM bonus and enhanced
accuracy, both for the entire quiz, and for just the questions answered.

Note that these calculations must work correctly in the presence of
descriptions, ungraded questions, and manually graded questions. For
example, imagine a essay added at the end of the quiz "Summarise what
you learned attempting this exercise." This might have max mark zero or
non-zero. The CBM statistics just ignores questions like that.
2013-10-04 17:56:36 +01:00
Tim Hunt
fb74929e97 MDL-32188 question CBM: alter score handling.
We now change so that minfraction is -6 and maxfraction is 3, so getting
the question right a low certainty gives maxmark marks, and you get a
bonus for being more confident (rather than being penalised for being
unconfident). Mathematically it is the same, but the difference is
importnat psychologically.

We also change how partially correct scores are handled.
It is too harsh to penalise a partially correct score with full
certainty by doing a linear interpolation between -6 and +3. Instead,
any partially correct score (e.g. 0.5) becomes that fraction of the
correct score (e.g. 0.5 * 3 = 1.5). Also, any incorrect score is treated
as 0, so if you have a multiple choice question that normally gives a
negative score for a wrong choice, this will now never give a score of
less than -6.

Finally we change how this is displayed to students beside the question.
Rather than saying "Marked out of 1.00", we say "Base mark 1.00", and
then later we say "CBM mark 3.00" (or whatever it is).
2013-10-04 17:52:29 +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
f3460297a9 MDL-32188 question engine: behaviour static methods -> new classes
It was always a bit of a hack to use static methods on the
qbehaviour_whatever classes to return metadata about the behaviour. It
is better design to have real qbehaviour_whatever_type classes to report
that metadata, particularly now that we are planning to add more such.

For example, inheritance works better with real classes. See, for
example, the improvements in
question_engine::get_behaviour_unused_display_options().

This change has been implemented in a backwards-compatbile way. Old
behaviours will continue to work. There will just be some developer debug
output to prompt people to upgrade their code properly.
2013-10-04 12:15:01 +01:00
Jamie Pratt
d50b05e696 MDL-41751 changes to api of question_response_analyser
and code refactoring and clean up.
2013-09-27 17:38:13 +07:00
Ruslan Kabalin
f8e28244cb MDL-31226: quiz: Fix message for attempts built on previous.
At the moment, when attempt is built on the last one, "not yet answered"
message is shown, which confuses many people. This patch modifies the state to
"complete" for attempt based on previous and modifies the output string.

Many thanks to Tim Hunt for guiding me through quiz infrastructure and some code
suggestions.
2013-08-02 16:19:18 +01:00
Tim Hunt
06616f4b70 MDL-30320 question engine: remove API deprectaed in Moodle 2.2. 2013-05-19 23:38:19 +01: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
15dd772736 MDL-34399 questions cleanup: straighten out strange links to question objects. 2012-10-26 11:58:14 +08: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
Rajesh Taneja
61cca0b7fc MDL-32940 libraries: Replaced deprecated PARAM_NUMBER with PARAM_FLOAT 2012-07-23 17:21:05 +08:00
Tim Hunt
ee326d5e7d MDL-33548 quiz manual grading: check the grade is in range.
To do this nicely, I refactored some code out of the quiz manual grading
report.
2012-06-06 20:21:33 +01:00
Tim Hunt
3d17cd3f1c MDL-30300 qbehaviours: convert to the new is_compatible_question API. 2011-11-16 11:11:10 +00:00
Tim Hunt
15d660a8fd MDL-30300 question behaviours: improve q compatibility API. 2011-11-16 10:52:19 +00:00
Tim Hunt
75a31c9039 MDL-29808 qbehaviours: update to use ->dependencies in version.php 2011-11-10 19:12:25 +00:00
Tim Hunt
fde4560dae MDL-27490 Implement a manage question behaviours admin page
While doing this, I found various bugs in the manages question types admin page, and so fixed them, and updated the code
there to use $OUTPUT and html_writer.

AMOS BEGIN
 MOV [cannotdeletemissingqtype,admin],[cannotdeletemissingqtype,question]
 MOV [cannotdeleteqtypeinuse,admin],[cannotdeleteqtypeinuse,question]
 MOV [cannotdeleteqtypeneeded,admin],[cannotdeleteqtypeneeded,question]
 MOV [deleteqtypeareyousure,admin],[deleteqtypeareyousure,question]
 MOV [deleteqtypeareyousuremessage,admin],[deleteqtypeareyousuremessage,question]
 MOV [deletingqtype,admin],[deletingqtype,question]
 MOV [numquestions,admin],[numquestions,question]
 MOV [numquestionsandhidden,admin],[numquestionsandhidden,question]
 MOV [qtypedeletefiles,admin],[qtypedeletefiles,question]
 MOV [uninstallqtype,admin],[uninstallqtype,question]
AMOS END
2011-06-17 16:21:32 +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
1631ceeaec MDL-20636 Fix codechecker issues in the question behaviours. 2011-04-08 07:24:24 +01:00
Tim Hunt
c7df5006b9 MDL-20636 Add lots of missing public/protected/private. 2011-03-23 16:22:25 +00:00
Tim Hunt
ef31a28343 MDL-20636 Split question_definition::init_first_step into start_attempt and apply_attempt_state. 2011-02-24 19:12:42 +00:00
Tim Hunt
2daffca554 MDL-20636 Fix 30 TODOs 2011-02-24 17:47:51 +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
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
ec3d4ef543 MDL-20636 Actually, passing to get_question summary is silly. Revert. 2011-01-13 18:36:03 +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
c76145d3e4 MDL-20636 Previewing a truefalse question in deferred feedback mode now works. 2011-01-13 18:35:43 +00:00