Download & Extend

Allow the user to configure the default max score value for short and long answer questions

Project:Quiz
Version:7.x-4.x-dev
Component:Code - Short/long answer
Category:feature request
Priority:normal
Assigned:Unassigned
Status:closed (fixed)

Issue Summary

The default max score values for long and short answer questions are currently hardcoded to 10 and 5 respectively. These should really be configured through the UI somewhere.

I have attached a patch to make these fields configurable through the UI at /admin/quiz/settings/questions_settings

AttachmentSize
0001-Allow-the-user-to-configure-the-default-max-score-va.patch3.79 KB

Comments

#1

Status:needs review» needs work

+1 for committing this patch. But falcon is trying to limit the new features request as to make the quiz 7.x stable sooner, so i'm leaving this issue at his discretion.

Did a quick review of patch, I'm sure it needs work.

1. Two return?

<?php
  
public function getMaximumScore() {
-    return
10;
+    return return
variable_get('long_answer_default_max_score', 10);
   }
?>

2. $form['#validate'] must be array string given. ($form['#validate'][] = 'long_answer_config_validate';)

<?php
function long_answer_config() {
-  return
FALSE;
$form['long_answer_default_max_score'] = array(
+   
'#type' => 'textfield',
+   
'#title' => t('Default max score'),
+   
'#description' => t('Choose the default maximum score for a long answer question.'),
+   
'#default_value' => variable_get('long_answer_default_max_score', 10),
+  );
$form['#validate'] = 'long_answer_config_validate';
+  return
$form;
+}
?>

#2

Status:needs work» needs review

Oh, yep, the double return was just a copy/paste error when I was generating the patch off of our live code.

The $form['#validate'] was just the same code used in the multichoice question code for its configuration section.

I went ahead and made both changes, and have attached an updated version of the patch.

AttachmentSize
0001-Allow-the-user-to-configure-the-default-max-score-va.patch 3.78 KB

#3

Status:needs review» fixed

Since this is not a show stopper i committed this patch to git.

#4

Status:fixed» closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.