Closed (fixed)
Project:
Quiz
Version:
7.x-5.x-dev
Component:
Code - Quiz core
Priority:
Normal
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
8 Dec 2015 at 10:50 UTC
Updated:
18 Jan 2016 at 19:14 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #2
adamelleston commentedComment #3
adamelleston commentedComment #4
adamelleston commentedComment #5
adamelleston commentedComment #6
djdevinHi,
Thanks for the patch. Where did you see this affecting Quiz? I'm surprised none of the tests were failing before, so we should probably write a test.
Comment #7
adamelleston commentedI am currently working on a lot of custom reporting for quiz's on a project and tried calling quiz_calculate_score() from my own module.
I noticed that when logged in as admin and viewing each of the results for a quiz node it seemed to work out but when calling it myself it was returning nothing.
Comment #8
adamelleston commentedI haven't written tests before but happy to give it a go if I can find some time to do it.
How would you write a test to replicate calling the function directly from another module?
Comment #9
djdevinYeah the strange thing is, Quiz calls it too, so I wonder why it's not broken there. The patch is definitely correct I'm just confused why none of the Quiz tests about scoring are broken.
If you don't have time I could write the test too, but I need to know how to make it fail. To replicate calling the function you have to programmatically set up the Quiz in the test the same way you are setting it up on your site. There are some examples in quiz/tests if you want to dig in or try and make steps to reproduce.
Comment #10
adamelleston commentedYeah I looked right past that as a cause for my issue at first and the quiz module calls it just fine.
Looking at the tests I am not sure how you would go about calling the quiz_calculate_score() function directly to bring back data on a specific result from an external module. I am calling it from the following hook hook_views_pre_render() if that helps.
Comment #11
djdevinThis is the right approach anyway, so committing. Thanks!