Closed (fixed)
Project:
Quiz
Version:
6.x-3.x-dev
Component:
Code - Quiz module
Priority:
Normal
Category:
Feature request
Assigned:
Reporter:
Created:
23 Oct 2008 at 16:17 UTC
Updated:
26 Jun 2010 at 12:28 UTC
Currently only the summary text is coming out from the database one the results page.
Here's the updated SQL for quiz_calculate_score() that needs to be added to get the Name out:
Is 'result_option' appropriate for the summary? Should it not be 'result_summary'?
$score = db_fetch_array(db_query("SELECT " .
"(SELECT count(*) FROM {quiz_node_results_answers} WHERE result_id = %d) as question_count," .
"(SELECT option_summary " .
"FROM {quiz_multichoice_user_answers} " .
"LEFT JOIN {quiz_multichoice_answers} USING (answer_id) " .
"LEFT JOIN {quiz_node_result_options} ON (result_option = option_id) " .
"WHERE result_id = %d " .
"GROUP BY result_option ORDER BY COUNT(result_option) desc LIMIT 1) as result_option," .
"(SELECT option_name " .
"FROM {quiz_multichoice_user_answers} " .
"LEFT JOIN {quiz_multichoice_answers} USING (answer_id) " .
"LEFT JOIN {quiz_node_result_options} ON (result_option = option_id) " .
"WHERE result_id = %d " .
"GROUP BY result_option ORDER BY COUNT(result_option) desc LIMIT 1) as result_name", $rid, $rid, $rid));
Comments
Comment #1
mbutcher commentedXalen,
Fortunately, we are just at the beginning of a new development cycle for Quiz 3.0, so now is the time to add new features.
Unfortunately, I can't work with the submitted code for a few reasons:
First, the 5.x tree is no longer being maintained. If you can do a 6.x version, I will evaluate the code. It should work against the 6.x-3 development branch since Quiz 2.0 is now under code freeze for a release. However, if you patch against 6.x-2.0-RC1, I can port it pretty easily (right now) since the code base is still pretty similar..
Second, this is not a patch file. Drupal standard policy is that files must be in the patch format for adding into the code. Can you generate a patch using the 'diff' program or some other similar tool? The handbook documents the process at http://drupal.org/patch.
Third, a quick overview of what you are doing would be helpful. A glance at the code above doesn't give me much of an idea for what you hope to accomplish -- it appears to just be a modified SQL statement. What do I do with the extra information I get back? (And what's the "Name out"?)
I hope to see a full patch version of this!
Thanks,
Matt
Comment #2
mbutcher commentedOops.. should be filed for 3.x version, not 2.x version....
Comment #3
falcon commentedNot relevant anymore AFAIK. (I'm cleaning up the issue list)