Closed (fixed)
Project:
Quiz
Version:
6.x-2.x-dev
Component:
Code
Priority:
Normal
Category:
Feature request
Assigned:
Unassigned
Reporter:
Created:
11 Oct 2006 at 17:26 UTC
Updated:
9 Oct 2010 at 11:58 UTC
Jump to comment: Most recent file
Comments
Comment #1
nicholasthompsonAgreed - although, I think this is correctly labeled as a feature request.
Comment #2
westwesterson commentedI agree, there should be a views filter, field and argument which allows you to see and sort by who has taken a quiz, and what their scores are. You would be able to visualize this data much easier. I'm guessing this also would rely on the user node module being installed. But once implemented, you have a fully customizable tracking system for grades in which any field could be sorted.Another reason why this is a vital feature is, sorting by result ID (on the quiz results page) is unintuitive, and meaningless with a large number of quizzes and/or a large number of people taking them, at present it is utterly impossible to find a quiz you are looking for.
Example usage of views integration:
Sortable List of quizzes that a given person has taken.
List of users who scored above 80%.
Searchable quiz list.
List of quizzes made by a user.
Calendar view of Quiz availability.
Calendar view of when a user took a quiz.
RSS feed of who took a given quiz.
etc. (the possibilities are limitless)
Comment #3
westwesterson commentedThis doesn't do anything yet, its not working for some reason, but causes no bugs from what i can tell, aside from the added field and sort are nowhere to be found, but I have gone ahead and started to implement parts of quiz for the views api. If theres anyone who can figure out how to get this working, it would be a great help.
First I added this code to the quiz module, near the top.
and then, I have started the api implementation in the attached file quiz_views.inc which you'll have to rename from quiz_views.inc.txt
I have just started implementing quiz passing rate as a proof of concept before trying to muck around with quiz results. But alas, I am lost. Hopefully someone more knowledgeable about the views API will be able to take this on.
Comment #4
westwesterson commentedI figured out what I had done wrong, and I will post some of the rudimentary views integration. But I have not attempted deeper integration yet. i.e. with results. But this code is pretty solid, I think??? And maybe even could be added to the module. Lemme know what you think. (there might be some minor problems with the actual mod to the quiz module main section. I'm not sure of these, because it all seems to be working fine for me.) Basically, I just implemented these values in the quiz table using the views api, for both sort and field. There are no filters in this release:
Quiz: Passing Percentage Rate
Quiz: Number of Questions
Quiz: Number of Takes Allowed
Quiz: Start Time
Quiz: End Time
The other tables could be easily implemented as well. The only concern is the final score, which at the moment does not seem to be stored in the tables. And it sounds like an expensive process to calculate on the fly for a large number of results. But with this hack a listing of quizzes with start and end dates is now possible, which can be grouped by taxonomy. Still a ways off from being able to adequately list results. Maybe someone else can figure this out, as I don't have much free time.
Once again, you still have to add the code above to the module to get this to work, and upload this latest file to the quiz directory. And rename it to quiz_views.inc
Comment #5
westwesterson commentedNot gonna have time to work on this project for a while, if i ever get around to it, but this is everything implemented for the 'quiz' table except arguments and default views.
Tables to still be done:
quiz_result
In order to add the results to the quiz most likely, there needs to be some sort of caching mechanism which stores the results to the quiz result table. Then there would be opportunity to use them for views and actions integration. But in the meantime, quizzes are sortable, filterable, and have fields for the number of questions, the start date, number of takes allowed, the percentage needed to pass and the end date when the quiz is no longer available.
Comment #6
westwesterson commentedTo make things easier for upgrade, I have included a patch for version 1.1 of quiz. (For Drupal 5.0) I still have not implemented arguments (though this would be useful), and I am looking into possibly creating a new table column which will cache quiz results so they can be accessed with views. This patch does not take any permissions into account. So you'll have to micro-manage views so that only users with correct access permissions can access it.
Comment #7
westwesterson commentedOK, haven't posted anything on this for a while, this is still a work in progress, but this whole file needs to be added to head anyways, so i will include just this file, you have to add code in the module itself to get it to work, (this is already on the top of this page. But if you want to see what I have so far this is working, and I have implemented most filters, sorts, and fields for the module.
known bugs:
- filter and sort by quiz taker do not work
- ideally the score should link to the result, for now result id can link to the result.
- will not work with usernode
- this is by design, quiz results are NOT nodes, so a userNODE will not connect with a quiz result. This will not change until these become actual nodes, or untill views 2 comes out. It just wont work unless I reimplement the entire functionality of usernode of quiz results.
arguements and defaults still not implemented, these will wait untill all fields are fully implemented.
Comment #8
kscheirerI had a chance to play around with this patch, and it works really well! Aside from the bugs you mentioned above :)
I noticed in the code theres a few comments about the lack of number_of_questions, and I agree with you that it would be too wasteful to recalculate that for every quiz result. Do you think it would be helpful to keep a number_of_questions on the quiz_node_results table, for easy sorting?
The attached patch builds on your work, and includes a field "AVG Score" that will calculate the average score for all users on completed quizzes (score is not null and time_end > 0). This field is also sortable. Patched against HEAD.
Comment #9
westwesterson commentedI don't think number_of_questions needs to be on the quiz node results table, then it would be called too many times, most efficient place to put it is in the quiz_node_properties where it used to be, but this time it's automatically calculated when you add a new question to a quiz.
Comment #10
kscheirerthe only reason I don't like putting it on quiz_node_properties
is that then we'll end up with a synchronization problem. Every time a question status is changed, we'll have to make sure the value stored in that field keeps up. Obviously this can be handled, but it means that every coder has to remember to change those values in 2 places now instead of one.
By putting it on the results table, it will be a little redundant (every result that belongs to the same quiz should have the same number of questions), but it will provide a bit of a sanity check. And since we are waiting to the end to save the value, it will just be a simple count on the number of questions, instead of constantly keeping an integer value updated to reflect question status.
I'm open to doing it either way, but the old number_of_questions code really caused way more problems both in development and in admin usage of the module.
Comment #11
westwesterson commentedThe quiz should be upgraded with every question add.
The problem with this is that users cannot see the number of questions until there is at least one quiz result and it should be pretty easy to write a simple handler function that helps developers to store this data. Write it once, then never write it again. And it should be stored in t
The handler can then be added to later, which can allow for future database adds based on number of questions.
Comment #12
kscheireryou've convinced me, I'll work on putting this field back on quiz_node_properties.
As long as its not exposed to the user, it shouldn't be too much extra work to keep in synch,
and we can avoid all that validation code on it that was confusing new quiz admins.
Comment #13
westwesterson commentedAny progress on number of questions?
Also, I am considering making Quiz views this a separate module. This module can either be a separate download, or included in a contrib folder. Any consensus, as to what would be a better route? I plan to put this out in the next few days as a separate module, if I get no response.
Comment #14
webchickI'd much prefer the Views integration included directly with Quiz module "core", however we need some people to test this patch.
Comment #15
westwesterson commentedWell to get the testing started, I guess I'd note that this has worked with very few hiccups (to my knowlege) on two different installs on different systems. (could still use more testing) These are the weird nuances that I found.
I can't get quiz takers to sort or filter. This is a pain, but shouldn't be a deal breaker. This is a nice to have, but not vital. Part of the problem with this is how quiz results are not handled as nodes. But without this functionality there are still vast improvements over the present handling. Such as reordering and filtering by other aspects. And I think we should be able to launch quiz with views integration without it. Unless someone can find otherwise, I found no prior art of someone successfully able to do this. And trust me I looked. And no usernode does not count. (difference is that usernode uses 1 join where as this would require 2 (joining these tables: user, quiz_node_properties, and node).
The second is that AVG score weirdly groups all scores together (for one person). I'm not sure if this is a feature or a bug. This has something to do with how AVG score uses the group by uid handler. And probably could be turned off. Test it out, tell me what you think!
And I was intending to also release the module first as a dev release to spurr testing. As for right now, it seems to take forever to get major stuff tested, and I'd hate for all the work I'm doing to be thrown out because people wait so long to respond. So please, if you test the module, please respond here and let us know if it works, or doesn't. And this is most helpful in the HEAD release, as a number of bugs are fixed here, although a few are still out standing.
Possible additions:
On my own system, I have managed to reproduce quiz result 'actions' in views, so you can administrate quiz results from from the same page (the view function is broken in head, but a hack of changing it to the userresults page instead provides the same functionality, albiet the wording is different). I didn't plan on releasing this until the admin view result page was fixed so as to make sure that this was a quiz problem not a quiz views problem. If a quiz result was a node, this function would already be implemented in another module, along with the user filter and sort. Not to mention the that permissions to view quiz results could be handled more granularly with modules like access control. But implementing this is a huge effort in itself.
'Take quiz' - i have not implemented this, but thought it to be desirable. This would give the user a way to bypass the main quiz page and jump directly into the quiz from a view.
Anyhow, it is discouraging that things take so long to get done, once they have been coded. SO, PLEASE START TESTING AND LEAVE FEEDBACK! THE MORE FEEDBACK, THE BETTER! Not to mention the sooner this stuff can go into HEAD.
Comment #16
westwesterson commentedquiz taker filter is on the way! and so is filtering quiz results by the current user! Also possibly in the works is a take quiz link directly from views. Hello flexibility. Quiz 2.0 is almost here!
Comment #17
westwesterson commentedHere is the most recent development on quiz_views. I still think that creating a separate quiz_views module distributed with the quiz module (like multichoice for example) is a good idea, as it can be enabled or disabled by the user. The massive adds to the number of fields in views can be a limiting factor for some. And by default the module disables some default quiz functionality replacing it with a more flexible system. Anyhow, here it is.
Known Bugs:
- Quiz Taker Argument doesn't show up on some installs for an unknown reason. I got it to work perfectly on one set up, but it doesnt work show up on another. But on the one it did, i was able to replace the my results page.
- this is a views bug i think, but sorting by quiz_taker can only be done by knowing their full username. You can't filter by all usernames starting with 'b' for example. This does not work in other user views either. so it's not a quiz views bug. This release should really be tested. And hopefully, someone can figure out why the argument will only show up on some installs.
Would love feedback.
Comment #18
drutube commentedI ran the patch and it went fine. I ran it again the very latest Quiz module which is at this time
5x.1.1
I think it doesnt automatically mofify the install file but don't know if it should. Its missing a table.
user warning: Table 'lapremot_mar.d_quiz_node_results' doesn't exist query: SELECT count(node.nid) FROM d_node node INNER JOIN d_quiz_node_results quiz_node_results ON node.nid = quiz_node_results.nid INNER JOIN d_users quiz_user ON quiz_node_results.uid = quiz_user.uid WHERE (node.type IN ('quiz')) in /home/lapremot/public_html/drupal/includes/database.mysql.inc on line 172.
Comment #19
drutube commentedSorry about the typos. Anyway my question is what is the code to create this table and are there any other tables this patch needs that are not automatically created by the install process.??
thanks allot
Comment #20
westwesterson commentedYour problem comes from the fact that you patched against the wrong version.
Try again patching against the head version of quiz.
There have been massive database changes since quiz v. 1.1 and the upgrade script is not totally finished, so you should uninstall the previous version of quiz first (you will loose all old quizzes) luckily this is almost finished in another patch which will convert quiz 1.1 to the new schema.
There should be some documentation on the quiz page as to this development but for now there isn't.
Comment #21
westwesterson commentedalso note that this code is not even beta yet, so it should probably not be used on a production site, although it has been working for me.
Comment #22
drutube commentedThank you very much by the way. No we're looking to develop or more accurately extend the Flashcard module to be more Ajaxy and have some of the functionality and views integration you've got here.. Definitely not on a production site ..:). I appreciate the help allot.
Comment #23
drutube commentedI ran it against head and it also seemed fine. Then I got the node revision table didn't exist and the one here.
user warning: Table 'lapremot_mar.d_quiz_multichoice_answers' doesn't exist query: SELECT * FROM d_quiz_multichoice_answers WHERE nid = 17 AND vid = 17 in /home/lapremot/public_html/drupal/includes/database.mysql.inc on line 172.
Maybe the prior install was not completely cleared out.. .
Comment #24
drutube commentedThat may have been it.. I've not tried to add a quiz with multiple correct answers. So far the only persistent error -- even after reinstall is this..
user warning: Table 'lapremot_mar.node_revisions' doesn't exist query: SELECT nr.nid, qnr.question_status FROM d_quiz_node_relationship qnr INNER JOIN node_revisions nr ON (qnr.parent_vid = nr.vid AND qnr.parent_nid = nr.nid) WHERE qnr.parent_vid = 16 AND qnr.parent_nid in /home/lapremot/public_html/drupal/includes/database.mysql.inc on line 172.
Comment #25
westwesterson commentedYou should checkout the patch on newly created issue # 188830 which should fix issues with table prefixes (this is not a views issue). It still needs better testing, but this should make all of quiz HEAD table prefix compliant.
Comment #26
westwesterson commentedSince this code has been thoroughly tested, and the known bugs degrade gracefully, I would like to put this in head, but i think maybe 1 more person should test it, just to be sure. After testing I will create a separate issue for the bug (if all else goes well). The only known bug is:
- Quiz Taker Argument doesn't show up on some installs for an unknown reason. I got it to work perfectly on one set up, but it doesnt work show up on another. But on the one it did, i was able to replace the my results page.
This is most likely a dependency problem, but produces no user side error. So please test, the latest patch, so we can add views integration to quiz 2.0
Comment #27
westwesterson commentedHere is a rerolled version for the most current version of quiz head
Comment #28
senpai commentedOk, the patch applies cleanly. It works as expected. No bugs that I can find. I made a cleanup of the chunk of code that adds views.inc, cause it had some three-space indents. I also added an note about Views 5.x-1.x compatibility, since Views 2 is nearing completion, and these views.inc filters will break horribly on a site that's running Views 2.
I did notice something odd. After applying westwesterson's latest patch from #27, I went directly to the Views admin page to see how many filters were now available to me. Strikingly, there were NONE! I then realized that I'd have to add another new quiz node before Views would pick up on it. I wonder if there's a situation out there where a site administer who was already running Quiz (and had lotsa quizzes in their db) went and added Views to their site, ostensibly because now Quiz 2 supports it. Are they gonna file "this is broken" issues in the queue because they can't see the proper Views filters? Is there anything we can do about it?
Comment #29
westwesterson commentedThis patch has been committed. I have created separate threads for the quiz views related issues.
Comment #30
(not verified) commentedAutomatically closed -- issue fixed for two weeks with no activity.