I've gotten to the point of being able to list all quizzes and all the scores for the current logged in user, but highest score doesn't seem to be one of the options to display.

Any ideas?

Comments

webservant316’s picture

Perhaps I could use the views_calc or views_crosstab modules to accomplish the same? Hoping for a tip from anyone who has figured out how to display the highest quiz score for the current logged in user with Views.

Thanks for any help.

mpearrow’s picture

Curious if you found a solution for this; I'm hoping to do the same thing.

webservant316’s picture

not yet, but still interested.

lzimmerman’s picture

I'm not very familiar with Quiz + Views, but found your thread while tackling a similar problem.

Can you sort the view by descending score? If so, the first result returned should contain the highest score, and you could limit displayed results to one.

mpearrow’s picture

So close :) In my case that trick does not work because I'm returning a list of many quizzes (and hence their various result_id cases where someone took the quiz more than once). If I limit to one record, I only get the top quiz out of all quizzes rather than the top instance of each quiz.

For example, if someone took Quiz 1 a total of 5 times and got scores of 0, 0, 20, 60, and 100, I'd only want to show the 100.

I'm pretty sure that just adding a MAX() in the correct query would have the desired effect. Just not sure exactly where to put it.

lzimmerman’s picture

I see the problem! Hmm, in my case I used an extra view to find the highest value, and created a template for the main view which loaded the second view and checked each row against that value. If the value was equal, it displayed the row.

You might be able to get the result you want by doing something like this:
1. Set up a view returning all quizzes (limited by current user, etc. as you like)
2. Set up a view with a quiz argument, sorting by score (probably returning just the top result)
3. In a template for #1, you could loop through the results (i.e. all appropriate quizzes), and for each one load view #2, which should return the top score for that quiz.

The "view of a view" approach is certainly roundabout, but might work. I hope you find a good solution - I'd love to know about any straightforward MAX() type method, because these kind of questions do seem to come up fairly often.

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.