I want to use a webform to build quizzes. I'd also like to be able to get webform to analyze the quizz for me.
Specifically, I'd like to be able to choose a submission-id, then use THAT submission as a reference to compute the quizz totals.
For instance, if I have a reference sheet that says:
1 2 3 4 5
- a b c d
and a submission that says
1 2 3 4 5
- a b d -
I'd like to know that there were 2 correct answers, and 1 wrong answer.
In the case at hand, answer 1 does not count, and answer 5 was left unfilled.
Does anyone already have code ? I can figure it out from the webform code itself (I've located the webform_get_submissions code and can proceed from there), but I'd rather not duplicate the work...
| Comment | File | Size | Author |
|---|---|---|---|
| #14 | compare.patch | 5.37 KB | espie |
| #10 | webform.diff | 5.88 KB | espie |
| #5 | webform.module.diff | 5.07 KB | espie |
Comments
Comment #1
quicksketchWhat you're requesting is outside the scope of Webform's built-in capabilities. You might take a look at http://drupal.org/project/quiz, which is a little more suited to the task you're trying to accomplish.
Comment #2
espie commentedActually, no.
Quizz sucks, its presentation is really bad. Everything would need to be redone from the ground up.
(I've tried quizz before stumbling on webform).
webform does most of what is required correctly, including being able to download the detailed result.
Really, everything that webform would need is a reference answer, and a count of the number of correct answers.
I was just asking if someone had done the necessary work. If not, I'll do it, and you'll probably be surprised how small the actual patch will be.
It's just going to take me a bit of time, since drupal is not my usual development environment.
Comment #3
quicksketchWhatever solution you implement, I'd suggest trying to do it without modifying Webform directly. hook_form_alter() can usually get you anything you need. If you end up creating a modified version of Webform that supports this feature, it's unlikely that such a feature would be included directly in the module, since this is not its intended purpose.
Comment #4
espie commentedWell, it's your fault for creating such a good framework. ;)
Of course I'll try to make it be a nice plugin. I'm under a somewhat tight schedule, so I will do what I can first.
Comment #5
espie commentedI've got most of it working, I've figured out how to add a nice `choose as ref' button to the list of webform submissions, and I can download a csv file with two additional fields, based on the sid.
I'm currently polishing the thingy, namely adding csv_compare functions to relevant components...
the possible main issue I have is that this does not really fit as a plugin, as I reuse a lot of internals of webform (parts of the csv build, in fact), so I'd like to talk things over so that I can extract it so that it doesn't need to be embedded in webform.
I've attached my current diffs as a small work-in-progress...
Comment #6
espie commentedI've got something which works for my purposes, but I'd like to be able to give it back to the community.
Specifically, I'd like to be able to hook into the csv stuff in a simpler way, and probably to add stuff to the components.
Right now, I've got where select values do work, I can count good and bad answers for simple selection fields.
I know, I know it's not supposed to be the goal of the webform module, BUT this yields ways nicer `quizzes' in a school setting (the quizz module shows questions one at a time, whereas I want to confront the student with a full quizz, instead of having to navigate back and forth between questions).
And frankly, right now it's about 20 lines of code on top of webform...
Comment #7
quicksketchIt looks like you're patching against the 5.1.3 version, you should either checkout a copy from CVS or download the development version, as the CSV download has received an overhaul, I don't think this patch will apply against it.
Comment #8
espie commentedThat's correct, I don't have the luxury of working against a 6.x or 7.x server for my production system...
I'll see what I can do next week-end...
Comment #9
quicksketchOh, I'm saying the latest 2.x version for Drupal 5. I try to keep the 2.x versions as close as possible between Drupal 5 and Drupal 6, so the 2.1.3 version is feature equivalent in both versions of Drupal. You can download the latest version of the DRUPAL-5--2 branch here: http://drupal.org/node/235004
Comment #10
espie commentedI've updated it for 5.x-2.3, so that you can tell me how to proceed from there...
sorry for the long delay, been caught up in various other issues.
Comment #11
espie commentedPing ?
I'm still waiting for any kind of comments on that diff...
I'd rather not have to update it again for the next version, or something...
Comment #12
quicksketchI'm still not feeling good about this. It's a drastic expansion of the scope of Webform and not really what it's intended for. If you can find a way to make Webform flexible enough to handle this without implementing it directly I'd be more open to accepting patches for this.
Comment #13
marklein commentedExist this function for webform 6.26?
Comment #14
espie commentedHere is an updated patch for 6.x-2.7
I frankly don't know how I could do that as a plugin.
Seriously, consider the download stuff: if you want that as a plugin, it needs to be refactored. As it currrently exists, providing that downloading possibility means duplicating the download function COMPLETELY.
I'm quite willing to be working with you, but hey, it's your code, tell me where you want to go so that I can integrate my stuff... right now, "plugin" is ridiculous. Theming the form is about 1% of the issue. Most of the juice is in the download function...
Comment #15
quicksketchThis will not be implemented in Webform core. If you feel that the APIs can be extended to make this possible then I'll consider adding them to make it possible to implement as an add-on.