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

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

Sivaji_Ganesh_Jojodae’s picture

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?

   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';)

 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;
+}
michaelk’s picture

Status: Needs work » Needs review
FileSize
3.78 KB

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.

Sivaji_Ganesh_Jojodae’s picture

Status: Needs review » Fixed

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

Status: Fixed » Closed (fixed)

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

  • Commit 4b42c4f on 7.x-4.x, 7.x-5.x by sivaji:
    Issue #1886626 by michaelk: Added Allow the user to configure the...

  • Commit 4b42c4f on 7.x-4.x, 7.x-5.x, quiz-pages by sivaji:
    Issue #1886626 by michaelk: Added Allow the user to configure the...

  • Commit 4b42c4f on 7.x-4.x, 7.x-5.x, quiz-pages, 2269219 by sivaji:
    Issue #1886626 by michaelk: Added Allow the user to configure the...

  • Commit 4b42c4f on 7.x-4.x, 7.x-5.x, 2269219 by sivaji:
    Issue #1886626 by michaelk: Added Allow the user to configure the...