When adding a conditional filter on the node id for the quiz I found that the views handler needs to be updated to D7 still. It was throwing the following error:

PDOException: SQLSTATE[HY093]: Invalid parameter number: parameter was not defined:

SELECT qnp.vid AS vid FROM {quiz_node_properties} qnp WHERE qnp.nid = :nid; Array ( [0] => 60 )

in quiz_views_handler_argument_quiz_nid->subselect_vids() (line 155 of /drupalhome/modules/quiz/includes/views/handlers/quiz_views_handler_argument_quiz_nid.inc).

Here is a patch:

Comments

acrazyanimal’s picture

Assigned: Unassigned » acrazyanimal
Priority: Normal » Major
Status: Active » Needs review
StatusFileSize
new4.49 KB
joel_osc’s picture

Seeing a problem with this patch...I get syntax error on line 147. In debugging it looks like around line 140:
$query->addExpression(':op(vid)', 'vid', array(':op' => $operation));
The :op( does not get replaced by MIN or MAX. This code may be simpler to just change lines 131:137 to:

   switch ($this->options['which_vid']) {
      case 'initial':
        $query->addExpression('MIN(vid)', 'vid');
        break;
      case 'latest':
        $query->addExpression('MAX(vid)', 'vid');
        break;
acrazyanimal’s picture

Thanks for catching that. :) I guess I missed testing the latest and initial revision scenarios. Here is an updated version.

Anonymous’s picture

thanks for the patch.

Small improvement: in order to get rid of the message
Notice: Undefined variable: operator in quiz_views_handler_argument_quiz_nid->subselect_vids()

Add in function subselect_vids (line 123):

$operator=NULL;

acrazyanimal’s picture

@Jaapx can you explain how you got this error or export your view and post it here?

falcon’s picture

Status: Needs review » Fixed

Thanks!

Status: Fixed » Closed (fixed)

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

  • Commit 2a15a5b on 7.x-4.x, 7.x-5.x by falcon:
    Issue #1567460 by acrazyanimal: update quiz_views_handler_arguments to...

  • Commit 2a15a5b on 7.x-4.x, 7.x-5.x, quiz-pages by falcon:
    Issue #1567460 by acrazyanimal: update quiz_views_handler_arguments to...

  • Commit 2a15a5b on 7.x-4.x, 7.x-5.x, quiz-pages, 2269219 by falcon:
    Issue #1567460 by acrazyanimal: update quiz_views_handler_arguments to...

  • Commit 2a15a5b on 7.x-4.x, 7.x-5.x, 2269219 by falcon:
    Issue #1567460 by acrazyanimal: update quiz_views_handler_arguments to...