Qualifying for a badge

In Assigning badges to pages we looked at how to create a panel showing which badges have been earned, or could be earned, on a page. To be able to earn a badge you have to demonstrate some kind of knowledge. This will be demonstrated through being able to answer questions assigned to each badge. 

Creating questions and answers

Two more concepts are needed here;
  • A question is  multiple choice (single or multiple answer), numeric or textual. The type, title and answers are included in the question object, and it can randomize the order in which the multiple choice options are given. It has a unique ID that can be used to identify this question
  • A question Set is a series of questions that go together. A question set would be assigned to a badge. The questions can be randomized within a question set, and a minimum %age of correct answers that qualify as a pass can also be provided. Each question set has a unique ID.
These are stored in the same scriptDB as the badge information. You can see some questionset information in the scriptdb below

and some question information...

Here are the constructors for a question and a questionset


And here is how to make and store some questions and questionsets (but a better method is to construct your database from a spreadsheet (see Creating badge environment from a spreadsheet)

For more about badges see Badges

Taking the test

You can see on the right a panel with some badges you can earn by demonstrating knowledge of things on this site. 






Comments