Skip to content

Commit

Permalink
MDL-53140 question: Support localised floats when previewing a question
Browse files Browse the repository at this point in the history
  • Loading branch information
rezaies committed May 1, 2019
1 parent bb40794 commit 197e074
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 4 deletions.
2 changes: 1 addition & 1 deletion lib/questionlib.php
Original file line number Diff line number Diff line change
Expand Up @@ -796,7 +796,7 @@ function question_preview_url($questionid, $preferredbehaviour = null,
}

if (!is_null($maxmark)) {
$params['maxmark'] = $maxmark;
$params['maxmark'] = format_float($maxmark, strlen($maxmark), true, true);
}

if (!is_null($displayoptions)) {
Expand Down
5 changes: 2 additions & 3 deletions question/previewlib.php
Original file line number Diff line number Diff line change
Expand Up @@ -52,9 +52,8 @@ public function definition() {
get_string('howquestionsbehave', 'question'), $behaviours);
$mform->addHelpButton('behaviour', 'howquestionsbehave', 'question');

$mform->addElement('text', 'maxmark', get_string('markedoutof', 'question'),
$mform->addElement('float', 'maxmark', get_string('markedoutof', 'question'),
array('size' => '5'));
$mform->setType('maxmark', PARAM_FLOAT);

if ($this->_customdata['maxvariant'] > 1) {
$variants = range(1, $this->_customdata['maxvariant']);
Expand Down Expand Up @@ -152,7 +151,7 @@ protected function get_user_pref_fields() {
protected function get_field_types() {
return array(
'behaviour' => PARAM_ALPHA,
'maxmark' => PARAM_FLOAT,
'maxmark' => PARAM_LOCALISEDFLOAT,
'variant' => PARAM_INT,
'correctness' => PARAM_BOOL,
'marks' => PARAM_INT,
Expand Down

0 comments on commit 197e074

Please sign in to comment.