Posted by michaelk on January 11, 2013 at 11:23pm
3 followers
| 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
| Attachment | Size |
|---|---|
| 0001-Allow-the-user-to-configure-the-default-max-score-va.patch | 3.79 KB |
Comments
#1
+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?
<?phppublic 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';)
<?phpfunction 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
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.
#3
Since this is not a show stopper i committed this patch to git.
#4
Automatically closed -- issue fixed for 2 weeks with no activity.