I have noticed that the 'My Results' tab on a user's account page only show results for the most recent revision of a quiz. It seems that this tab should show results all results for quizzes taken regardless of the quiz revision.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

pearson.gn’s picture

I agree. I'd like it to show all results for each user in their My Results section, not just the latest revision.

I want users to be able to retain a record of safety quizzes they complete. The quizzes get updated occasionally, but older results still remain valid. It's a nuisance when the old results disappear.

I'll dig around the code a bit, but if anyone has a quick fix, much appreciated.

regi.bradley’s picture

I ended up changing the query in quiz.pages.inc for function quiz_get_user_results($user_id) - line 232.

$sql = "SELECT n.nid, n.title, qnp.pass_rate, qnrs.result_id, qnrs.time_start, qnrs.time_end, qnrs.score, qnrs.is_evaluated
FROM {node} n
INNER JOIN {quiz_node_properties} qnp ON n.nid = qnp.nid
INNER JOIN {quiz_node_results} qnrs ON qnrs.vid = qnp.vid
INNER JOIN {users} u ON u.uid = qnrs.uid
WHERE n.type = 'quiz'
AND u.uid = %d
AND qnrs.time_end > 0
ORDER BY qnrs.result_id ASC"

This seems to have done the trick for me.

fuzzy76’s picture

Version: 6.x-4.1 » 6.x-4.2
FileSize
1.1 KB

Rolled as a patch against the 4.x branch. Hopefully someone can get this in before the next update. This is regi.bradley's code, so he should be credited. :)

fuzzy76’s picture

Status: Active » Needs review
fuzzy76’s picture

Status: Needs review » Reviewed & tested by the community

I guess not. The last update reverted my patch, and I got support requests on this again. Is 2 testers enough for RTBC? :)

falcon’s picture

Status: Reviewed & tested by the community » Closed (fixed)

Thanks!

  • Commit 83b5be2 on 7.x-4.x, 7.x-5.x authored by falcon, committed by paalj:
    Fix #1233526 by regi.bradley: Show results for old revisions in the my...

  • Commit 83b5be2 on 7.x-4.x, 7.x-5.x, quiz-pages authored by falcon, committed by paalj:
    Fix #1233526 by regi.bradley: Show results for old revisions in the my...
1websitedesigner’s picture

Issue summary: View changes

In Drupal 6 on the Results page I'm still only showing the most recent results.

Most of my users are Anonymous and I was hoping to see a range of results for anonymous users, however I'm only seeing one value for me (admin) and one value for 'Anonymous', even though lots of different people have taken the test.

It's not a show stopper, but any help would be appreciated!

  • Commit 83b5be2 on 7.x-4.x, 7.x-5.x, quiz-pages, 2269219 authored by falcon, committed by paalj:
    Fix #1233526 by regi.bradley: Show results for old revisions in the my...

  • Commit 83b5be2 on 7.x-4.x, 7.x-5.x, 2269219 authored by falcon, committed by paalj:
    Fix #1233526 by regi.bradley: Show results for old revisions in the my...