Choosing a taxonomy item from the filter dropdown on the "add question" pages does not filter the questions.

Possibly related to this comment:

    if ($_POST['op'] == 'Filter question list') {
      //BE CAREFUL OF THE $_POST['edit'] ARRAY AS THIS VALUE IS LIABLE TO CHANGE WHEN VOCABS ARE ADDED AND DELETED...IF YOU HAVE MORE THAN ONE VOCAB, MAY GOD HELP YOU!!
      $_SESSION['quiz_filter'] = $_POST['edit'][4];
    }
CommentFileSizeAuthor
#4 taxonomy_filter_88674.patch6.55 KBriverfr0zen

Comments

nicholasthompson’s picture

That comment certainly SOUNDS revelant - and could easily be WHY its not working! Maybe its hardcoded to use Vocab 4?!

I remember I DID get it working - but now its not, even though the terms are listed.

gilcot’s picture

maybe some inspiration can be found here http://drupal.org/node/75626

riverfr0zen’s picture

I have a fix for this - will post a patch some time this weekend.

riverfr0zen’s picture

Status: Active » Needs review
StatusFileSize
new6.55 KB

I guess last weekend didn't come around till just now :) Well, here it is - let me know what you think.

riverfr0zen’s picture

Oooh .. i see that another change I'd made to prefix constants with 'QUIZ_' snuck in there. Pretty trivial, but let me know if anyones want me to separate.

webchick’s picture

Glancing through, the only thing that caught my eye was...

+  if ($_POST && $_POST['op'] == 'Filter question list') {

This needs to check against t('Filter question list') ... if I translate that string in locale module to "Filter me!" then the button won't work.

webchick’s picture

It would also be lovely if we didn't have to do icky stuff like check $_POST directly, but that can be part of 'clean-up' in 5.x-2.x. ;)

+1 on renaming the constants.

riverfr0zen’s picture

hmm, that had been there before, and i didn't want to stray too far, but you are right. in fact, that entire 'filter' section should probably be it's own form, don't you think?

add1sun’s picture

Status: Needs review » Needs work

Just doing some quick testing and I'm getting an error that borks it when trying to apply the filter in the Manage Questions screen:

warning: array_merge() [function.array-merge]: Argument #2 is not an array in /Users/addi/Sites/drupal5/sites/default/modules/quiz/quiz.module on line 1114.
add1sun’s picture

so the foreach:

foreach($_POST['filter_terms'] as $vocabulary)
   {
      $filter_terms = array_unique(array_merge($filter_terms, $vocabulary));
    }

gives you a var, not an array, so array_merge pukes. So I guess that would be more of an array_push but all in all it seems a bit too complicated to me (but I dunno what I'm talking about anyway so take all of this with a grain of salt.) If all you are doing is adding the $vocabulary var to the $filter_terms array can't you just do $filter_terms[] = $vocabulary;?

riverfr0zen’s picture

Ok, I think I can guess why this is happening - I was testing with multiple vocabularies, one a single select, the other a multi-select - so the code assumes that. You likely were testing with only one vocabulary. The array structure returned by the form is likely different in the two cases, so the code needs to compensate. I'm a little overtasked, but I'll try to get a patch up in a day or so.

kkkkkkkkkkkkkkkkkkkkkkk’s picture

Version: 6.x-2.x-dev » 5.x-1.1
Priority: Normal » Critical

My quiz module worked very well until I updated to the recent module. Now the quiz questions are no longer available. There is a complaint about " a script that does not respond."
Would any guru be kind enough to show me how to make quiz questions available. I am using the version 5.2
Thanks
mathsoft

kscheirer’s picture

What version of the quiz module were you using?

I know a while back the taxonomy support was removed, and
now something has been added back, but its not the same.

awong’s picture

The HEAD version taxonomy filter function on question page is different now.

Now you can put in the number in "Number questions to randomize:" to say how many random questions are there and select the terms on question page.
it will filter out all the questions by that term.

senpai’s picture

Version: 5.x-1.1 » 6.x-2.x-dev
Priority: Critical » Normal

Reverting the changes made to Priority and Version by post #12.

Also, this issue might be fixed by another patch that got committed to HEAD today. Is this one still a problem?

kylebrowning’s picture

Im not having issues with it

mbutcher’s picture

Version: 6.x-2.x-dev » 5.x-2.x-dev
Status: Needs work » Closed (fixed)

Reversing version label and closing. No activity for about a year.