The current user filter on answers gives the following message when constructing a view:

SQLSTATE[42S22]: Column not found: 1054 Unknown column 'quiz_node_results.uid1ORISNULLquiz_node_results.uid' in 'where clause'

My solution:
Change line 43 of sites/all/modules/quiz/includes/views/handlers/quiz_views_handler_filter_user_nullable.inc

from: $this->query->add_where($group, "$this->table_alias.$this->real_field $operator ***CURRENT_USER*** OR ISNULL($this->table_alias.$this->real_field)", $this->argument);

into: $this->query->add_where($group, "$this->table_alias.$this->real_field $operator", "***CURRENT_USER***", $operator);

Comments

upchuk’s picture

Worked for me!

Cheers!

sokrplare’s picture

Assigned: Unassigned » sokrplare
Status: Active » Needs review
StatusFileSize
new1.43 KB

Nice going tracking this one down, Jaapx! Your solution worked for me, but I think it would introduce a bug as the comment above this line says:

// By adding the ISNULL, joins can properly inform us about quiz state

I've reformatted the query to fit D7 query structures. Patch file attached!

Resources I used in writing this patch:

Edit - adding query output before and after - the field_assignments_node part is custom to my setup so can be disregarded

Before

LEFT JOIN {quiz_node_results} quiz_node_results ON quiz_node_properties.vid = quiz_node_results.vid
WHERE (( (quiz_node_results.uidCURRENT_USERORISNULLquiz_node_results.uid IS NULL ) )AND( (field_assignments_node.uid = '3' ) ))

After

LEFT JOIN {quiz_node_results} quiz_node_results ON quiz_node_properties.vid = quiz_node_results.vid
WHERE ((( (quiz_node_results.uid = '1') OR (quiz_node_results.uid IS NULL ) ))AND( (field_assignments_node.uid = '3' ) ))
falcon’s picture

Status: Needs review » Fixed

Thanks!

Status: Fixed » Closed (fixed)

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

  • Commit 0e8571f on 7.x-4.x, 7.x-5.x by falcon:
    Issue #1748444 by covenantd: Bug in current user filter on ansers fixed
    

  • Commit 0e8571f on 7.x-4.x, 7.x-5.x, quiz-pages by falcon:
    Issue #1748444 by covenantd: Bug in current user filter on ansers fixed
    

  • Commit 0e8571f on 7.x-4.x, 7.x-5.x, quiz-pages, 2269219 by falcon:
    Issue #1748444 by covenantd: Bug in current user filter on ansers fixed
    

  • Commit 0e8571f on 7.x-4.x, 7.x-5.x, 2269219 by falcon:
    Issue #1748444 by covenantd: Bug in current user filter on ansers fixed