Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
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
Comment #1
falcon CreditAttribution: falcon commentedComment #2
falcon CreditAttribution: falcon commentedThanks 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.
Comment #3
mdowsett CreditAttribution: mdowsett commentedI 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
Comment #4
falcon CreditAttribution: falcon commentedComment #5
mdowsett CreditAttribution: mdowsett commenteddoes your status change mean you need more info from me or does it mean you are working on it?
Comment #6
falcon CreditAttribution: falcon commentedIn 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
Comment #7
falcon CreditAttribution: falcon commentedComment #8
mdowsett CreditAttribution: mdowsett commentedwhen 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.
Comment #9
falcon CreditAttribution: falcon commentedI'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.
Comment #10
falcon CreditAttribution: falcon commentedPlease 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.
Comment #11
johnhanley CreditAttribution: johnhanley commentedThe 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:
Query:
Comment #12
retiredpro CreditAttribution: retiredpro commentedi'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.
Comment #13
retiredpro CreditAttribution: retiredpro commentedAny ideas on how to fix this or go around filtering? Views will produce duplicates once a quiz has revision making it unusable.
Comment #14
charliekwin CreditAttribution: charliekwin commentedI 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
Comment #15
retiredpro CreditAttribution: retiredpro commentedThanks 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!
Comment #16
djdevinThis issue is being closed because it is filed against a version that is no longer supported.
Comment #17
djdevinThis issue is being closed because it is filed against a version that is no longer supported.
Comment #18
djdevinThis issue is being closed because it is filed against a version that is no longer supported.
Comment #19
djdevinThis issue is being closed because it is filed against a version that is no longer supported.