As soon as I add fields to a Views table that are a part of the Quiz module, the table has duplicate entries for all nodes. I can successfully add node and content fields to the table no problem.

I even tried enabling the 'Distinct' setting in the view setup page but that didn't help

Comments

falcon’s picture

Version: 6.x-4.0-beta3 » 6.x-4.x-dev
falcon’s picture

Status: Active » Postponed (maintainer needs more info)

Thanks for reporting
Can you please give a concrete example?
What is the exact name of the view you are editing?
What is the exact name of the field you are adding?
Is adding this one field you mention above enough to produce duplicate fields?
If not, please give a precise description of how to reproduce this error.

mdowsett’s picture

I just updated to the 4.x.dev version as well and it still does it.

http://hangon.ca/exams is my view.

And yes, I added the Quiz modules time limit field and saved, it duplicated the entries. I removed that field from the table and it went back to single entries. And I now added it back again (so you could see) and it duplicated the entries again.

Thanks in your interest in supporting this - I'm happy to help with any testing

falcon’s picture

Status: Postponed (maintainer needs more info) » Needs work
mdowsett’s picture

does your status change mean you need more info from me or does it mean you are working on it?

falcon’s picture

In the view UI you do this:

- Add filter
- Mark the filter "Quiz: Quiz Version" and press add
- Make sure "Latest most recent..." is selected in the dropdown
- Update

This should remove all duplicates

falcon’s picture

Status: Needs work » Closed (fixed)
mdowsett’s picture

Status: Closed (fixed) » Active

when I do that I get an SQL error:

user warning: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '= (SELECT MAX(__subselect.vid) FROM quiz_node_results __subselect WHERE __subsel' at line 10 query: SELECT DISTINCT node.nid AS nid, node.title AS node_title, node_data_field_level.field_level_value AS node_data_field_level_field_level_value, node.type AS node_type, node.vid AS node_vid, node_data_field_level.field_time_limit_manual_value AS node_data_field_level_field_time_limit_manual_value FROM node node INNER JOIN quiz_node_properties quiz_node_properties ON node.nid = quiz_node_properties.nid LEFT JOIN content_type_quiz node_data_field_level ON node.vid = node_data_field_level.vid WHERE (node.type in ('quiz')) AND (.vid = (SELECT MAX(__subselect.vid) FROM quiz_node_results __subselect WHERE __subselect.nid = .nid AND __subselect.nid = .nid)) GROUP BY quiz_node_properties.nid, quiz_node_properties.vid, .nid, node_data_field_level_field_level_value, nid, node_title, node_type, node_vid, node_data_field_level_field_time_limit_manual_value ORDER BY node_data_field_level_field_level_value ASC LIMIT 0, 10 in /home/hangon/public_html/sites/default/modules/views/includes/view.inc on line 765.

The error also shows up to all users when looking at the view. When I remove that filter, the error goes away.

falcon’s picture

Status: Active » Postponed (maintainer needs more info)

I'm not able to reproduce this. Can you please write a step by step discription on how to reproduce this one. Start from scratch with a view, or with one of the views defined by the quiz module.

falcon’s picture

Status: Postponed (maintainer needs more info) » Closed (fixed)

Please reopen this issue if you provide the information required to fix it. If it has been fixed already please make a comment on it here.

johnhanley’s picture

Status: Closed (fixed) » Active

The runtime query error described in #8 is alive and well as of Drupal 6.26 & Quiz 6.x-4.4 when selecting "Latest most recent..." from the "Quiz: Quiz Version" filter dropdown.

Error output:

    user warning: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '= (SELECT MAX(__subselect.vid) FROM quiz_node_results __subselect WHERE __subsel' at line 9 query: SELECT COUNT(*) FROM (SELECT DISTINCT(node.nid) AS nid, node.title AS node_title, quiz_node_properties.quiz_open AS quiz_node_properties_quiz_open, quiz_node_properties.quiz_close AS quiz_node_properties_quiz_close FROM node node LEFT JOIN content_field_class_reference node_data_field_class_reference ON node.vid = node_data_field_class_reference.vid LEFT JOIN node node_node_data_field_class_reference ON node_data_field_class_reference.field_class_reference_nid = node_node_data_field_class_reference.nid INNER JOIN quiz_node_properties quiz_node_properties ON node.nid = quiz_node_properties.nid WHERE (node.status = 1) AND (.vid = (SELECT MAX(__subselect.vid) FROM quiz_node_results __subselect WHERE __subselect.nid = .nid AND __subselect.nid = .nid)) AND (node_data_field_class_reference.field_class_reference_nid = 24 ) GROUP BY quiz_node_properties.nid, quiz_node_properties.vid, .nid, nid ) count_alias in /big/dom/xlearningmonitor/www/sites/all/modules/views/includes/view.inc on line 805.
    user warning: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '= (SELECT MAX(__subselect.vid) FROM quiz_node_results __subselect WHERE __subsel' at line 9 query: SELECT DISTINCT(node.nid) AS nid, node.title AS node_title, quiz_node_properties.quiz_open AS quiz_node_properties_quiz_open, quiz_node_properties.quiz_close AS quiz_node_properties_quiz_close FROM node node LEFT JOIN content_field_class_reference node_data_field_class_reference ON node.vid = node_data_field_class_reference.vid LEFT JOIN node node_node_data_field_class_reference ON node_data_field_class_reference.field_class_reference_nid = node_node_data_field_class_reference.nid INNER JOIN quiz_node_properties quiz_node_properties ON node.nid = quiz_node_properties.nid WHERE (node.status = 1) AND (.vid = (SELECT MAX(__subselect.vid) FROM quiz_node_results __subselect WHERE __subselect.nid = .nid AND __subselect.nid = .nid)) AND (node_data_field_class_reference.field_class_reference_nid = 24 ) GROUP BY quiz_node_properties.nid, quiz_node_properties.vid, .nid, nid LIMIT 0, 25 in /big/dom/xlearningmonitor/www/sites/all/modules/views/includes/view.inc on line 810.

Query:

SELECT DISTINCT(node.nid) AS nid,
   node.title AS node_title,
   quiz_node_properties.quiz_open AS quiz_node_properties_quiz_open,
   quiz_node_properties.quiz_close AS quiz_node_properties_quiz_close
 FROM node node 
 LEFT JOIN content_field_class_reference node_data_field_class_reference ON node.vid = node_data_field_class_reference.vid
 LEFT JOIN node node_node_data_field_class_reference ON node_data_field_class_reference.field_class_reference_nid = node_node_data_field_class_reference.nid
 INNER JOIN quiz_node_properties quiz_node_properties ON node.nid = quiz_node_properties.nid
 WHERE (node.status = 1) AND (.vid = (SELECT MAX(__subselect.vid) FROM quiz_node_results __subselect WHERE __subselect.nid = .nid AND __subselect.nid = .nid)) AND (node_data_field_class_reference.field_class_reference_nid = 24 )
 GROUP BY quiz_node_properties.nid, quiz_node_properties.vid, .nid, nid
retiredpro’s picture

i'm getting errors as well.

warning: Invalid argument supplied for foreach() in /var/www/mywebsite.com/htdocs/sites/default/modules/contrib/quiz/includes/views/handlers/quiz_views_handler_filter_quiz_nid.inc on line 100.
user warning: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '= (SELECT MAX(__subselect.) FROM __subselect WHERE __subselect. = . AND __subse' at line 12 query: SELECT DISTINCT(node.nid) AS nid_1, node.title AS node_title, node.nid AS nid, node.created AS node_created, quiz_node_properties.quiz_open AS quiz_node_properties_quiz_open, quiz_node_properties.quiz_close AS quiz_node_properties_quiz_close, quiz_node_properties.pass_rate AS quiz_node_properties_pass_rate, quiz_node_properties.time_limit AS quiz_node_properties_time_limit FROM node node INNER JOIN quiz_node_properties quiz_node_properties ON node.nid = quiz_node_properties.nid LEFT JOIN content_type_quiz node_data_field_ref_course ON node.vid = node_data_field_ref_course.vid WHERE (node.status = 1) AND (node.type in ('quiz')) AND (. = (SELECT MAX(__subselect.) FROM __subselect WHERE __subselect. = . AND __subselect. = .)) AND (node_data_field_ref_course.field_ref_course_nid = 6 ) in /var/www/mywebsite.com/htdocs/sites/all/modules/views/plugins/views_plugin_query_default.inc on line 1153.

retiredpro’s picture

Any ideas on how to fix this or go around filtering? Views will produce duplicates once a quiz has revision making it unusable.

charliekwin’s picture

I was able to come up with this workaround. It's for 7.x, but most of the code should be reusable: http://drupal.org/node/1571240#comment-6526368

retiredpro’s picture

Thanks charliekwin. I commented out line 120 like mentioned from your post and added the following code.

$max_vid_subquery = "SELECT MAX(vid) FROM quiz_node_properties WHERE quiz_node_properties.nid = node_quiz_node_properties.nid";
$where_clause = "quiz_node_properties.vid = ($max_vid_subquery)";
$this->query->add_where($this->options['group'], $where_clause);

I kept getting errors on the part that was originally add_where_expression. It looks like something thats only available for drupal 7 and I found add_wherewhich worked for drupal 6. After this change I then received warnings on line 100 for Invalid argument supplied for foreach(). Not sure what that code does but I ended up commenting it out altogether...

/*
foreach ($this->options['secondaries'] as $key => $value) {
if (!is_null($value)) {
$this->$key = $value;
}
}
*/

Nothing appears to be broken anywhere on the site and my quiz view no longer show duplicates. Thanks again for the help!

djdevin’s picture

Issue summary: View changes
Status: Active » Closed (outdated)

This issue is being closed because it is filed against a version that is no longer supported.

djdevin’s picture

This issue is being closed because it is filed against a version that is no longer supported.

djdevin’s picture

This issue is being closed because it is filed against a version that is no longer supported.

djdevin’s picture

This issue is being closed because it is filed against a version that is no longer supported.