Achievement Items

From WeBWorK
Revision as of 10:31, 25 January 2014 by Geoff Goehle (Talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

Achievement items are an optional WeBWorK feature in which students are rewarded with an "item" every time they get an achievement level. Each level gives a different item and each item can be used once. The items allow students to do things like get 100% on a problem or homework set, extend the due date for a set, reset the number of incorrect attempts, and so on. Students can see what items they currently have, and use those times, by visiting the Achievements page.

Contents

Enabling Achievement Items

Note: Achievement Items allow students to directly affect their WeBWorK grade. Do not use this feature if you would like the achievement system to remain separate from the grading system.

Using achievement items is a two step process.

  1. Go to the Course Configuration page and select "True" for Enable Achievement Items.
  2. Go to the Achievement Editor page and import achievements using the file default_achievements_items.axp.

If you don't do both of these steps then the achievement items will not work.

When a student earns an item they will be told as much on the level notification. If they want to use the item they should go to the Achievements page and click the "Use Item" button. A popup will appear which will all them to use the appropriate item, as shown below.

Achievement item.jpg

By default the students will earn items with the given effects at the following levels.

  • Level 1 - Earn 50% on a single homework problem.
  • Level 2 - Reset the number of incorrect attempts on a single homework problem.
  • Level 3 - Extends the due date of a homework by 24 hours.
  • Level 4 - Changes the weight of a single problem in a homework set to 2. (This effectively gives 1 point of extra credit.)
  • Level 5 - Changes the source file of one problem in the homework set to that of a different problem from the same set (with a different seed).
  • Level 6 - Earn 100% on a single homework problem.
  • Level 7 - Extends the due date of a homework by 48 hours.
  • Level 8 - Changes the weight of a all problems in a single homework set to 2. (This effectively gives extra credit.)
  • Level 9 - Reopen a closed homework set for 24 hours.
  • Level 10 - Earn 100% on every problem in a single homework set.

Modifying Achievement Items

Because achievement items interact with core WeBWorK tables, including those for problems and sets, the items themselves cannot be created or modified using the web interface. However, you can change which items are assigned at which level, and there are a couple of items that are available for use, but not currently given at any level. Changing the item given at a certain level is straightforward. Open the evaluator for the level in question. It will look very much like this:

#Threshold for level 6
my $newLevelThreshold = 750;

if ($achievementPoints >= $nextLevelPoints) {
   #set new threshold and return 1 
   $globalData->{DuplicateProb} = 1;
   $nextLevelPoints = $newLevelThreshold;
   return 1;
} else {
   return 0;
}

To change the item awarded replace the existing item ID with a new one, e.g. replace DuplicateProb by ReducedCred. Using the Achievement Editor, you should change the name of the achievement in the description of the level. The available items, with their id's, visible names, and a description, are:

ID Name Description
RessurectHW Scroll of Resurrection Opens any homework set for 24 hours.
ExtendDueDate Tunic of Extension Adds 24 hours to the due date of a homework.
SuperExtendDueDate Robe of Longevity Adds 48 hours to the due date of a homework.
ReducedCred Ring of Reduction Enable reduced credit for a homework set. This will allow you to submit answers for partial credit for limited time after the due date. Note: Reduced credit needs to be set up in course configuration for this item to work
DoubleProb Cupcake of Enlargement Causes a single homework problem to be worth twice as much.
DoubleSet Cake of Enlargement Cause the selected homework set to count for twice as many points as it normally would.
ResetIncorrectAttempts Potion of Forgetfulness Resets the number of incorrect attempts on a single homework problem.
HalfCreditProb Lesser Rod of Revelation Gives half credit on a single homework problem.
FullCreditProb Greater Rod of Revelation Gives full credit on a single homework problem.
HalfCreditSet Lesser Tome of Enlightenment Gives half credit on every problem in a set.
FullCreditSet Greater Tome of Enlightenment Gives full credit on every problem in a set.
DuplicateProb Box of Transmogrification Causes a homework problem to become a clone of another problem from the same set.
Surprise Mysterious Package (with Ribbons) What could be inside? Note: this displays the contents of the file suprise_message.txt in the achievements folder.

Creating New Achievement Items

New items can be created (or existing items modified) by editing the file webwork2/lib/WeBWorK/AchievementItems.pm. A server restart will be required after any modifications. Achievement Items are actually subclasses of the WeBWorK::AchievementItem class. In order to make an achievement item you need to do four things

  1. Create the subclass and the constructor, including the achievement item ID, the name and the description. The name and description can be whatever you want them to be, but the ID should be the same as the name of the subclass. You also need to to add the ID to the constant list at the beginning of the file.
  2. Create the print_form function. This outputs all of the fields needed to collect the information needed to use the item. For example, for the Rod of Revelation item the form prints two dropdowns. The first is a list of open sets and the second is a list of problem numbers. The problem numbers are kept in sync with the currently selected set via javascript.
  3. Create the use_item function. This should use the information gleaned from the forms in the previous function to actually implement whatever the item does. For the Rod of Revelation it simply calls up the appropriate userProblem object and sets the score. In addition this is where you "remove" the item from the students "inventory". The system uses the hash in the globalUserAchievement object to keep track of what items a student has. A student has an item if the $globalData{"Item ID"} variable is set to one. The use_item function should set it back to zero.
  4. Choose how the item gets rewarded. Generally this will be through an achievement, either a level or a normal achievement. All you need to do is set $globalData{"Item ID"} to be 1 in the achievement code. You should also change the description to let the student know they earned an item.

Gotchas and Unintended Features

This is a list of things which are a result of how the achievement system is set up and may be counter-intuitive.

  • The achievement items allow students to affect their WeBWorK grade. For example, in a class with approximatelly 200 problems across 30 sets, very good students were able to earn about 10% extra credit. If your class has only a few homework sets or a small number of problems then this effect will be magnified.
  • The achievement items do not always mix well with certain achievements. For example, if a student has completed 4 problems without any incorrect attempts and then has an incorrect submission the achievement item that resets the number of incorrect attempts does not restore their "streak" of completed problems.
follow us