Is there a way that I could query the database to pull information on the quizes down to the question? For example, I would like to know, if 100 people took a quiz what percent of them got question 1 right, question 2 right, and so on. Also how many people submitted answers to all the questions in my quiz, what is the average score buy individual, what is average time for a quiz and so forth. If there is a way to do this already please let me know. Any assitance would be much appreciated. Thanks.

Paul

Comments

westwesterson’s picture

I don't support version 5.x-1.x

Views support was introduced in version 5.x-2.x which is a flexible query builder which may be able to handle some of this stuff. Otherwise you will have to code this up from scratch. Any code contributions on this would be welcomed by the community I am sure ;-)

tl1000s77’s picture

Version: 5.x-1.1 » 5.x-2.0-rc1

Well, I upgraded to 5.x-2.0-rc1 and when I go and take a look at the Quiz results...there's nothing there.

drewrwilson’s picture

Version: 5.x-2.0-rc1 » 6.x-2.0

I had a similar problem with with the 5.x version and it was not solved by upgrading to the 6.x version. I still cannot get the test results to display. I could get them to display in 5.x-1.1 but not 5.x-2.0 or 6.x-2.0.

I get a database error:

Table 'pdr.quiz_node_result_options' doesn't exist query: SELECT nid FROM quiz_node_result_options WHERE option_id = 0 in /xx/sites/all/modules/quiz/multichoice.module on line 92.

Any advice?

drewrwilson’s picture

I believe the prefix that I'm using in my db is missing from the query. Not sure where in the code that happened, but I'm trying to track it down.

mbutcher’s picture

Assigned: tl1000s77 » mbutcher
Category: support » bug
Status: Active » Fixed

drewilson: Ugh... that was an error I caught and fixed in the 3.x dev branch and forgot to backport. Terribly sorry about that.

Basically, a table name was typed incorrectly.

The issue is fixed in CVS and will be rolled into 6.x-2.1 (next week?).

It's already fixed in the 3.x snapshots -- which are unstable, so probably not good to use on anything but a dev environment.

drewrwilson’s picture

Ok, neat. Glad you could track it down. I'm looking forward to the 6.x-2.1 release. Since I'm on tighter timeline for this project, I may need to look through the CVS to track down the typo and fix it in my 2.0 install anyway.

I'm excited about the new version! Thanks!

mbutcher’s picture

Quick fix:

1. Search multichoice.module for quiz_node_result_options. You should get one match.
2. Surround that with {}, e.g. {quiz_node_result_options}

The end.

drewrwilson’s picture

Sweet! Fixed it. No DB error in my log file anymore when I go to the Test Results page (?q=admin/quiz/results).

But results still don't show up like they did in 5.x-1.1. The ?q=admin/quiz/results page only displays: "Test results. No Test results found." I check the DB and still have around a thousand results.

I'm going to play around with the Views section to see if I can get a View that'll work for me. Anyway I can help test the display error?

Thanks!

mbutcher’s picture

The query that gets run looks like this:

SELECT n.nid, n.title, u.name, qnrs.result_id, qnrs.time_start, qnrs.time_end
          FROM {node} n
          INNER JOIN {quiz_node_properties} qnp
          INNER JOIN {quiz_node_results} qnrs
          INNER JOIN {users} u
          WHERE n.type = 'quiz'
            AND n.nid = qnp.nid
            AND qnrs.nid = qnp.nid
            AND u.uid = qnrs.uid

(each {foo} is a table name placeholder to be replaced by your_prefix_table_name, e.g. my_node, or my_quiz_node_properties)

If you run that, do you see any results? What database software are you running?

Hope I'm not asking too much from you, but I'm stumped on why this isn't working. Though if these are older quizzes imported from 5... there may be some missing information for the join on quiz_node_properties.

Anyway, let me know and let's see if we can get this bug fixed in time for 2.1.

Matt

mbutcher’s picture

Status: Fixed » Postponed (maintainer needs more info)

Reopened this since there is still a bug.

drewrwilson’s picture

Status: Postponed (maintainer needs more info) » Fixed

I replaced the {foo}'s with my prefix and the SQL query runs, but returns: "Empty set (0.00 sec)".

My MySQL version is: 5.0.67-0ubuntu6
My PHP version is: 5.2.6-2ubuntu4

No need to apologize, I'm happy to help! Especially since it will help me get my site working with the new version.

I am using data imported from a 5.x install. The working version of my project is 5.x-1.1, but I need to get Views to work so I can generate better stats from the results. So I installed 6.x and upgraded the quiz module to 6.x-2.0. I ran the update.php to upgrade the database. Is there more updating that I need to do to the DB?

Also feel free to email me, if you want quicker responses: drew.r.wilson at gmail
aim: drewrwilson

Thanks for all the support! Let me know what I can do to help. I'll keep trying to get this working.

mbutcher’s picture

Status: Fixed » Postponed (maintainer needs more info)

The more I look at that query, the more suspect it looks. I'm not sure why it is joining against the properties table, since it is joining on NID, and it is neither selecting out any data nor using it in the where clause.

Can you give this a shot instead?

SELECT n.nid, n.title, u.name, qnrs.result_id, qnrs.time_start, qnrs.time_end
          FROM node n
          INNER JOIN quiz_node_results qnrs 
          INNER JOIN users u
          WHERE n.type = 'quiz'
            AND u.uid = qnrs.uid
            AND qnrs.nid = n.nid

IIRC, this should match the format for the 5.x tables.

drewrwilson’s picture

Again we get another "Empty set (0.00 sec)".

(Also, I added my db prefix to "node", "quiz_node", and "users")

mbutcher’s picture

Version: 6.x-2.0 » 6.x-3.0-alpha1
Status: Postponed (maintainer needs more info) » Fixed

This issue is resolved in Quiz 3

Status: Fixed » Closed (fixed)

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