Using Quiz questions in Lesson

Using Quiz questions in Lesson

by Martin Dougiamas -
Number of replies: 8
Picture of Core developers Picture of Documentation writers Picture of Moodle HQ Picture of Particularly helpful Moodlers Picture of Plugin developers Picture of Testers
Guys, see this! smile http://moodle.org/mod/forum/discuss.php?d=42557

I think integrating the Quiz questions into Lesson will be a lot easier now. smile
Average of ratings: -
In reply to Martin Dougiamas

Re: Using Quiz questions in Lesson

by Mark Nielsen -
Hey Martin and Moodlers,

I have been pondering about how to switch Lesson to use the question classes for quite some time now. Although the process might seem rather straight forward, it is actually a very long and arduous journey. I believe that there are four top-level tasks: adding support for the question class, change the attempts logic, fix code breaks, and database migration. Each of these has several sub-tasks. Ill break these down best I can with the following:

Adding support for the question class: This is one of the easier tasks. Just implement the question code and the interfaces for adding them to a Lesson.
  • Printing the question(s) for attempts.
  • Grading the question(s).
  • Provide a method for adding new questions to a Lesson.
    • When adding a question, display questions in course question bank to select from.
      • Provide links/tabs for creating new questions, importing, etc.
    • After adding a question, define possible jumps.
Changing the attempts logic: Among other Lesson table changes, one that is the most significant is changing the lesson_attempts table. Instead of storing one attempt record per question answer, lesson_attempts should store one record per Lesson attempt. The functionality of the original lesson_attempts table will be replaced by the question_states table.

Fixing code breaks: By switching to the question class, nearly all of the current Lesson code will be broken and must be replaced or fixed. Here is a quick breakdown of foreseeable code breaks along with relative difficulty in fixing the break:
  • High scores (easy)
  • Lesson statistics (hard - quiz reports might provide a jump start?)
  • Essay Grading (medium - rewrite or migrate quiz's Manual Grading to the question code)
  • Page Editing (easy)
  • Jump type interpretation algorithms (medium)
  • Ongoing score (easy)
  • Progress bar (easy)
  • Backup/restore (hard - rewrite for new table structures and add support for restoring Lessons pre question class support)
Database migration: This will be a tremendous feat! Lesson tables need to be changed and their old data needs to be moved to new tables. Some of this code will be used in the restore process as well. Here is a basic overview of the upgrade process:
  • migrate lesson_pages and lesson_answer content to question tables.
  • migrate lesson_attempts to question_states.
  • Re-organization of the lesson tables.
  • Rebuild the Lesson.
Side effects of this rewrite: Due to the amount of rewrites and modifications to the Lesson code, a couple side affects and opportunities arise:
  • The jump system will need to be reworked to support the new code. Currently the jump code is scattered everywhere, hard to maintain and add new jump types and the code is confusing. A plug-in system with classes would be a nice fix. Have a directory called jumps with files inside defining different jump types with a class. This class class would have methods for using the jump like validating its use, interpreting the jump, etc. This would allow for the easy contribution to new jump type algorithms. Open to other ideas as well wink
  • Lesson has a high mix of logic and presentation. In the rewrites, this can be improved by using HTML templates for the presentation.
  • Single files handle too many tasks, example: view.php handles the attempts, editing, grading, essay grading and high scores.
So, as you can see, I have put a lot of thought into this. I believe that this refactoring of the Lesson is necessary because it would bring Lesson's code base up-to-date with the rest of the Moodle code, increase the maintainability of Lesson, and lower the learning curve of Moodle because there will be only one question authoring system. I'm sure that the list of advantages goes on as well big grin

Lastly, if you have more ideas, see a potential problem or completely disagree with me, then please post.

Cheers,
Mark
In reply to Mark Nielsen

Re: Using Quiz questions in Lesson

by Dan Hilke -

With all the 'reworking' of the Lesson module, is it possible that Lesson pages might one day be able to be shared between different courses like Quiz questions can?

For instance, if I have created a course and need several variations of that course, then as of now (1.5.3) I duplicate the original course by making a backup, change the course name, restore the backup, and then edit one of the courses.  Then I repeat this for each variation that I need.  (If there's already an easier way, please point that out.)

If there was a spelling mistake on a page of the original course that is now common to all of them, then I have to find the page in each course to fix it.  Likewise, if I want to add a picture or edit a page in any way, then I have to do that in each course.

Is there any possibility that Lesson can be designed so that I can create a new course, and draw pages into it from an existing course, just like I can with Quiz questions?  And if I edit that page, then each course that contains it would reflect the update?

I have no idea what this would involve as far as programming, so I'm just asking... (very hopefully...)

Thanks,
Dan

In reply to Dan Hilke

Re: Using Quiz questions in Lesson

by Mark Nielsen -
Hi Dan,

You bring up a good point.  This migration would allow all of the question pages inside of a Lesson to behave just like Quiz's questions (be able to view/edit them in the course question bank and in other courses).  There are four other types of Lesson pages though: Branch Table, End of Branch, End of Cluster and Cluster.  The last three are not really pages at all.  The new Lesson database structure (which exists only in my head at the moment wink) would take care of that.  But, branch tables are the one page that is not a question type but has a title, content, options and etc.  Now, there is a question type that is very close to branch tables called Description.  This question type could be modified to take the place of branch tables, or a new question type could be created.  A new feature of the question types is the display.html templates, which would be needed for displaying branch tables with slide show on or off.

So, I guess the question is, would we want to get rid of Branch Tables all together as we know it?  Then replace it by expanding Description or by creating a new question type.  If branch tables are converted to a question type, then all Lesson pages would be stored in the course question bank and available to other courses or modules.

Cheers,
Mark



In reply to Mark Nielsen

Re: Using Quiz questions in Lesson

by Chris Collman -
Picture of Documentation writers
Hey Mark,
As a 1.5.3 newbie, I didn't get the difference between questions and branches from a teacher standpoint, with student directed learning in mind.   Both function the same way.  Some have buttons to push, others have radio button to check, some have blanks to fill in.  All of them are navigation pages.  In other words, question pages.  

"Branch tables" are "Button (Question) pages" to me.  Sounds like this is your "new" question type.

So are you also going to create a Start Branch (with only one jump) to go with end of branch, as we have with clusters?  Don't know how this affects things with programming. It would make the special navigation tools uniform to the teacher and easier to explain. And I am not sure I really appreciate the differences between these two special navigation tools, except that clusters seem to nest inside branches.  

FYI to the forum. I think I am a sophomore with Lessons, and have only glanced at Quiz feature.  I will stop apologizing in a month or so. Thanks for all your help and efforts.







In reply to Chris Collman

Re: Using Quiz questions in Lesson

by Michael Penney -
Branch tables are ungraded pages, perhaps more like slides in slide show. You can jump anywhere from them (or make random jumps) without affecting the scoring.

The name is sort of a holdover in search of a better term, the original idea was more like a cross-roads between question paths.\

Interestingly, I was just talking with a faculty member yesterday who found it very inefficient that Moodle quiz made you make the questions in a question bank and then move them into the quiz.

If this gets changed in lesson, expect more folks who will have such complaintssmile.
In reply to Mark Nielsen

Re: Using Quiz questions in Lesson

by Dan Hilke -

This discussion has gotten me thinking... maybe I should be using 'Quiz' for my lessons!  My courses are basically lessons (with questions included to keep users from clicking right through) followed by quizzes on the same material.  I could probably use the Quiz module to accomplish both things though.  I guess when I started out, I just got stuck on the names!

Dan

In reply to Dan Hilke

Re: Using Quiz questions in Lesson

by Dan Hilke -

Well, I just tried this with a short 5-page lesson we have.  I made Quiz questions for each Lesson page (which are all Multiple Choice pages) and created a Quiz that shows one question per page.  There are definate downsides to this method; both in formatting and navigation.

I'm back to hoping for Lesson Module to allow pages to be shared among multiple lessons/courses!

Dan

In reply to Dan Hilke

Re: Using Quiz questions in Lesson

by Mark Nielsen -
Hi Dan,

The question authoring for the question types in Lesson would have one more step: a page for defining the jumps.

So, when selecting a question to add to the Lesson, one would be presented with the course question bank. One would then select a question to add to the Lesson. The next page would define the possible jumps from that question. This would keep Lesson's unique navigation intact. (Open to suggestions for streamlining this process!)

The question types display.html templates will allow for Lesson to customize the look of any or all of the questions, which upon reflection, I think is necessary. Lesson question pages tend to have more content and so the formatting needs to handle this gracefully.

So, both formatting and navigation will still be unique to Lesson (among other Lesson features wink) and thus make it a viable alternative to Quiz.

Cheers,
Mark