-
-
Notifications
You must be signed in to change notification settings - Fork 166
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1543 from somiaj/achievement-features
Achievement features
- Loading branch information
Showing
28 changed files
with
195 additions
and
33 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
95 changes: 95 additions & 0 deletions
95
courses.dist/modelCourse/templates/achievements/earn_n_achievements.at
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,95 @@ | ||
# This is a "earn n achievements. Notice how we update $counter | ||
# (even though the appropriate data is already given to use in | ||
# $userAchievements) so that the achievement progress bar works correctly. | ||
|
||
# Update counter from $userAchievements. Ignore level achievements. | ||
$counter = 0; | ||
foreach my $key (keys %{ $userAchievements }) { | ||
if ($userAchievements->{$key} && $key !~ /^level/) { | ||
$counter++; | ||
} | ||
} | ||
|
||
if ($counter >= $maxCounter) { | ||
return 1 | ||
} else { | ||
return 0; | ||
} | ||
|
||
|
||
# Variable Descriptions: | ||
# - $problem : the problem data (changes to this variable will not be saved!) | ||
# This variable contains the problem data. It is a hash pointer with the | ||
# following values (not all values shown) | ||
# - $problem->status : the score of the current problem | ||
# - $problem->problem_id : the id of the current problem | ||
# - $problem->set_id : the id of the set containing the problem | ||
# - $problem->num_correct : the number of correct attempts | ||
# - $problem->num_incorrect : the number of incorrect attempts | ||
# - $problem->max_attempts : the maximum number of allowed attempts | ||
# | ||
# - $set : the set data (changes to this variable will not be saved!) | ||
# This variable contains the set data. it is a hash pointer with the | ||
# following values. (not all values shown) | ||
# - $set->open_date : when the set was open | ||
# - $set->due_date : when the set is due | ||
# | ||
# - @setProblems : the problem data for all the problems from this set. | ||
# (changes to this variable will not be saved!) | ||
# This is an array of problem hashes. Each element of the array has the | ||
# save hash keys as the $problem variable above | ||
# | ||
# - $counter : the users counter associated to this achievement | ||
# (changes to this variable *will* be saved!) | ||
# If this achievement has a counter associated to it | ||
# (i.e. solve 20 problems) then this is where you store | ||
# the students counter for this achievement. | ||
# This variable will initally start as '' | ||
# | ||
# - $maxCounter : the goal for the $counter variable for this achievement | ||
# (changes to this variable will not be saved!) | ||
# If this achievement has a counter associated to it then this variable | ||
# contains the goal for the counter. Your achievement should return 1 | ||
# when $counter >= $maxCounter. These two variables are used to show a | ||
# progress bar for the achievement. | ||
# | ||
# - $tags : this contains the metadata for the problem stored in a hash. This includes DBsubject | ||
# DBchapter and DBsection Note: These values are not super stable and are likely to change | ||
# from problem to problem and year to year | ||
# | ||
# - $userAchievements: this hash stores all assigned achievements for | ||
# the current user. The keys are the achievement_id and the values | ||
# are 0 or 1 for if the achievement has been earned. Changes to this | ||
# variable will be accessible by achievements down the line in the | ||
# current evaluation loop, but will not be saved across evaluations. | ||
# Note: This variable is updated if an achievement is earned, | ||
# but only achievements further down the evaluation chain will | ||
# see the update. So when depending on other achievements place | ||
# make sure they are run first. | ||
# | ||
# - $localData : this is a hash which stores data for this user and | ||
# achievement (changes to this variable *will* be saved!) | ||
# This hash will persist from evaluation to evaluation. You can | ||
# store whatever you like in here and it can be accessed next time | ||
# this evaluator is run. Two things to keep in mind. First, The data | ||
# in this hash will *not* be accessible by other achievements. Second, | ||
# the first time a variable is accessed it will have the value ''. | ||
# | ||
# - $globalData : this is a hash which stores data for all achievements | ||
# (changes to this variable *will* be saved!) | ||
# This hash will persist from evaluation to evaluation and, like | ||
# $localData, you can store whatever you like in here. This data | ||
# will be accessable from *every* achievement and is unique to the | ||
# user. There are two variables stored in this hash that are | ||
# maintained by the system. | ||
# - $globalData->completeSets : This is the number of sets which | ||
# the student has earned 100% on | ||
# - $globalData->complete Problems : This is the number of problems | ||
# which the student has earned 100% on | ||
# Warning: The achievements are always evaluated in the order they | ||
# are listed the Instructors achievement editor page. To make matters | ||
# more complicated, achievements which have already been earned are | ||
# not evaluated at all. The up-shot of this is that when modifying | ||
# variables in $globalData you need to either write your code so it | ||
# doesnt matter which order the evaluators are run, or you need to | ||
# pay very close attention to which evaluators are run and when. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.