I'm in a hurry, but want to commit my code before I have to leave work.

The scoring system in the oop framework probably needs to be adjusted a little, and I've made a few quick changes. I might do more changes tomorrow.

In the question types response classes:
$this->score is initially 0, and gets updated by $this->score(), but with $this->score beeing 0 by default you don't know if it is suppose to be zero or not.

Because of this I've changed it to be unset by default, and $this->score needs to be called in order to set a value. I've tried to fix all existing task types to work with these changes. I've also tired to make the isCorrect() function work better.

Patch will be added and commited shortly.

CommentFileSizeAuthor
#4 quiz-532212.patch11.57 KBfalcon
#1 quiz-532212.patch8.69 KBfalcon

Comments

falcon’s picture

StatusFileSize
new8.69 KB

attached patch has been commited

falcon’s picture

Status: Needs review » Active

I have two things I would like to do with the scoring system.

1. This is a code thing, and this is what I have started on:
Make sure score always is updated in the result objects in the OOP framework.

2. This is more a new feature:
Beeing able to set max score on each question in a quiz.

Today each question has a max score, but you can't edit it when assigning the question to a quiz. If question A has a max score of 10, and B has a max score of 1 it seems A is ten times as important as B. If you are to change this today you have to change the questions, and doing that you might mess up other quizes who uses the same questions.

To handle this problem I'm planning to add a new column in the database table quiz_node_relationship named max score.

The max score of each question will default to the max score of the question itself, but will be editable from the screen where you assign questions to quizes.

Any feedback on these planned changes are welcome!

falcon’s picture

Status: Active » Closed (duplicate)

This issue is more or less the same: http://drupal.org/node/506160

I will merge them later.

falcon’s picture

Status: Closed (duplicate) » Needs review
StatusFileSize
new11.57 KB

I have attached a patch showing how (1.) from post #2 has been fixed. These changes has been commited to 4.x-dev.

These changes have two implications for question type developers using the OOP framework(QuizQuestion), especially when extending AbstractQuizQuestionResponse:

1. Never use $this->score. Use $this->getScore() instead.

2. You don't need to store score in $this->score(), just return it.

Why these changes?
When you call getScore() you can be sure that score() is called if it haven't been called earlier. And you can be sure that the result of score() will be stored and automatically reused next time you call getScore(). (And the code becomes even prettier)

turadg’s picture

fwiw, I've looked over the patch and think it's a good improvement, but I'll leave it to sivaji to upgrade the status from "needs review".

turadg’s picture

Status: Active » Needs review

We'll need this finished for alpha 3 release.

turadg’s picture

Issue tags: +blocks40a3

eh, blocks40a3 is clearer than block40a3

falcon’s picture

Status: Needs review » Closed (fixed)