Move quiz-taking UI into a Take tab

turadg - July 1, 2009 - 22:20
Project:Quiz
Version:6.x-4.x-dev
Component:Code - Quiz module
Category:feature request
Priority:normal
Assigned:turadg
Status:closed
Description

If you go to a question node, you see the prompt for the question and then an interaction field to answer it. There's also a Next button beneath it to continue to the next question, but it doesn't do anything.

In you go to a Quiz node, you see a question just as above, except now the Next button continues to the next question in the quiz.

I propose that the main view hook for quiz resources not assume that a student is answer the question or taking the quiz. Instead, those features should go into a new action. Something like "take". We already have /node/NUMBER/questions and /node/NUMBER/admin. We could add /node/NUMBER/take as the path for when a student is taking a quiz. And this would only apply to quiz nodes as question nodes cannot be answered except in the context of a quiz.

I'd like to come up with a better name than "take", one that would accommodate the variety of words that the "quiz" module models: quizzes, tests, exams, assessments, homework, exercises, problem sets. Maybe "fill" or "respond"? Respond would match the QTI data/conceptual model of prompts and responses.

I can implement this. What do others think of this plan? I'd like to include it in Quiz 4.0.

#1

mbutcher - July 2, 2009 - 16:32

This was actually the original pattern for Quiz, IIRC. Some time between the Drupal 4.7 version of Quiz and the Drupal 5 version of Quiz, this changed. I've had more than a few requests to change it back.

For questions: I would be happy with a view that did not include the buttons. I'd like to hear more about how this would look.

For the quiz: I imagine that the taking of the quiz would be handled by logic separate from the standard node viewing. Right now, quiz_take_quiz gets called from quiz_view() under basically all circumstances. I'd much prefer a system that made the quiz taking process pluggable (generically speaking), so that we could continue doing quizzes as they are now, as well as "all in one page", printer-friendly, and so on.

Sivaji has "AJAX quizzes" on his task list, and I don't know how he plans on implementing that. But that is a perfect example of how decoupling the view logic and the quiz taking logic and making the later more configurable could really pay off.

What are you thinking in terms of workflow? What will an administrator see when viewing a quiz? What will a user see?

#2

mbutcher - July 2, 2009 - 17:23

If we were to divide the quiz module to handle this new scenario, it means a few things:

1) we have to figure out how admins will be able to configure what views people will be able to access, and under what conditions.

2) We need to figure out how to write an abstraction layer that will handle tracking the progress through a quiz, timing, and all that good stuff.
(assuming we want to provide that to multiple views)

#3

turadg - July 3, 2009 - 18:56
Version:6.x-4.x-dev» 6.x-5.x-dev

In IRC we agreed that this could jeopardize the GSoC release target for Quiz 4.x so instead I'll work on this in Quiz 5.x.

Since then, I've had another idea for how we could reconcile the work that I need to do with Sivaji's. I think we could both work in Quiz 4.x and avoid the hassle of divergence and merging.

The multichoice question type checks for whether its in a quiz and if not, warns that it won't be scored. We could have every question type checked whether it was in a quiz, and if so then display a teacher/instructor view instead of a student/respondent view. I've done this in my checkout and it takes <10 lines of code.

Then a new question organization type, Item Collection, could be made that works similarly to Quiz in that it has a list of items, but doesn't have all the interaction settings and UI. That way Sivaji could keep working on Quiz and I could work on a separate content type. Only our questions would be in common, and a simple check for whether they're in a quiz or not would separate our concerns.

Sivaji, how does this sound to you?

#4

sivaji - August 13, 2009 - 17:33
Version:6.x-5.x-dev» 6.x-4.x-dev
Assigned to:Anonymous» sivaji

I like the idea of decoupling the view logic and the quiz taking logic using AJAX quiz. As of now for the GSoC i have only a basic AJAX quiz is done. It works something as follow

1. enabling AJAX quiz will introduce one more tab "AJAX Quiz" (similar to "manage questions").
2. When you click on the "AJAX Quiz" tab you will be taken to a page node/$nid/ajax-quiz where you can view the quiz description and a link to start quiz.
3. When you click the "start" link consecutive questions will be loaded one below the other using quiz_take_quiz().

I would like to do this after GSoC as a part of quiz 4.x. Let me know your thoughts on this.

(btw, i could see Crell, add1Sun and other drupal developers who don't have access to quiz CVS is in issue assigned list. why ?)

#5

sivaji - August 13, 2009 - 12:41
Title:Make view hook of question and quiz show the resource, not start assessment» decoupling the view logic and the quiz taking logic using AJAX quiz

changing issue title

#6

turadg - August 13, 2009 - 17:14

Sivaji, it would be great to have your AJAX Quiz feature in the 4.0 release. I think once it's working, it should be the only quiz-taking interface. Every browser now supports the AJAX that's necessary. Because it would be the only taking interface and because the user can't be expected to know what "AJAX" means, I propose that the tab be named "Take" or "Take quiz", something like that.

Further, I think we should make the main node view of the quiz describe the quiz, as in the top of this ticket. What do you think of that? The node view would describe the quiz and include notes on it, what the objectives are, etc. Then the "Take" tab would prompt and record student responses.

If the user has taken the quiz, the main node view could also tell them their score, comparative stats, etc.

#7

sivaji - August 22, 2009 - 12:19
Version:6.x-4.x-dev» 6.x-5.x-dev
Status:active» postponed

@turadg thanks for your comments.

As per our IRC discussion with mbutcher and stwith, lets have AJAX quiz as an optional feature for quiz 4.x. Both the "quiz view" and "AJAX quiz" "Take Quiz" tab can be used to attend quiz. We will make AJAX quiz as default quiz handling mechanism in quiz 5.x. Moving forward to quiz 5.x

#8

sivaji - August 22, 2009 - 12:19
Assigned to:sivaji» Anonymous

#9

turadg - December 30, 2009 - 16:30
Title:decoupling the view logic and the quiz taking logic using AJAX quiz» Move quiz-taking UI into a Take tab
Version:6.x-5.x-dev» 6.x-4.x-dev
Assigned to:Anonymous» turadg
Status:postponed» active

I'd like to make a case for this getting into 4.0 beta.

Since this was last touched, a couple things have changed. 1) AJAX Quiz module was implemented, an optional module which adds a "Take Quiz" tab on the Quiz node. It displays the node body and the questions, updating the display with AJAX on submit. It's not very reliable though and should be considered experimental. 2) QCollection has been deleted, but some of its functionality does not yet have a substitute. Specifically, a body of text describing a list of questions. So we haven't really finished #562222: Merge quiz and qcollection? but I think finishing this issue would do it, so I'll leave that other ticket marked Fixed.

What I'm proposing is we make a "Take Quiz" tab the default way to take a quiz, though not necessarily by AJAX. Let's have the main View tab show the node body, allowing users to describe the objectives of the quiz, what it assesses, why should take it, etc. Ratings and comments on the quiz could fit in this display. The current "taking" UI that appears on View would go into a Take tab. That should be easy to do, yes? As mbutcher says above, that is how it used to be and there have been many requests to restore it. (related: #259806: Take quiz tab is good but and #415292: collecting comments about a Quiz from users)

Where does that leave AJAX Quiz? We could rename its tab to "Take AJAX" and let themers change it, or we could have it override the other tab when it's enabled. Which is preferred? (Or another idea?)

I can commit to doing this if falcon agrees to the plan.

#10

turadg - December 30, 2009 - 17:31

I went ahead and committed the changes to quiz.module to separate taking into a Take tab. It's pretty light and easy to revert. I also committed a change to ajax_quiz.module to change it's tab name to "Take by AJAX". Again, easy to revert.

So the change is implemented, and good to go if people agree. If not, I can revert the edits.

#11

falcon - December 30, 2009 - 19:41

I have never liked having quiz taking as the node view for quiz.

There might be others against it though.

http://drupal.org/node/630948

#12

mckooter - December 30, 2009 - 23:37

thanks for the heads up about this falcon, i have the new alpha from today and am testing it a bit, trying to figure out exactly what you guys are referring to here. from what i can tell on the new release the view quiz is still the default way to take the quiz, but now the "take quiz" is the ajax quiz (which appears to be broken still)?

is that what your speaking about primarily? i apologize if im off on the subject here, been a long day and maybe im not comprehending it correctly

#13

turadg - December 31, 2009 - 05:31

mckooter, the Take change came after the alpha so you'll need the -dev release to see it (or CVS checkout).

What you'll see is that the "Take Quiz" tab is now titled "Take AJAX". The normal view, in which answers can be entered, is now in a new "Take" tab. The node view now shows the node body (e.g. quiz description) instead of the answer form. We should probably also put a prominent "Take" button in there which goes to the Take tab.

Incidentally, right now the main view doesn't do the "access quiz" permission check, while the Take tab does. I think this is an improvement. E.g. use case in which anonymous users are allowed to see what quizzes are available but they have to join in order to take one. And if people want to limit access to the node type at all, there are plenty of permissions modules to handle that.

#14

mckooter - December 31, 2009 - 14:59

thanks turadg, i thought when i looked at it yesterday the alpha and cvs were the same but i see they are different now. I have updated to the newest, seems like a better idea overall, cant see any issues with it, im assuming the take button is what makes the quiz considered started?

also i like the idea of having the main view not do the permission check for "access quiz". This way people can have a starting page or chose not to.

thanks for the update and thanks falcon for informing me of it

#15

turadg - January 1, 2010 - 10:49

mckooter, I'm not certain when the quiz is considered started. the Take button just shows the old main view, so if that view starts the quiz then the Take view now starts it. if you had to enter an answer to start the quiz, then that's still the case.

I'm so glad this will make it into the 4.0 beta. There make be some kinks in the change so testing and bug reports are very welcome.

#16

falcon - January 6, 2010 - 08:52
Status:active» needs work

In my opinion this needs to be done:
- Add some meaningful statistict on the view page.
- Add a button for taking the quiz on the view page.

#17

turadg - January 6, 2010 - 10:14
Status:needs work» needs review

I agree with the Take Quiz button, as I said above. Done and committed.

What "meaningful statistic" do you have in mind? Could that be the subject of a new ticket? I think the task of moving quiz-taking into a Take tab is complete.

#18

falcon - January 6, 2010 - 10:21

Yes, we can make a new ticket for the stats.

We (my ui person and I) would like to have the take quiz button look like a submit button. We want the same look on the take quiz button as on the next button. What do you think?

#19

falcon - January 6, 2010 - 10:27

#20

turadg - January 6, 2010 - 10:48
Status:needs review» needs work

Yeah, I agree a <button> would be better than the <a>. I tried it out and it definitely looks better, and is clearer for the user:

<?php
  $node
->content['take_quiz'] = array(
   
'#type' => 'button',
   
'#value' => t('Take quiz'),
   
'#submit' => url("node/$node->nid/take"), // this is probably wrong
   
'#weight' => 2,
  );
?>

I just can't figure out how to make it do anything. The question hook_view() works because that button does a submit. We're not in a form here so there is no submit action, right? I thought of writing some JS to handle the onclick, but that would fail in non-JS environments.

Anyone know how to fit a tiny form within the hook_view? The above outputs:

<input type="submit" name="op" id="" value="Take quiz"  class="form-submit" />

But we need:

<form action="node/NODEID/take">
<input type="submit" name="op" id="" value="Take quiz"  class="form-submit" />
</form>

#21

falcon - January 6, 2010 - 11:50

I don't know how to fit a tiny form within the hook_view.

Attached is a patch that seems to work. It has also been commited. I'm using drupal_get_form. There are ways to do this without using drupal_get_form, but it will probably be both uglier, bigger and have a higher chance of causing errors in the future.

I have also changed the quiz_take function because node_view made the start quiz button render on all pages. I quess we have been using node view to view taxonomy, comments etc. But I think it is better if comments etc. are only viewed on the view page and not while the quiz is beeing taken.

AttachmentSize
507664-21.patch 1.47 KB

#22

falcon - January 6, 2010 - 11:49

Last comment has been edited:
I don't know how to fit a tiny form within the hook_view?

should be:
I don't know how to fit a tiny form within the hook_view.

:)

#23

turadg - January 6, 2010 - 12:05
Status:needs work» fixed

Great, problem solved.

I change the URL to use the url() function, per the recommendation in the docs:
http://api.drupal.org/api/function/url/6

I'm not sure about the use of drupal_render(). Some have asked for commenting during quiz taking. Also, AJAX Quiz isn't working now (though it may have been broken earlier and is officially unsupported). Still I think this is good for now and we can listen for feedback and bug reports.

#24

falcon - January 6, 2010 - 12:21

Great. I thought that action was passed through url or similar by the api, but it isn't. I added url a few other places as well. drupal_goto atleast uses the url function.

Edit: Removed maybe. The #action isn't passed through the url function. There are probably good reasons for this.

#25

System Message - January 20, 2010 - 12:30
Status:fixed» closed

Automatically closed -- issue fixed for 2 weeks with no activity.

 
 

Drupal is a registered trademark of Dries Buytaert.