quiz settings: MDL-18485 Improve quiz settings form
* Reorder form fields to group things more logically. ** and on the corresponding admin page too. * Set some options to be 'Advanced' by default: ** Apply penalties. ** Each attempt builds on the last. ** Decimal places for question grades. ** The five 'Extra restrictions on attempts' settings. (password, etc.) * Admins can still change this to suit their institiution at Administration > Plugins > Activity modules > Quiz. * These new defaults are applied if the admin had not previously set any fields to be advanced. * Disable some filds when they are not applicable: ** Grading method, if num attempts = 1 ** Penaly scheme, if adaptive mode = no ** Each attempt builds of last, if num attempts = 1 ** Review after quiz closed options, if no close date. ** Delay between 1st and 2nd attempts, if num attempts = 1 ** Delay between later attempts, if num attempts < 3 * Convert quiz.timelimit to be in seconds, for consistency, and ready for the new duration field type (MDL 18500). ** Including ensuring that backup and restore is backwards compatible. * MDL-5537 New setting, questiondecimalpoints, so, for example, you can show the quiz grade as an integer, but have fractional question grades. ** There is a 'Same as overall decimal points' option, which is the default. * Improve some field labels. * Make corresponding changes in the help files.
This commit is contained in:
+16
-3
@@ -1753,7 +1753,7 @@ function question_apply_penalty_and_timelimit(&$question, &$state, $attempt, $cm
|
||||
// deal with timelimit
|
||||
if ($cmoptions->timelimit) {
|
||||
// We allow for 5% uncertainty in the following test
|
||||
if ($state->timestamp - $attempt->timestart > $cmoptions->timelimit * 63) {
|
||||
if ($state->timestamp - $attempt->timestart > $cmoptions->timelimit * 1.05) {
|
||||
$cm = get_coursemodule_from_instance('quiz', $cmoptions->id);
|
||||
if (!has_capability('mod/quiz:ignoretimelimits', get_context_instance(CONTEXT_MODULE, $cm->id),
|
||||
$attempt->userid, false)) {
|
||||
@@ -2007,12 +2007,25 @@ function question_hash($question) {
|
||||
|
||||
/**
|
||||
* Round a grade to to the correct number of decimal places, and format it for display.
|
||||
* If $cmoptions->questiondecimalpoints is set, that is used, otherwise
|
||||
* else if $cmoptions->decimalpoints is used,
|
||||
* otherwise a default of 2 is used, but this should not be relied upon, and generated a developer debug warning.
|
||||
* However, if $cmoptions->questiondecimalpoints is -1, the means use $cmoptions->decimalpoints.
|
||||
*
|
||||
* @param object $cmoptions The modules settings, only ->decimalpoints is used.
|
||||
* @param object $cmoptions The modules settings.
|
||||
* @param float $grade The grade to round.
|
||||
*/
|
||||
function question_format_grade($cmoptions, $grade) {
|
||||
return format_float($grade, $cmoptions->decimalpoints);
|
||||
if (isset($cmoptions->questiondecimalpoints) && $cmoptions->questiondecimalpoints != -1) {
|
||||
$decimalplaces = $cmoptions->questiondecimalpoints;
|
||||
} else if (isset($cmoptions->decimalpoints)) {
|
||||
$decimalplaces = $cmoptions->decimalpoints;
|
||||
} else {
|
||||
$decimalplaces = 2;
|
||||
debugging('Code that leads to question_format_grade being called should set ' .
|
||||
'$cmoptions->questiondecimalpoints or $cmoptions->decimalpoints', DEBUG_DEVELOPER);
|
||||
}
|
||||
return format_float($grade, $decimalplaces);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user