From 78876df7509ef2e249c213c0e58f26704d01f9ec Mon Sep 17 00:00:00 2001 From: Jaimos Skriletz Date: Thu, 21 May 2026 16:14:10 -0600 Subject: [PATCH] Cleanup modelCourse achievements. Cleanup and update the default achievements in the modelCourse. * Remove the same comment from the bottom of all evaluators. This is hard to maintain, instead put all the information in achievements_readme.txt and point to this file from other evaluators. * Cleanup the achievement evaluators: * Simplify the code, don't use else statements when there was a return inside the previous if. Clean up some of the logic. * Take advantage of the new $globalData->{completedSetIds} hash to avoid looping through all problems to determine if a set is completed. * Ran perltidy on them using an 80 character limit. * Remove some evaluator duplication. The complete n problems or n sets can all be done using a single evaluator, since the only difference is the $maxCounter setting from the achievement. * Remove all unused achievement evaluators. There are lots of these that are really just the same example achievement over and over again to see if particular problems from particular sets were completed. The images are still available for helping people think of names, but the evaluators don't need to be included. Instead provide four example evaluators for completing specific problems and/or sets. * Add perltidy of .at achievement files to the run-perltidy dev_script and the github workflow. --- .github/workflows/check-formats.yml | 2 +- bin/dev_scripts/run-perltidy.pl | 2 +- .../{persistance.png => persistence.png} | Bin ..._persistance.png => super_persistence.png} | Bin .../achievements/achievement_readme.txt | 201 ++++++++++-------- .../templates/achievements/add_anything.at | 88 -------- .../templates/achievements/back_for_more.at | 104 ++------- .../achievements/blankachievement.at | 78 ------- .../templates/achievements/by_definition.at | 88 -------- .../templates/achievements/challenge_eight.at | 105 ++------- .../templates/achievements/challenge_five.at | 105 ++------- .../templates/achievements/challenge_four.at | 105 ++------- .../templates/achievements/challenge_nine.at | 105 ++------- .../templates/achievements/challenge_one.at | 105 ++------- .../templates/achievements/challenge_seven.at | 105 ++------- .../templates/achievements/challenge_six.at | 105 ++------- .../templates/achievements/challenge_ten.at | 105 ++------- .../templates/achievements/challenge_three.at | 105 ++------- .../templates/achievements/challenge_two.at | 105 ++------- .../templates/achievements/challenger.at | 85 +------- .../achievements/change_of_variables.at | 88 -------- .../templates/achievements/chipping_away.at | 90 +------- .../achievements/complete_100_problems.at | 78 ------- .../achievements/complete_10_problems.at | 78 ------- .../achievements/complete_150_problems.at | 78 ------- .../achievements/complete_25_problems.at | 78 ------- .../achievements/complete_50_problems.at | 78 ------- .../achievements/complete_all_sets.at | 78 ------- .../achievements/complete_five_sets.at | 78 ------- .../achievements/complete_n_problems.at | 11 + .../templates/achievements/complete_n_sets.at | 11 + .../achievements/complete_one_problem.at | 76 ------- .../achievements/complete_one_set.at | 74 ------- .../achievements/complete_ten_sets.at | 78 ------- .../achievements/complete_thirty_sets.at | 78 ------- .../achievements/complete_twenty_sets.at | 78 ------- .../templates/achievements/crack_o_dawn.at | 99 +-------- .../templates/achievements/curvature.at | 88 -------- .../templates/achievements/curvy_geometry.at | 89 -------- .../achievements/default_achievements.axp | 32 +-- .../achievements/derivative_master.at | 92 -------- .../achievements/doing_it_backwards.at | 93 -------- .../templates/achievements/double_integral.at | 92 -------- .../templates/achievements/early_bird.at | 88 +------- .../achievements/earn_n_achievements.at | 100 +-------- .../example_complete_n_specific_problems.at | 35 +++ .../example_complete_n_specific_sets.at | 15 ++ .../example_complete_specific_problem.at | 26 +++ .../example_complete_specific_set.at | 11 + .../templates/achievements/extensions.at | 15 +- .../templates/achievements/heart_area.at | 88 -------- .../achievements/hows_your_finger.at | 79 +------ .../templates/achievements/integral_master.at | 92 -------- .../achievements/its_all_relative.at | 88 -------- .../templates/achievements/la_revolucion.at | 88 -------- .../achievements/lagrange_multipliers.at | 88 -------- .../templates/achievements/last_minute.at | 94 +------- .../templates/achievements/level_eight.at | 95 ++------- .../templates/achievements/level_five.at | 95 ++------- .../templates/achievements/level_four.at | 95 ++------- .../templates/achievements/level_nine.at | 95 ++------- .../templates/achievements/level_one.at | 95 ++------- .../templates/achievements/level_seven.at | 95 ++------- .../templates/achievements/level_six.at | 95 ++------- .../templates/achievements/level_ten.at | 95 ++------- .../templates/achievements/level_three.at | 95 ++------- .../templates/achievements/level_two.at | 95 ++------- .../templates/achievements/line_integrals.at | 91 -------- .../achievements/lines_and_planes.at | 96 --------- .../templates/achievements/many_fractions.at | 88 -------- .../achievements/n_correct_in_a_row.at | 18 ++ .../templates/achievements/night_owl.at | 98 +-------- .../templates/achievements/on_fire.at | 86 -------- .../templates/achievements/on_one_hand.at | 92 ++------ .../templates/achievements/on_the_hour.at | 87 +------- .../templates/achievements/one_click.at | 80 +------ .../templates/achievements/optimizer_prime.at | 88 -------- .../achievements/partial_derivatives.at | 94 -------- .../achievements/pattern_recognition.at | 88 -------- .../templates/achievements/persistence.at | 85 +------- .../templates/achievements/preamble.at | 4 + .../templates/achievements/put_me_in_coach.at | 92 -------- .../achievements/reaching_a_limit.at | 93 -------- .../achievements/really_early_bird.at | 88 +------- .../achievements/revolucion_redux.at | 88 -------- .../templates/achievements/seeing_green.at | 95 ++------- .../templates/achievements/speed_mather.at | 100 +-------- .../templates/achievements/still_not_right.at | 112 +++------- .../achievements/super_persistence.at | 85 +------- .../achievements/super_speed_math.at | 100 +-------- .../templates/achievements/tangent_plane.at | 88 -------- .../templates/achievements/taylor_hero.at | 88 -------- .../achievements/the_fundamentals.at | 88 -------- .../templates/achievements/the_lhopital.at | 88 -------- .../templates/achievements/third_time.at | 82 +------ .../templates/achievements/three_in_a_row.at | 86 -------- .../templates/achievements/to_infinity.at | 88 -------- .../templates/achievements/trig_ninja.at | 88 -------- .../templates/achievements/triple_integral.at | 92 -------- .../templates/achievements/vector_fields.at | 92 -------- 100 files changed, 817 insertions(+), 7281 deletions(-) rename courses.dist/modelCourse/html/achievements/{persistance.png => persistence.png} (100%) rename courses.dist/modelCourse/html/achievements/{super_persistance.png => super_persistence.png} (100%) delete mode 100644 courses.dist/modelCourse/templates/achievements/add_anything.at delete mode 100644 courses.dist/modelCourse/templates/achievements/blankachievement.at delete mode 100644 courses.dist/modelCourse/templates/achievements/by_definition.at delete mode 100644 courses.dist/modelCourse/templates/achievements/change_of_variables.at delete mode 100644 courses.dist/modelCourse/templates/achievements/complete_100_problems.at delete mode 100644 courses.dist/modelCourse/templates/achievements/complete_10_problems.at delete mode 100644 courses.dist/modelCourse/templates/achievements/complete_150_problems.at delete mode 100644 courses.dist/modelCourse/templates/achievements/complete_25_problems.at delete mode 100644 courses.dist/modelCourse/templates/achievements/complete_50_problems.at delete mode 100644 courses.dist/modelCourse/templates/achievements/complete_all_sets.at delete mode 100644 courses.dist/modelCourse/templates/achievements/complete_five_sets.at create mode 100644 courses.dist/modelCourse/templates/achievements/complete_n_problems.at create mode 100644 courses.dist/modelCourse/templates/achievements/complete_n_sets.at delete mode 100644 courses.dist/modelCourse/templates/achievements/complete_one_problem.at delete mode 100644 courses.dist/modelCourse/templates/achievements/complete_one_set.at delete mode 100644 courses.dist/modelCourse/templates/achievements/complete_ten_sets.at delete mode 100644 courses.dist/modelCourse/templates/achievements/complete_thirty_sets.at delete mode 100644 courses.dist/modelCourse/templates/achievements/complete_twenty_sets.at delete mode 100644 courses.dist/modelCourse/templates/achievements/curvature.at delete mode 100644 courses.dist/modelCourse/templates/achievements/curvy_geometry.at delete mode 100644 courses.dist/modelCourse/templates/achievements/derivative_master.at delete mode 100644 courses.dist/modelCourse/templates/achievements/doing_it_backwards.at delete mode 100644 courses.dist/modelCourse/templates/achievements/double_integral.at create mode 100644 courses.dist/modelCourse/templates/achievements/example_complete_n_specific_problems.at create mode 100644 courses.dist/modelCourse/templates/achievements/example_complete_n_specific_sets.at create mode 100644 courses.dist/modelCourse/templates/achievements/example_complete_specific_problem.at create mode 100644 courses.dist/modelCourse/templates/achievements/example_complete_specific_set.at delete mode 100644 courses.dist/modelCourse/templates/achievements/heart_area.at delete mode 100644 courses.dist/modelCourse/templates/achievements/integral_master.at delete mode 100644 courses.dist/modelCourse/templates/achievements/its_all_relative.at delete mode 100644 courses.dist/modelCourse/templates/achievements/la_revolucion.at delete mode 100644 courses.dist/modelCourse/templates/achievements/lagrange_multipliers.at delete mode 100644 courses.dist/modelCourse/templates/achievements/line_integrals.at delete mode 100644 courses.dist/modelCourse/templates/achievements/lines_and_planes.at delete mode 100644 courses.dist/modelCourse/templates/achievements/many_fractions.at create mode 100644 courses.dist/modelCourse/templates/achievements/n_correct_in_a_row.at delete mode 100644 courses.dist/modelCourse/templates/achievements/on_fire.at delete mode 100644 courses.dist/modelCourse/templates/achievements/optimizer_prime.at delete mode 100644 courses.dist/modelCourse/templates/achievements/partial_derivatives.at delete mode 100644 courses.dist/modelCourse/templates/achievements/pattern_recognition.at delete mode 100644 courses.dist/modelCourse/templates/achievements/put_me_in_coach.at delete mode 100644 courses.dist/modelCourse/templates/achievements/reaching_a_limit.at delete mode 100644 courses.dist/modelCourse/templates/achievements/revolucion_redux.at delete mode 100644 courses.dist/modelCourse/templates/achievements/tangent_plane.at delete mode 100644 courses.dist/modelCourse/templates/achievements/taylor_hero.at delete mode 100644 courses.dist/modelCourse/templates/achievements/the_fundamentals.at delete mode 100644 courses.dist/modelCourse/templates/achievements/the_lhopital.at delete mode 100644 courses.dist/modelCourse/templates/achievements/three_in_a_row.at delete mode 100644 courses.dist/modelCourse/templates/achievements/to_infinity.at delete mode 100644 courses.dist/modelCourse/templates/achievements/trig_ninja.at delete mode 100644 courses.dist/modelCourse/templates/achievements/triple_integral.at delete mode 100644 courses.dist/modelCourse/templates/achievements/vector_fields.at diff --git a/.github/workflows/check-formats.yml b/.github/workflows/check-formats.yml index 092dabe309..734176e44f 100644 --- a/.github/workflows/check-formats.yml +++ b/.github/workflows/check-formats.yml @@ -26,7 +26,7 @@ jobs: run: | git config --global --add safe.directory "$GITHUB_WORKSPACE" shopt -s extglob globstar nullglob - perltidy --pro=./.perltidyrc -b -bext='/' ./**/*.p[lm] ./**/*.t && git diff --exit-code + perltidy --pro=./.perltidyrc -b -bext='/' ./**/*.p[lm] ./**/*.t ./**/*.at && git diff --exit-code prettier: name: Check JavaScript, style, and HTML file formatting with prettier diff --git a/bin/dev_scripts/run-perltidy.pl b/bin/dev_scripts/run-perltidy.pl index 02eb677058..01dd097927 100755 --- a/bin/dev_scripts/run-perltidy.pl +++ b/bin/dev_scripts/run-perltidy.pl @@ -91,7 +91,7 @@ =head1 OPTIONS return; } - return unless $path =~ /\.p[lm]$/ || $path =~ /\.t$/; + return unless $path =~ /\.p[lm]$/ || $path =~ /\.t$/ || $path =~ /\.at$/; say "Tidying file: $path" if $verbose; diff --git a/courses.dist/modelCourse/html/achievements/persistance.png b/courses.dist/modelCourse/html/achievements/persistence.png similarity index 100% rename from courses.dist/modelCourse/html/achievements/persistance.png rename to courses.dist/modelCourse/html/achievements/persistence.png diff --git a/courses.dist/modelCourse/html/achievements/super_persistance.png b/courses.dist/modelCourse/html/achievements/super_persistence.png similarity index 100% rename from courses.dist/modelCourse/html/achievements/super_persistance.png rename to courses.dist/modelCourse/html/achievements/super_persistence.png diff --git a/courses.dist/modelCourse/templates/achievements/achievement_readme.txt b/courses.dist/modelCourse/templates/achievements/achievement_readme.txt index a650312914..302168d49f 100644 --- a/courses.dist/modelCourse/templates/achievements/achievement_readme.txt +++ b/courses.dist/modelCourse/templates/achievements/achievement_readme.txt @@ -1,89 +1,112 @@ - This folder contains achievement evaluators. Their job is to test - whether or not an achievement has been earned. The code is run every time a - student submits an answer to a homework question as long as the achievement - is unearned. - - -The code should be written in perl and should return 1 if the achievement - was earned and 0 if it was not earned. - - -Any perl code in preamble.at will be run before the content of any - achievement evaluator. - - You have access to a variety of variables: - - $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 initially 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 accessible from *every* achievement and is unique to the - user. There are three 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 - - $globalData->prev_level_points : This is the number of points - to reach current level which is used with level progress bar. - 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 - doesn't matter which order the evaluators are run, or you need to - pay very close attention to which evaluators are run and when. +This folder contains achievement evaluators. Their job is to test +whether or not an achievement has been earned. The code is run every +time a student submits an answer to a homework question as long as the +achievement is assigned and unearned. Since this is run after every +submit, keep the computations simple and quick. + +The code should be written in perl and should return 1 if the achievement +was earned and 0 if it was not earned. + +Any perl code in preamble.at will be run before the content of any +achievement evaluator. + +You have access to a variety of variables: + +$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 between 0 and 1. + - $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 current 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 + initially start as the empty string ''. + +$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, and + the $maxConunter can be configured in the achievement manager. + +$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 accessible from *every* achievement and is unique to + the user. There are three variables stored in this hash that are + maintained by the system and should not be modified. + - $globalData->{completeSets}: + This is the number of sets which the student has earned 100% on. + - $globalData->{completedSetIds}: + This is a hash of all set ids which the student has earned 100% on. + - $globalData->{completeProblems}: + This is the number of problems which the student has earned 100% on. + - $globalData->{prev_level_points}: + This is the number of points to reach current level which is used + with level progress bar. + + The $globalData hash also contains information about the number of + achievement items a student currently has. To award an achievement + item, increase the count of the particular item in the $globalData hash. + + Warning!! The achievements are always evaluated in the order they are + listed in 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 doesn't matter + which order the evaluators are run, or you need to pay very close + attention to which evaluators are run and when. + +@courseDateTime: + An array of time information in the course timezone. The array lists + the current time as (sec, min, hour, day, month, year, day_of_week) + as produced by https://metacpan.org/pod/DateTime + diff --git a/courses.dist/modelCourse/templates/achievements/add_anything.at b/courses.dist/modelCourse/templates/achievements/add_anything.at deleted file mode 100644 index f67a5042f2..0000000000 --- a/courses.dist/modelCourse/templates/achievements/add_anything.at +++ /dev/null @@ -1,88 +0,0 @@ -#This problem checks to see if a particular problem from a list of valid -# sets and problems has been solved. (You would edit this file to say which -# sets and problems count.) - -#constants -my %validproblems = ( - 'SetNameHere' => { #now you show which problems are valid like: - '2' => 1, - '1' => 1, }, #and put more sets here - ); - -#check and see if this problem was solved -if ($validproblems{$problem->set_id} && - $validproblems{$problem->set_id}{$problem->problem_id} && - $problem->status == 1 && - $problem->num_correct == 1) { - return 1; - } - - return 0; - - -# -You have access to a variety of variables: -# - $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->last_answer : the last answer submitted -# - $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 -# -# - $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. The data in this hash will *not* be accessable -# by other achievements. If you plan to store something in this hash you have -# to write code to initialize the data. -# -# - $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. Like $localData, you need to -# initialize any variable you plan on using in this hash. 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->{completeProblems} : 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 -# on 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 in, or you need to pay very close attention -# to which evaluators are run and when. diff --git a/courses.dist/modelCourse/templates/achievements/back_for_more.at b/courses.dist/modelCourse/templates/achievements/back_for_more.at index 9029d5c866..0b4f247007 100644 --- a/courses.dist/modelCourse/templates/achievements/back_for_more.at +++ b/courses.dist/modelCourse/templates/achievements/back_for_more.at @@ -1,88 +1,26 @@ -#This checks to see if the student has worked on one problem after -# an eight hour break - -# initialize the time thing +# This achievement is awarded if a student has worked on one problem after +# an eight hour break. Uses $localData to save last attempt time. +# +# See [templates]/achievements/achievement_readme.txt for details. -$localData->{lastattempttime} = time() unless $localData->{lastattempttime}; +# Initialize saved $localData for this achievement. +$localData->{lastattempttime} //= time; +$localData->{lastset} //= ''; +$localData->{lastproblem} //= ''; -# check to see if problem was already previously finished, or if they started -# a different problem -# or if the time interval isn't long enough. -if ($problem->num_correct > 1 || - $problem->set_id ne $localData->{lastset} || - $problem->problem_id ne $localData->{lastproblem} || - abs($localData->{lastattempttime} - time()) < 28800 ){ - $localData->{lastattempttime} = time(); - $localData->{lastset} = $problem->set_id; - $localData->{lastproblem} = $problem->problem_id; +# Checks to see if problem was already previously finished, if they started +# a different problem, or if the time interval isn't long enough. +# Eight hours = 8 * 60 * 60 = 28800 seconds. +if ($problem->num_correct > 1 + || $problem->set_id ne $localData->{lastset} + || $problem->problem_id ne $localData->{lastproblem} + || abs($localData->{lastattempttime} - time) < 28800) +{ + $localData->{lastattempttime} = time; + $localData->{lastset} = $problem->set_id; + $localData->{lastproblem} = $problem->problem_id; return 0; -} else { - return 1; } -# -You have access to a variety of variables: -# - $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->last_answer : the last answer submitted -# - $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 -# -# - $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. The data in this hash will *not* be accessable -# by other achievements. If you plan to store something in this hash you have -# to write code to initialize the data. -# -# - $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. Like $localData, you need to -# initialize any variable you plan on using in this hash. 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->{completeProblems} : 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 -# on 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 in, or you need to pay very close attention -# to which evaluators are run and when. +# Check failed so they are back after eight hours, award achievement. +return 1; diff --git a/courses.dist/modelCourse/templates/achievements/blankachievement.at b/courses.dist/modelCourse/templates/achievements/blankachievement.at deleted file mode 100644 index 6a75408bf6..0000000000 --- a/courses.dist/modelCourse/templates/achievements/blankachievement.at +++ /dev/null @@ -1,78 +0,0 @@ -# This is an "Achievement Evaluator". Its basic job is to test, or evaluate, -# whether or not an achievement has been earned. The code is run every time a -# student submits an answer to a homework question as long as the achievement -# is unearned. -# -# -The code should be written in perl and should return 1 if the achievement -# was earned and 0 if it was not earned. -# -# You have access to a variety of variables: -# - $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 -# -# - $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. - - -#the blank achievement can never be earned -return 0; diff --git a/courses.dist/modelCourse/templates/achievements/by_definition.at b/courses.dist/modelCourse/templates/achievements/by_definition.at deleted file mode 100644 index f67a5042f2..0000000000 --- a/courses.dist/modelCourse/templates/achievements/by_definition.at +++ /dev/null @@ -1,88 +0,0 @@ -#This problem checks to see if a particular problem from a list of valid -# sets and problems has been solved. (You would edit this file to say which -# sets and problems count.) - -#constants -my %validproblems = ( - 'SetNameHere' => { #now you show which problems are valid like: - '2' => 1, - '1' => 1, }, #and put more sets here - ); - -#check and see if this problem was solved -if ($validproblems{$problem->set_id} && - $validproblems{$problem->set_id}{$problem->problem_id} && - $problem->status == 1 && - $problem->num_correct == 1) { - return 1; - } - - return 0; - - -# -You have access to a variety of variables: -# - $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->last_answer : the last answer submitted -# - $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 -# -# - $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. The data in this hash will *not* be accessable -# by other achievements. If you plan to store something in this hash you have -# to write code to initialize the data. -# -# - $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. Like $localData, you need to -# initialize any variable you plan on using in this hash. 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->{completeProblems} : 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 -# on 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 in, or you need to pay very close attention -# to which evaluators are run and when. diff --git a/courses.dist/modelCourse/templates/achievements/challenge_eight.at b/courses.dist/modelCourse/templates/achievements/challenge_eight.at index e7219912f6..9cd92ee6c0 100644 --- a/courses.dist/modelCourse/templates/achievements/challenge_eight.at +++ b/courses.dist/modelCourse/templates/achievements/challenge_eight.at @@ -1,88 +1,23 @@ -#This evaluator checks to see if a particular problem of a particular set has -# been solved - -#constants -my %validproblems = ( - 'Challenge' => { - '8' => 1, } - ); - -#check and see if this problem was solved -if ($validproblems{$problem->set_id} && - $validproblems{$problem->set_id}{$problem->problem_id} && - $problem->status == 1 && - $problem->num_correct == 1) { - #update challenger counter - $globalData->{challengerCounter}++; - return 1; - } +# This achievement checks to see if a particular challenge problem of a +# particular set has been solved. It updates $globalData->{challengerCounter} +# to be used with the challenger.at achievement. +# +# See [templates]/achievements/achievement_readme.txt for details. - return 0; +# Create a hash of all valid set id and problem numbers. +# Set names (ids) are keys, and each is a hash of valid +# problem numbers. Use "_" for spaces in set ids. +my %validproblems = ('Challenge' => { '8' => 1 }); +# Checks to see if a valid problem was solved. +if ($validproblems{ $problem->set_id } + && $validproblems{ $problem->set_id }{ $problem->problem_id } + && $problem->status == 1 + && $problem->num_correct == 1) +{ + # Update challenger counter. + ++$globalData->{challengerCounter}; + return 1; +} -# -You have access to a variety of variables: -# - $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->last_answer : the last answer submitted -# - $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 -# -# - $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. The data in this hash will *not* be accessable -# by other achievements. If you plan to store something in this hash you have -# to write code to initialize the data. -# -# - $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. Like $localData, you need to -# initialize any variable you plan on using in this hash. 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->{completeProblems} : 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 -# on 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 in, or you need to pay very close attention -# to which evaluators are run and when. +return 0; diff --git a/courses.dist/modelCourse/templates/achievements/challenge_five.at b/courses.dist/modelCourse/templates/achievements/challenge_five.at index 146e91dbc7..c851aa0557 100644 --- a/courses.dist/modelCourse/templates/achievements/challenge_five.at +++ b/courses.dist/modelCourse/templates/achievements/challenge_five.at @@ -1,88 +1,23 @@ -#This evaluator checks to see if a particular problem of a particular set has -# been solved - -#constants -my %validproblems = ( - 'Challenge' => { - '5' => 1, } - ); - -#check and see if this problem was solved -if ($validproblems{$problem->set_id} && - $validproblems{$problem->set_id}{$problem->problem_id} && - $problem->status == 1 && - $problem->num_correct == 1) { - #update challenger counter - $globalData->{challengerCounter}++; - return 1; - } +# This achievement checks to see if a particular challenge problem of a +# particular set has been solved. It updates $globalData->{challengerCounter} +# to be used with the challenger.at achievement. +# +# See [templates]/achievements/achievement_readme.txt for details. - return 0; +# Create a hash of all valid set id and problem numbers. +# Set names (ids) are keys, and each is a hash of valid +# problem numbers. Use "_" for spaces in set ids. +my %validproblems = ('Challenge' => { '5' => 1 }); +# Checks to see if a valid problem was solved. +if ($validproblems{ $problem->set_id } + && $validproblems{ $problem->set_id }{ $problem->problem_id } + && $problem->status == 1 + && $problem->num_correct == 1) +{ + # Update challenger counter. + ++$globalData->{challengerCounter}; + return 1; +} -# -You have access to a variety of variables: -# - $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->last_answer : the last answer submitted -# - $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 -# -# - $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. The data in this hash will *not* be accessable -# by other achievements. If you plan to store something in this hash you have -# to write code to initialize the data. -# -# - $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. Like $localData, you need to -# initialize any variable you plan on using in this hash. 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->{completeProblems} : 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 -# on 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 in, or you need to pay very close attention -# to which evaluators are run and when. +return 0; diff --git a/courses.dist/modelCourse/templates/achievements/challenge_four.at b/courses.dist/modelCourse/templates/achievements/challenge_four.at index ccc1156652..1aec62f824 100644 --- a/courses.dist/modelCourse/templates/achievements/challenge_four.at +++ b/courses.dist/modelCourse/templates/achievements/challenge_four.at @@ -1,88 +1,23 @@ -#This evaluator checks to see if a particular problem of a particular set has -# been solved - -#constants -my %validproblems = ( - 'Challenge' => { - '4' => 1, } - ); - -#check and see if this problem was solved -if ($validproblems{$problem->set_id} && - $validproblems{$problem->set_id}{$problem->problem_id} && - $problem->status == 1 && - $problem->num_correct == 1) { - #update challenger counter - $globalData->{challengerCounter}++; - return 1; - } +# This achievement checks to see if a particular challenge problem of a +# particular set has been solved. It updates $globalData->{challengerCounter} +# to be used with the challenger.at achievement. +# +# See [templates]/achievements/achievement_readme.txt for details. - return 0; +# Create a hash of all valid set id and problem numbers. +# Set names (ids) are keys, and each is a hash of valid +# problem numbers. Use "_" for spaces in set ids. +my %validproblems = ('Challenge' => { '4' => 1 }); +# Checks to see if a valid problem was solved. +if ($validproblems{ $problem->set_id } + && $validproblems{ $problem->set_id }{ $problem->problem_id } + && $problem->status == 1 + && $problem->num_correct == 1) +{ + # Update challenger counter. + ++$globalData->{challengerCounter}; + return 1; +} -# -You have access to a variety of variables: -# - $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->last_answer : the last answer submitted -# - $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 -# -# - $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. The data in this hash will *not* be accessable -# by other achievements. If you plan to store something in this hash you have -# to write code to initialize the data. -# -# - $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. Like $localData, you need to -# initialize any variable you plan on using in this hash. 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->{completeProblems} : 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 -# on 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 in, or you need to pay very close attention -# to which evaluators are run and when. +return 0; diff --git a/courses.dist/modelCourse/templates/achievements/challenge_nine.at b/courses.dist/modelCourse/templates/achievements/challenge_nine.at index 83cb7a84ae..9373d0f911 100644 --- a/courses.dist/modelCourse/templates/achievements/challenge_nine.at +++ b/courses.dist/modelCourse/templates/achievements/challenge_nine.at @@ -1,88 +1,23 @@ -#This evaluator checks to see if a particular problem of a particular set has -# been solved - -#constants -my %validproblems = ( - 'Challenge' => { - '9' => 1, } - ); - -#check and see if this problem was solved -if ($validproblems{$problem->set_id} && - $validproblems{$problem->set_id}{$problem->problem_id} && - $problem->status == 1 && - $problem->num_correct == 1) { - #update challenger counter - $globalData->{challengerCounter}++; - return 1; - } +# This achievement checks to see if a particular challenge problem of a +# particular set has been solved. It updates $globalData->{challengerCounter} +# to be used with the challenger.at achievement. +# +# See [templates]/achievements/achievement_readme.txt for details. - return 0; +# Create a hash of all valid set id and problem numbers. +# Set names (ids) are keys, and each is a hash of valid +# problem numbers. Use "_" for spaces in set ids. +my %validproblems = ('Challenge' => { '9' => 1 }); +# Checks to see if a valid problem was solved. +if ($validproblems{ $problem->set_id } + && $validproblems{ $problem->set_id }{ $problem->problem_id } + && $problem->status == 1 + && $problem->num_correct == 1) +{ + # Update challenger counter. + ++$globalData->{challengerCounter}; + return 1; +} -# -You have access to a variety of variables: -# - $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->last_answer : the last answer submitted -# - $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 -# -# - $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. The data in this hash will *not* be accessable -# by other achievements. If you plan to store something in this hash you have -# to write code to initialize the data. -# -# - $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. Like $localData, you need to -# initialize any variable you plan on using in this hash. 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->{completeProblems} : 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 -# on 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 in, or you need to pay very close attention -# to which evaluators are run and when. +return 0; diff --git a/courses.dist/modelCourse/templates/achievements/challenge_one.at b/courses.dist/modelCourse/templates/achievements/challenge_one.at index 321e231fb2..71985b4144 100644 --- a/courses.dist/modelCourse/templates/achievements/challenge_one.at +++ b/courses.dist/modelCourse/templates/achievements/challenge_one.at @@ -1,88 +1,23 @@ -#This problem checks to see if a particular problem of a particular set has -# been solved - -#constants -my %validproblems = ( - 'Challenge' => { - '1' => 1, } - ); - -#check and see if this problem was solved -if ($validproblems{$problem->set_id} && - $validproblems{$problem->set_id}{$problem->problem_id} && - $problem->status == 1 && - $problem->num_correct == 1) { - #update challenger counter - $globalData->{challengerCounter}++; - return 1; - } +# This achievement checks to see if a particular challenge problem of a +# particular set has been solved. It updates $globalData->{challengerCounter} +# to be used with the challenger.at achievement. +# +# See [templates]/achievements/achievement_readme.txt for details. - return 0; +# Create a hash of all valid set id and problem numbers. +# Set names (ids) are keys, and each is a hash of valid +# problem numbers. Use "_" for spaces in set ids. +my %validproblems = ('Challenge' => { '1' => 1 }); +# Checks to see if a valid problem was solved. +if ($validproblems{ $problem->set_id } + && $validproblems{ $problem->set_id }{ $problem->problem_id } + && $problem->status == 1 + && $problem->num_correct == 1) +{ + # Update challenger counter. + ++$globalData->{challengerCounter}; + return 1; +} -# -You have access to a variety of variables: -# - $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->last_answer : the last answer submitted -# - $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 -# -# - $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. The data in this hash will *not* be accessable -# by other achievements. If you plan to store something in this hash you have -# to write code to initialize the data. -# -# - $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. Like $localData, you need to -# initialize any variable you plan on using in this hash. 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->{completeProblems} : 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 -# on 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 in, or you need to pay very close attention -# to which evaluators are run and when. +return 0; diff --git a/courses.dist/modelCourse/templates/achievements/challenge_seven.at b/courses.dist/modelCourse/templates/achievements/challenge_seven.at index edf923ec6d..b40ebac567 100644 --- a/courses.dist/modelCourse/templates/achievements/challenge_seven.at +++ b/courses.dist/modelCourse/templates/achievements/challenge_seven.at @@ -1,88 +1,23 @@ -#This evaluator checks to see if a particular problem of a particular set has -# been solved - -#constants -my %validproblems = ( - 'Challenge' => { - '7' => 1, } - ); - -#check and see if this problem was solved -if ($validproblems{$problem->set_id} && - $validproblems{$problem->set_id}{$problem->problem_id} && - $problem->status == 1 && - $problem->num_correct == 1) { - #update challenger counter - $globalData->{challengerCounter}++; - return 1; - } +# This achievement checks to see if a particular challenge problem of a +# particular set has been solved. It updates $globalData->{challengerCounter} +# to be used with the challenger.at achievement. +# +# See [templates]/achievements/achievement_readme.txt for details. - return 0; +# Create a hash of all valid set id and problem numbers. +# Set names (ids) are keys, and each is a hash of valid +# problem numbers. Use "_" for spaces in set ids. +my %validproblems = ('Challenge' => { '7' => 1 }); +# Checks to see if a valid problem was solved. +if ($validproblems{ $problem->set_id } + && $validproblems{ $problem->set_id }{ $problem->problem_id } + && $problem->status == 1 + && $problem->num_correct == 1) +{ + # Update challenger counter. + ++$globalData->{challengerCounter}; + return 1; +} -# -You have access to a variety of variables: -# - $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->last_answer : the last answer submitted -# - $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 -# -# - $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. The data in this hash will *not* be accessable -# by other achievements. If you plan to store something in this hash you have -# to write code to initialize the data. -# -# - $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. Like $localData, you need to -# initialize any variable you plan on using in this hash. 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->{completeProblems} : 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 -# on 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 in, or you need to pay very close attention -# to which evaluators are run and when. +return 0; diff --git a/courses.dist/modelCourse/templates/achievements/challenge_six.at b/courses.dist/modelCourse/templates/achievements/challenge_six.at index de50931fcc..de6984c2ac 100644 --- a/courses.dist/modelCourse/templates/achievements/challenge_six.at +++ b/courses.dist/modelCourse/templates/achievements/challenge_six.at @@ -1,88 +1,23 @@ -#This evaluator checks to see if a particular problem of a particular set has -# been solved - -#constants -my %validproblems = ( - 'Challenge' => { - '6' => 1, } - ); - -#check and see if this problem was solved -if ($validproblems{$problem->set_id} && - $validproblems{$problem->set_id}{$problem->problem_id} && - $problem->status == 1 && - $problem->num_correct == 1) { - #update challenger counter - $globalData->{challengerCounter}++; - return 1; - } +# This achievement checks to see if a particular challenge problem of a +# particular set has been solved. It updates $globalData->{challengerCounter} +# to be used with the challenger.at achievement. +# +# See [templates]/achievements/achievement_readme.txt for details. - return 0; +# Create a hash of all valid set id and problem numbers. +# Set names (ids) are keys, and each is a hash of valid +# problem numbers. Use "_" for spaces in set ids. +my %validproblems = ('Challenge' => { '6' => 1 }); +# Checks to see if a valid problem was solved. +if ($validproblems{ $problem->set_id } + && $validproblems{ $problem->set_id }{ $problem->problem_id } + && $problem->status == 1 + && $problem->num_correct == 1) +{ + # Update challenger counter. + ++$globalData->{challengerCounter}; + return 1; +} -# -You have access to a variety of variables: -# - $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->last_answer : the last answer submitted -# - $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 -# -# - $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. The data in this hash will *not* be accessable -# by other achievements. If you plan to store something in this hash you have -# to write code to initialize the data. -# -# - $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. Like $localData, you need to -# initialize any variable you plan on using in this hash. 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->{completeProblems} : 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 -# on 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 in, or you need to pay very close attention -# to which evaluators are run and when. +return 0; diff --git a/courses.dist/modelCourse/templates/achievements/challenge_ten.at b/courses.dist/modelCourse/templates/achievements/challenge_ten.at index 7f023fd35d..c0dea6aab2 100644 --- a/courses.dist/modelCourse/templates/achievements/challenge_ten.at +++ b/courses.dist/modelCourse/templates/achievements/challenge_ten.at @@ -1,88 +1,23 @@ -#This evaluator checks to see if a particular problem of a particular set has -# been solved - -#constants -my %validproblems = ( - 'Challenge' => { - '10' => 1, } - ); - -#check and see if this problem was solved -if ($validproblems{$problem->set_id} && - $validproblems{$problem->set_id}{$problem->problem_id} && - $problem->status == 1 && - $problem->num_correct == 1) { - #update challenger counter - $globalData->{challengerCounter}++; - return 1; - } +# This achievement checks to see if a particular challenge problem of a +# particular set has been solved. It updates $globalData->{challengerCounter} +# to be used with the challenger.at achievement. +# +# See [templates]/achievements/achievement_readme.txt for details. - return 0; +# Create a hash of all valid set id and problem numbers. +# Set names (ids) are keys, and each is a hash of valid +# problem numbers. Use "_" for spaces in set ids. +my %validproblems = ('Challenge' => { '10' => 1 }); +# Checks to see if a valid problem was solved. +if ($validproblems{ $problem->set_id } + && $validproblems{ $problem->set_id }{ $problem->problem_id } + && $problem->status == 1 + && $problem->num_correct == 1) +{ + # Update challenger counter. + ++$globalData->{challengerCounter}; + return 1; +} -# -You have access to a variety of variables: -# - $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->last_answer : the last answer submitted -# - $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 -# -# - $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. The data in this hash will *not* be accessable -# by other achievements. If you plan to store something in this hash you have -# to write code to initialize the data. -# -# - $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. Like $localData, you need to -# initialize any variable you plan on using in this hash. 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->{completeProblems} : 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 -# on 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 in, or you need to pay very close attention -# to which evaluators are run and when. +return 0; diff --git a/courses.dist/modelCourse/templates/achievements/challenge_three.at b/courses.dist/modelCourse/templates/achievements/challenge_three.at index ce01758b98..5d8e711025 100644 --- a/courses.dist/modelCourse/templates/achievements/challenge_three.at +++ b/courses.dist/modelCourse/templates/achievements/challenge_three.at @@ -1,88 +1,23 @@ -#This evaluator checks to see if a particular problem of a particular set has -# been solved - -#constants -my %validproblems = ( - 'Challenge' => { - '3' => 1, } - ); - -#check and see if this problem was solved -if ($validproblems{$problem->set_id} && - $validproblems{$problem->set_id}{$problem->problem_id} && - $problem->status == 1 && - $problem->num_correct == 1) { - #update challenger counter - $globalData->{challengerCounter}++; - return 1; - } +# This achievement checks to see if a particular challenge problem of a +# particular set has been solved. It updates $globalData->{challengerCounter} +# to be used with the challenger.at achievement. +# +# See [templates]/achievements/achievement_readme.txt for details. - return 0; +# Create a hash of all valid set id and problem numbers. +# Set names (ids) are keys, and each is a hash of valid +# problem numbers. Use "_" for spaces in set ids. +my %validproblems = ('Challenge' => { '3' => 1 }); +# Checks to see if a valid problem was solved. +if ($validproblems{ $problem->set_id } + && $validproblems{ $problem->set_id }{ $problem->problem_id } + && $problem->status == 1 + && $problem->num_correct == 1) +{ + # Update challenger counter. + ++$globalData->{challengerCounter}; + return 1; +} -# -You have access to a variety of variables: -# - $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->last_answer : the last answer submitted -# - $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 -# -# - $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. The data in this hash will *not* be accessable -# by other achievements. If you plan to store something in this hash you have -# to write code to initialize the data. -# -# - $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. Like $localData, you need to -# initialize any variable you plan on using in this hash. 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->{completeProblems} : 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 -# on 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 in, or you need to pay very close attention -# to which evaluators are run and when. +return 0; diff --git a/courses.dist/modelCourse/templates/achievements/challenge_two.at b/courses.dist/modelCourse/templates/achievements/challenge_two.at index ae5fb71028..3214a2e7d8 100644 --- a/courses.dist/modelCourse/templates/achievements/challenge_two.at +++ b/courses.dist/modelCourse/templates/achievements/challenge_two.at @@ -1,88 +1,23 @@ -#This evaluator checks to see if a particular problem of a particular set has -# been solved - -#constants -my %validproblems = ( - 'Challenge' => { - '2' => 1, } - ); - -#check and see if this problem was solved -if ($validproblems{$problem->set_id} && - $validproblems{$problem->set_id}{$problem->problem_id} && - $problem->status == 1 && - $problem->num_correct == 1) { - #update challenger counter - $globalData->{challengerCounter}++; - return 1; - } +# This achievement checks to see if a particular challenge problem of a +# particular set has been solved. It updates $globalData->{challengerCounter} +# to be used with the challenger.at achievement. +# +# See [templates]/achievements/achievement_readme.txt for details. - return 0; +# Create a hash of all valid set id and problem numbers. +# Set names (ids) are keys, and each is a hash of valid +# problem numbers. Use "_" for spaces in set ids. +my %validproblems = ('Challenge' => { '2' => 1 }); +# Checks to see if a valid problem was solved. +if ($validproblems{ $problem->set_id } + && $validproblems{ $problem->set_id }{ $problem->problem_id } + && $problem->status == 1 + && $problem->num_correct == 1) +{ + # Update challenger counter. + ++$globalData->{challengerCounter}; + return 1; +} -# -You have access to a variety of variables: -# - $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->last_answer : the last answer submitted -# - $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 -# -# - $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. The data in this hash will *not* be accessable -# by other achievements. If you plan to store something in this hash you have -# to write code to initialize the data. -# -# - $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. Like $localData, you need to -# initialize any variable you plan on using in this hash. 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->{completeProblems} : 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 -# on 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 in, or you need to pay very close attention -# to which evaluators are run and when. +return 0; diff --git a/courses.dist/modelCourse/templates/achievements/challenger.at b/courses.dist/modelCourse/templates/achievements/challenger.at index 8e7d761136..4417afbe1a 100644 --- a/courses.dist/modelCourse/templates/achievements/challenger.at +++ b/courses.dist/modelCourse/templates/achievements/challenger.at @@ -1,78 +1,9 @@ -# This is a "solved n problems achievement. Notice how we update $counter -# (even though the appropriate variable is already given to use in -# ($globalData) so that the achievement progress bar works correctly. - -# Update counter from globalData -$counter = $globalData->{'challengerCounter'}; - -if ($counter >= $maxCounter) { - return 1 -} else { - return 0; -} - -# Variable Descriptions: -# - $problem : the problem data (changes tao 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 '' +# This is a "solved n challenge problems" achievement. Notice how we update +# $counter (even though the appropriate variable is already given to use in +# $globalData) so that the achievement progress bar works correctly. # -# - $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 -# -# - $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. The data in this hash will *not* be accessable -# by other achievements. If you plan to store something in this hash you have -# to write code to initialize the data. -# -# - $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. Like $localData, you need to -# initialize any variable you plan on using in this hash. 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->{completeProblems} : 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 -# on 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 in, or you need to pay very close attention -# to which evaluators are run and when. +# See [templates]/achievements/achievement_readme.txt for details. + +# Update counter from $globalData. +$counter = $globalData->{challengerCounter}; +return $counter >= $maxCounter ? 1 : 0; diff --git a/courses.dist/modelCourse/templates/achievements/change_of_variables.at b/courses.dist/modelCourse/templates/achievements/change_of_variables.at deleted file mode 100644 index f67a5042f2..0000000000 --- a/courses.dist/modelCourse/templates/achievements/change_of_variables.at +++ /dev/null @@ -1,88 +0,0 @@ -#This problem checks to see if a particular problem from a list of valid -# sets and problems has been solved. (You would edit this file to say which -# sets and problems count.) - -#constants -my %validproblems = ( - 'SetNameHere' => { #now you show which problems are valid like: - '2' => 1, - '1' => 1, }, #and put more sets here - ); - -#check and see if this problem was solved -if ($validproblems{$problem->set_id} && - $validproblems{$problem->set_id}{$problem->problem_id} && - $problem->status == 1 && - $problem->num_correct == 1) { - return 1; - } - - return 0; - - -# -You have access to a variety of variables: -# - $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->last_answer : the last answer submitted -# - $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 -# -# - $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. The data in this hash will *not* be accessable -# by other achievements. If you plan to store something in this hash you have -# to write code to initialize the data. -# -# - $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. Like $localData, you need to -# initialize any variable you plan on using in this hash. 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->{completeProblems} : 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 -# on 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 in, or you need to pay very close attention -# to which evaluators are run and when. diff --git a/courses.dist/modelCourse/templates/achievements/chipping_away.at b/courses.dist/modelCourse/templates/achievements/chipping_away.at index be2563cbb0..ecaf769f92 100644 --- a/courses.dist/modelCourse/templates/achievements/chipping_away.at +++ b/courses.dist/modelCourse/templates/achievements/chipping_away.at @@ -1,84 +1,16 @@ -#This checks to see if the student has worked on the set in -# greater than 48 hours from time to first input to time to last answer. +# This achievement is awarded if a student has worked on the set in +# greater than 48 hours without working on a different set. +# +# See [templates]/achievements/achievement_readme.txt for details. # If the set id doest equal the id of the last set then set -# *this* set as the last set, and set the start time - +# *this* set as the last set, and set the start time. if ($problem->set_id ne $localData->{last_set}) { - $localData->{last_set} = $problem->set_id; - $localData->{start_time} = time(); - return 0; + $localData->{last_set} = $problem->set_id; + $localData->{start_time} = time; + return 0; } -# of we spent more than 48 hours then done! -if ((time() - $localData->{start_time}) > 172800) { - return 1; -} else { - return 0; -} -# -You have access to a variety of variables: -# - $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->last_answer : the last answer submitted -# - $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 -# -# - $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. The data in this hash will *not* be accessable -# by other achievements. If you plan to store something in this hash you have -# to write code to initialize the data. -# -# - $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. Like $localData, you need to -# initialize any variable you plan on using in this hash. 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->{completeProblems} : 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 -# on 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 in, or you need to pay very close attention -# to which evaluators are run and when. +# Check if more than 48 hours = 2 * 24 * 60 * 60 = 172800 seconds +# has elapsed since they "started" the set. +return time - $localData->{start_time} > 172800 ? 1 : 0; diff --git a/courses.dist/modelCourse/templates/achievements/complete_100_problems.at b/courses.dist/modelCourse/templates/achievements/complete_100_problems.at deleted file mode 100644 index f82c29a658..0000000000 --- a/courses.dist/modelCourse/templates/achievements/complete_100_problems.at +++ /dev/null @@ -1,78 +0,0 @@ -# This is a "solved n problems achievement. Notice how we update $counter -# (even though the appropriate variable is already given to use in -# ($globalData) so that the achievement progress bar works correctly. - -# Update counter from globalData -$counter = $globalData->{'completeProblems'}; - -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 -# -# - $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. The data in this hash will *not* be accessable -# by other achievements. If you plan to store something in this hash you have -# to write code to initialize the data. -# -# - $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. Like $localData, you need to -# initialize any variable you plan on using in this hash. 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->{completeProblems} : 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 -# on 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 in, or you need to pay very close attention -# to which evaluators are run and when. diff --git a/courses.dist/modelCourse/templates/achievements/complete_10_problems.at b/courses.dist/modelCourse/templates/achievements/complete_10_problems.at deleted file mode 100644 index f82c29a658..0000000000 --- a/courses.dist/modelCourse/templates/achievements/complete_10_problems.at +++ /dev/null @@ -1,78 +0,0 @@ -# This is a "solved n problems achievement. Notice how we update $counter -# (even though the appropriate variable is already given to use in -# ($globalData) so that the achievement progress bar works correctly. - -# Update counter from globalData -$counter = $globalData->{'completeProblems'}; - -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 -# -# - $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. The data in this hash will *not* be accessable -# by other achievements. If you plan to store something in this hash you have -# to write code to initialize the data. -# -# - $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. Like $localData, you need to -# initialize any variable you plan on using in this hash. 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->{completeProblems} : 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 -# on 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 in, or you need to pay very close attention -# to which evaluators are run and when. diff --git a/courses.dist/modelCourse/templates/achievements/complete_150_problems.at b/courses.dist/modelCourse/templates/achievements/complete_150_problems.at deleted file mode 100644 index f82c29a658..0000000000 --- a/courses.dist/modelCourse/templates/achievements/complete_150_problems.at +++ /dev/null @@ -1,78 +0,0 @@ -# This is a "solved n problems achievement. Notice how we update $counter -# (even though the appropriate variable is already given to use in -# ($globalData) so that the achievement progress bar works correctly. - -# Update counter from globalData -$counter = $globalData->{'completeProblems'}; - -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 -# -# - $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. The data in this hash will *not* be accessable -# by other achievements. If you plan to store something in this hash you have -# to write code to initialize the data. -# -# - $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. Like $localData, you need to -# initialize any variable you plan on using in this hash. 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->{completeProblems} : 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 -# on 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 in, or you need to pay very close attention -# to which evaluators are run and when. diff --git a/courses.dist/modelCourse/templates/achievements/complete_25_problems.at b/courses.dist/modelCourse/templates/achievements/complete_25_problems.at deleted file mode 100644 index f82c29a658..0000000000 --- a/courses.dist/modelCourse/templates/achievements/complete_25_problems.at +++ /dev/null @@ -1,78 +0,0 @@ -# This is a "solved n problems achievement. Notice how we update $counter -# (even though the appropriate variable is already given to use in -# ($globalData) so that the achievement progress bar works correctly. - -# Update counter from globalData -$counter = $globalData->{'completeProblems'}; - -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 -# -# - $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. The data in this hash will *not* be accessable -# by other achievements. If you plan to store something in this hash you have -# to write code to initialize the data. -# -# - $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. Like $localData, you need to -# initialize any variable you plan on using in this hash. 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->{completeProblems} : 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 -# on 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 in, or you need to pay very close attention -# to which evaluators are run and when. diff --git a/courses.dist/modelCourse/templates/achievements/complete_50_problems.at b/courses.dist/modelCourse/templates/achievements/complete_50_problems.at deleted file mode 100644 index 47eb5ee13b..0000000000 --- a/courses.dist/modelCourse/templates/achievements/complete_50_problems.at +++ /dev/null @@ -1,78 +0,0 @@ -# This is a "solved n problems achievement. Notice how we update $counter -# (even though the appropriate variable is already given to use in -# ($globalData) so that the achievement progress bar works correctly. - -# Update counter from globalData -$counter = $globalData->{'completeProblems'}; - -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 -# -# - $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. The data in this hash will *not* be accessable -# by other achievements. If you plan to store something in this hash you have -# to write code to initialize the data. -# -# - $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. Like $localData, you need to -# initialize any variable you plan on using in this hash. 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->{completeProblems} : 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 -# on 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 in, or you need to pay very close attention -# to which evaluators are run and when. diff --git a/courses.dist/modelCourse/templates/achievements/complete_all_sets.at b/courses.dist/modelCourse/templates/achievements/complete_all_sets.at deleted file mode 100644 index b54b1b308a..0000000000 --- a/courses.dist/modelCourse/templates/achievements/complete_all_sets.at +++ /dev/null @@ -1,78 +0,0 @@ -# This is a "solved n problems achievement. Notice how we update $counter -# (even though the appropriate variable is already given to use in -# ($globalData) so that the achievement progress bar works correctly. - -# Update counter from globalData -$counter = $globalData->{'completeSets'}; - -if ($counter >= $maxCounter) { - return 1 -} else { - return 0; -} - -# Variable Descriptions: -# - $problem : the problem data (changes tao 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 -# -# - $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. The data in this hash will *not* be accessable -# by other achievements. If you plan to store something in this hash you have -# to write code to initialize the data. -# -# - $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. Like $localData, you need to -# initialize any variable you plan on using in this hash. 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->{completeProblems} : 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 -# on 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 in, or you need to pay very close attention -# to which evaluators are run and when. diff --git a/courses.dist/modelCourse/templates/achievements/complete_five_sets.at b/courses.dist/modelCourse/templates/achievements/complete_five_sets.at deleted file mode 100644 index 9ab10dd0a3..0000000000 --- a/courses.dist/modelCourse/templates/achievements/complete_five_sets.at +++ /dev/null @@ -1,78 +0,0 @@ -# This is a "solved n sets" achievement. Notice how we update $counter -# (even though the appropriate variable is already given to use in -# ($globalData) so that the achievement progress bar works correctly. - -# Update counter from globalData -$counter = $globalData->{'completeSets'}; - -if ($counter >= $maxCounter) { - return 1 -} else { - return 0; -} - -# Variable Descriptions: -# - $problem : the problem data (changes tao 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 -# -# - $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. The data in this hash will *not* be accessable -# by other achievements. If you plan to store something in this hash you have -# to write code to initialize the data. -# -# - $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. Like $localData, you need to -# initialize any variable you plan on using in this hash. 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->{completeProblems} : 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 -# on 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 in, or you need to pay very close attention -# to which evaluators are run and when. diff --git a/courses.dist/modelCourse/templates/achievements/complete_n_problems.at b/courses.dist/modelCourse/templates/achievements/complete_n_problems.at new file mode 100644 index 0000000000..81e5b7e1eb --- /dev/null +++ b/courses.dist/modelCourse/templates/achievements/complete_n_problems.at @@ -0,0 +1,11 @@ +# This is a "solved n problems" achievement. This evaluator can be assigned +# to multiple different achievements since it uses $maxCounter to determine +# if the desired number of problems to be completed. Notice how we update +# $counter (even though the appropriate variable is already given to use in +# $globalData) so that the achievement progress bar works correctly. +# +# See [templates]/achievements/achievement_readme.txt for details. + +# Update counter from $globalData. +$counter = $globalData->{completeProblems}; +return $counter >= $maxCounter ? 1 : 0; diff --git a/courses.dist/modelCourse/templates/achievements/complete_n_sets.at b/courses.dist/modelCourse/templates/achievements/complete_n_sets.at new file mode 100644 index 0000000000..8d4e83bc3d --- /dev/null +++ b/courses.dist/modelCourse/templates/achievements/complete_n_sets.at @@ -0,0 +1,11 @@ +# This is a "complete n sets" achievement. This evaluator can be assigned +# to multiple different achievements since it uses $maxCounter to determine +# if the desired number of problems to be completed. Notice how we update +# $counter (even though the appropriate variable is already given to use in +# $globalData) so that the achievement progress bar works correctly. +# +# See [templates]/achievements/achievement_readme.txt for details. + +# Update counter from $globalData. +$counter = $globalData->{completeSets}; +return $counter >= $maxCounter ? 1 : 0; diff --git a/courses.dist/modelCourse/templates/achievements/complete_one_problem.at b/courses.dist/modelCourse/templates/achievements/complete_one_problem.at deleted file mode 100644 index c2d2bdcace..0000000000 --- a/courses.dist/modelCourse/templates/achievements/complete_one_problem.at +++ /dev/null @@ -1,76 +0,0 @@ -# This is a "solved n problems achievement. Normally we would have to deal -# with the counter variable, but since n = 1 we dont have to - -# Achievement earned if they did the problem correctly -if ($problem->status == 1) { - 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->last_answer : the last answer submitted -# - $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 -# -# - $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. The data in this hash will *not* be accessable -# by other achievements. If you plan to store something in this hash you have -# to write code to initialize the data. -# -# - $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. Like $localData, you need to -# initialize any variable you plan on using in this hash. 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 -# on 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 in, or you need to pay very close attention -# to which evaluators are run and when. diff --git a/courses.dist/modelCourse/templates/achievements/complete_one_set.at b/courses.dist/modelCourse/templates/achievements/complete_one_set.at deleted file mode 100644 index 2d73f85ba9..0000000000 --- a/courses.dist/modelCourse/templates/achievements/complete_one_set.at +++ /dev/null @@ -1,74 +0,0 @@ -# This is a "solved n sets" achievement. However, since n=1 we just check to -# see if the student has solved a set - -if ($globalData->{'completeSets'} >= 1) { - 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 -# -# - $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. The data in this hash will *not* be accessable -# by other achievements. If you plan to store something in this hash you have -# to write code to initialize the data. -# -# - $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. Like $localData, you need to -# initialize any variable you plan on using in this hash. 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->{completeProblems} : 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 -# on 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 in, or you need to pay very close attention -# to which evaluators are run and when. diff --git a/courses.dist/modelCourse/templates/achievements/complete_ten_sets.at b/courses.dist/modelCourse/templates/achievements/complete_ten_sets.at deleted file mode 100644 index b54b1b308a..0000000000 --- a/courses.dist/modelCourse/templates/achievements/complete_ten_sets.at +++ /dev/null @@ -1,78 +0,0 @@ -# This is a "solved n problems achievement. Notice how we update $counter -# (even though the appropriate variable is already given to use in -# ($globalData) so that the achievement progress bar works correctly. - -# Update counter from globalData -$counter = $globalData->{'completeSets'}; - -if ($counter >= $maxCounter) { - return 1 -} else { - return 0; -} - -# Variable Descriptions: -# - $problem : the problem data (changes tao 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 -# -# - $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. The data in this hash will *not* be accessable -# by other achievements. If you plan to store something in this hash you have -# to write code to initialize the data. -# -# - $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. Like $localData, you need to -# initialize any variable you plan on using in this hash. 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->{completeProblems} : 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 -# on 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 in, or you need to pay very close attention -# to which evaluators are run and when. diff --git a/courses.dist/modelCourse/templates/achievements/complete_thirty_sets.at b/courses.dist/modelCourse/templates/achievements/complete_thirty_sets.at deleted file mode 100644 index b54b1b308a..0000000000 --- a/courses.dist/modelCourse/templates/achievements/complete_thirty_sets.at +++ /dev/null @@ -1,78 +0,0 @@ -# This is a "solved n problems achievement. Notice how we update $counter -# (even though the appropriate variable is already given to use in -# ($globalData) so that the achievement progress bar works correctly. - -# Update counter from globalData -$counter = $globalData->{'completeSets'}; - -if ($counter >= $maxCounter) { - return 1 -} else { - return 0; -} - -# Variable Descriptions: -# - $problem : the problem data (changes tao 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 -# -# - $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. The data in this hash will *not* be accessable -# by other achievements. If you plan to store something in this hash you have -# to write code to initialize the data. -# -# - $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. Like $localData, you need to -# initialize any variable you plan on using in this hash. 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->{completeProblems} : 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 -# on 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 in, or you need to pay very close attention -# to which evaluators are run and when. diff --git a/courses.dist/modelCourse/templates/achievements/complete_twenty_sets.at b/courses.dist/modelCourse/templates/achievements/complete_twenty_sets.at deleted file mode 100644 index b54b1b308a..0000000000 --- a/courses.dist/modelCourse/templates/achievements/complete_twenty_sets.at +++ /dev/null @@ -1,78 +0,0 @@ -# This is a "solved n problems achievement. Notice how we update $counter -# (even though the appropriate variable is already given to use in -# ($globalData) so that the achievement progress bar works correctly. - -# Update counter from globalData -$counter = $globalData->{'completeSets'}; - -if ($counter >= $maxCounter) { - return 1 -} else { - return 0; -} - -# Variable Descriptions: -# - $problem : the problem data (changes tao 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 -# -# - $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. The data in this hash will *not* be accessable -# by other achievements. If you plan to store something in this hash you have -# to write code to initialize the data. -# -# - $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. Like $localData, you need to -# initialize any variable you plan on using in this hash. 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->{completeProblems} : 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 -# on 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 in, or you need to pay very close attention -# to which evaluators are run and when. diff --git a/courses.dist/modelCourse/templates/achievements/crack_o_dawn.at b/courses.dist/modelCourse/templates/achievements/crack_o_dawn.at index 47759496af..29f5970aeb 100644 --- a/courses.dist/modelCourse/templates/achievements/crack_o_dawn.at +++ b/courses.dist/modelCourse/templates/achievements/crack_o_dawn.at @@ -1,95 +1,14 @@ -# checks to see if a student finished a set between 5AM and 7AM +# This achievement is awarded for completing a set between 5AM and 7AM. +# +# See [templates]/achievements/achievement_readme.txt for details. -# Check that this is not a repeated submission of problem which has -# been solved before. # Do not consider this achievement if this is a repeated submission # of previously solved problem. +return 0 unless $problem->status == 1 && $problem->num_correct == 1; -return 0 unless ($problem->status == 1 && $problem->num_correct == 1); - -# now check the time - - if ($courseDateTime[2] < 5 || $courseDateTime[2] > 6) { - return 0; - } +# Now check if this set has been completed. +return 0 unless $globalData->{completedSetIds}{ $set->set_id }; - #if it is check to see if we have finished the set - - foreach my $problemRecord (@setProblems) { - if ($problemRecord->status != 1) { - return 0; - } - } - - return 1; - -# -You have access to a variety of variables: -# - $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->last_answer : the last answer submitted -# - $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 -# -# - $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. The data in this hash will *not* be accessable -# by other achievements. If you plan to store something in this hash you have -# to write code to initialize the data. -# -# - $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. Like $localData, you need to -# initialize any variable you plan on using in this hash. 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->{completeProblems} : 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 -# on 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 in, or you need to pay very close attention -# to which evaluators are run and when. -# -# - @courseDateTime - array of time information in course timezone -# (sec,min,hour,day,month,year,day_of_week) as produced by -# https://metacpan.org/pod/DateTime +# Finally check the time. $courseDateTime[2] is the hour in the +# course's timezone. +return $courseDateTime[2] < 5 || $courseDateTime[2] > 6 ? 0 : 1; diff --git a/courses.dist/modelCourse/templates/achievements/curvature.at b/courses.dist/modelCourse/templates/achievements/curvature.at deleted file mode 100644 index c3ef573b7e..0000000000 --- a/courses.dist/modelCourse/templates/achievements/curvature.at +++ /dev/null @@ -1,88 +0,0 @@ -#This problem checks to see if a particular problem from a list of valid -# sets and problems has been solved. (You would edit this file to say which -# sets and problems count.) - -#constants -my %validproblems = ( - 'SetNameHere' => { #now you show which problems are valid like: - '2' => 1, - '3' => 1, }, #now add more sets here - ); - -#check and see if this problem was solved -if ($validproblems{$problem->set_id} && - $validproblems{$problem->set_id}{$problem->problem_id} && - $problem->status == 1 && - $problem->num_correct == 1) { - return 1; - } - - return 0; - - -# -You have access to a variety of variables: -# - $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->last_answer : the last answer submitted -# - $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 -# -# - $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. The data in this hash will *not* be accessable -# by other achievements. If you plan to store something in this hash you have -# to write code to initialize the data. -# -# - $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. Like $localData, you need to -# initialize any variable you plan on using in this hash. 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->{completeProblems} : 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 -# on 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 in, or you need to pay very close attention -# to which evaluators are run and when. diff --git a/courses.dist/modelCourse/templates/achievements/curvy_geometry.at b/courses.dist/modelCourse/templates/achievements/curvy_geometry.at deleted file mode 100644 index 63e3b1078e..0000000000 --- a/courses.dist/modelCourse/templates/achievements/curvy_geometry.at +++ /dev/null @@ -1,89 +0,0 @@ -#This problem checks to see if a particular problem from a list of valid -# sets and problems has been solved. (You would edit this file to say which -# sets and problems count.) - -#constants -my %validproblems = ( - 'SetNameHere' => { #now you show which problems are valid like: - '2' => 1, - '1' => 1, }, #and put more sets here - ); - -#check and see if this problem was solved -if ($validproblems{$problem->set_id} && - $validproblems{$problem->set_id}{$problem->problem_id} && - $problem->status == 1 && - $problem->num_correct == 1) { - return 1; - } - - return 0; - - -# -You have access to a variety of variables: -# - $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->last_answer : the last answer submitted -# - $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 -# -# -# - $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. The data in this hash will *not* be accessable -# by other achievements. If you plan to store something in this hash you have -# to write code to initialize the data. -# -# - $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. Like $localData, you need to -# initialize any variable you plan on using in this hash. 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->{completeProblems} : 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 -# on 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 in, or you need to pay very close attention -# to which evaluators are run and when. diff --git a/courses.dist/modelCourse/templates/achievements/default_achievements.axp b/courses.dist/modelCourse/templates/achievements/default_achievements.axp index 08ac002f62..a7481149a4 100644 --- a/courses.dist/modelCourse/templates/achievements/default_achievements.axp +++ b/courses.dist/modelCourse/templates/achievements/default_achievements.axp @@ -6,7 +6,7 @@ still_not_right,"It's Still Not Right",105,secret,"default,jitar","Input the exa persistence,"Persistence is not Futile",106,secret,"default,jitar","Solve a problem after 20 incorrect submissions.",10,,persistence.at,persistence.png super_persistence,"Green Never Looked So Good",107,secret,"default,jitar","Solve a problem after 100 incorrect submissions.",10,,super_persistence.at,super_persistence.png super_speed_math,"Careful Planning and Quick Fingers",108,secret,default,"Spend less than 10 minutes entering answers to a homework set.",20,,super_speed_math.at,super_speed_math.png -hows_your_finger,"Hows Your Finger?",109,secret,"default,jitar","Have more than 250 submissions on a homework problem. ",10,,hows_your_finger.at,hows_your_finger.png +hows_your_finger,"Hows Your Finger?",109,secret,"default,jitar","Have more than 250 submissions on a homework problem.",10,,hows_your_finger.at,hows_your_finger.png third_time,"Third Times the Charm",110,secret,"default,jitar","Solve a problem on the third submission",10,,third_time.at,third_time.png one_click,"One Click Is All I Need",201,one_timer,"default,jitar","Earn 100% on a problem in one attempt.",10,,one_click.at,one_click.png on_one_hand,"On One Hand",202,one_timer,default,"Finish a homework set with less than 5 incorrect submissions.",10,,on_one_hand.at,on_one_hand.png @@ -16,20 +16,20 @@ really_early_bird,"The Really Early Bird",205,one_timer,default,"Finish a homewo back_for_more,"Back For More",206,one_timer,"default,jitar","Retry a problem after a 8 hour break.",10,,back_for_more.at,back_for_more.png chipping_away,"Just Keep Chipping Away",207,one_timer,"default,jitar","Work on a single homework set over the course of 48 hours.",10,,chipping_away.at,chipping_away.png speed_mather,"Go Speed Math-er",208,one_timer,default,"Spend less than 1 hour working on a homework set.",10,,speed_mather.at,speed_mather.png -three_in_a_row,"Three in a Row",209,one_timer,"default,jitar","Complete 3 problems in a row with no incorrect answers.",10,3,three_in_a_row.at,three_in_a_row.png -on_fire,"You're on Fire!",210,one_timer,"default,jitar","Complete 10 problems in a row with no incorrect answers.",20,10,on_fire.at,on_fire.png -complete_one_set,"One Set Wonder",401,complete_sets,default,"Get 100% on one homework set.",10,,complete_one_set.at,complete_one_set.png -complete_five_sets,"High Five",402,complete_sets,default,"Get 100% on five homework sets.",10,5,complete_five_sets.at,complete_five_sets.png -complete_ten_sets,"One For Each Finger",403,complete_sets,default,"Get 100% on ten homework sets.",10,10,complete_ten_sets.at,complete_ten_sets.png -complete_twenty_sets,"Mathbox Twenty",404,complete_sets,default,"Get 100% on twenty homework sets.",20,20,complete_twenty_sets.at,complete_twenty_sets.png -complete_thirty_sets,"The Long Road",405,complete_sets,default,"Get 100% on thirty homework sets.",20,30,complete_thirty_sets.at,complete_thirty_sets.png -complete_all_sets,Perfection,406,complete_sets,default,"Get 100% on all homework sets.",30,35,complete_all_sets.at,complete_all_sets.png -complete_one_problem,"The First Step",501,complete_problems,"default,jitar","Earn 100% on a homework problem.",10,,complete_one_problem.at,complete_one_problem.png -complete_10_problems,"Perfect 10",502,complete_problems,"default,jitar","Earn 100% on 10 homework problems.",10,10,complete_10_problems.at,complete_10_problems.png -complete_25_problems,"Twenty-Five Questions",503,complete_problems,"default,jitar","Earn 100% on 25 homework problems.",10,25,complete_25_problems.at,complete_25_problems.png -complete_50_problems,"50 Ways to Solve a Math Problem",504,complete_problems,"default,jitar","Earn 100% on 50 homework problems.",10,50,complete_50_problems.at,complete_50_problems.png -complete_100_problems,"Seeing Benjamins",505,complete_problems,"default,jitar","Earn 100% on 100 homework problems.",20,100,complete_100_problems.at,complete_100_problems.png -complete_150_problems,Sesqui-Centeni-Problems,506,complete_problems,"default,jitar","Earn 100% on 150 homework problems.",20,150,complete_150_problems.at,complete_150_problems.png +three_in_a_row,"Three in a Row",209,one_timer,"default,jitar","Complete 3 problems in a row with no incorrect answers.",10,3,n_correct_in_a_row.at,three_in_a_row.png +on_fire,"You're on Fire!",210,one_timer,"default,jitar","Complete 10 problems in a row with no incorrect answers.",20,10,n_correct_in_a_row.at,on_fire.png +complete_one_set,"One Set Wonder",401,complete_sets,default,"Get 100% on one homework set.",10,1,complete_n_sets.at,complete_one_set.png +complete_five_sets,"High Five",402,complete_sets,default,"Get 100% on five homework sets.",10,5,complete_n_sets.at,complete_five_sets.png +complete_ten_sets,"One For Each Finger",403,complete_sets,default,"Get 100% on ten homework sets.",10,10,complete_n_sets.at,complete_ten_sets.png +complete_twenty_sets,"Mathbox Twenty",404,complete_sets,default,"Get 100% on twenty homework sets.",20,20,complete_n_sets.at,complete_twenty_sets.png +complete_thirty_sets,"The Long Road",405,complete_sets,default,"Get 100% on thirty homework sets.",20,30,complete_n_sets.at,complete_thirty_sets.png +complete_all_sets,Perfection,406,complete_sets,default,"Get 100% on all homework sets.",30,35,complete_n_sets.at,complete_all_sets.png +complete_one_problem,"The First Step",501,complete_problems,"default,jitar","Earn 100% on a homework problem.",10,1,complete_n_problems.at,complete_one_problem.png +complete_10_problems,"Perfect 10",502,complete_problems,"default,jitar","Earn 100% on 10 homework problems.",10,10,complete_n_problems.at,complete_10_problems.png +complete_25_problems,"Twenty-Five Questions",503,complete_problems,"default,jitar","Earn 100% on 25 homework problems.",10,25,complete_n_problems.at,complete_25_problems.png +complete_50_problems,"50 Ways to Solve a Math Problem",504,complete_problems,"default,jitar","Earn 100% on 50 homework problems.",10,50,complete_n_problems.at,complete_50_problems.png +complete_100_problems,"Seeing Benjamins",505,complete_problems,"default,jitar","Earn 100% on 100 homework problems.",20,100,complete_n_problems.at,complete_100_problems.png +complete_150_problems,Sesqui-Centeni-Problems,506,complete_problems,"default,jitar","Earn 100% on 150 homework problems.",20,150,complete_n_problems.at,complete_150_problems.png challenge_one,"Challenge One Complete",601,challenge,default,"Finish the first challenge problem.",10,,challenge_one.at,challenge_one.png challenge_two,"Challenge Two Complete",602,challenge,default,"Finish the second challenge problem.",10,,challenge_two.at,challenge_two.png challenge_three,"Challenge Three Complete",603,challenge,default,"Finish the third challenge problem.",10,,challenge_three.at,challenge_three.png @@ -40,7 +40,7 @@ challenge_seven,"Challenge Seven Complete",607,challenge,default,"Finish the sev challenge_eight,"Challenge Eight Complete",608,challenge,default,"Finish the eighth challenge problem.",10,,challenge_eight.at,challenge_eight.png challenge_nine,"Challenge Nine Complete",609,challenge,default,"Finish the ninth challenge problem.",10,,challenge_nine.at,challenge_nine.png challenge_ten,"Challenge Ten Complete",610,challenge,default,"Finish the tenth challenge problem.",10,,challenge_ten.at,challenge_ten.png -challenger,Challenger,611,challenge,default,"Finish all of the challenge problems.",10,20,challenger.at,challenger.png +challenger,Challenger,611,challenge,default,"Finish all of the challenge problems.",20,10,challenger.at,challenger.png earn_10_achievements,"Huzzah!!",9501,achievements,"default,gateway,jitar","Earn ten achievements.",10,10,earn_n_achievements.at,earn_10_achievements.png earn_20_achievements,"Achiever",9502,achievements,"default,gateway,jitar","Earn twenty achievements.",10,20,earn_n_achievements.at,earn_20_achievements.png earn_30_achievements,"The Collector",9503,achievements,"default,gateway,jitar","Earn thirty achievements.",10,30,earn_n_achievements.at,earn_30_achievements.png diff --git a/courses.dist/modelCourse/templates/achievements/derivative_master.at b/courses.dist/modelCourse/templates/achievements/derivative_master.at deleted file mode 100644 index a351b86d4c..0000000000 --- a/courses.dist/modelCourse/templates/achievements/derivative_master.at +++ /dev/null @@ -1,92 +0,0 @@ -#This problem checks to see if a particular problem from a list of valid -# sets and problems has been solved. If it has then it updates the counter -#(You would edit this file to say which sets and problems count.) - -#constants -my %validproblems = ( - 'SetNameHere' => { #now you show which problems are valid like: - '2' => 1, - '1' => 1, }, #and put more sets here - ); - -#check and see if this problem was solved -if ($validproblems{$problem->set_id} && - $validproblems{$problem->set_id}{$problem->problem_id} && - $problem->status == 1 && - $problem->num_correct == 1) { - #update counter; - $counter++; - } - -if ($counter >= $maxCounter) { - return 1; -} else { - return 0; -} - -# -You have access to a variety of variables: -# - $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->last_answer : the last answer submitted -# - $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 -# -# - $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. The data in this hash will *not* be accessable -# by other achievements. If you plan to store something in this hash you have -# to write code to initialize the data. -# -# - $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. Like $localData, you need to -# initialize any variable you plan on using in this hash. 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->{completeProblems} : 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 -# on 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 in, or you need to pay very close attention -# to which evaluators are run and when. diff --git a/courses.dist/modelCourse/templates/achievements/doing_it_backwards.at b/courses.dist/modelCourse/templates/achievements/doing_it_backwards.at deleted file mode 100644 index 6660de54ab..0000000000 --- a/courses.dist/modelCourse/templates/achievements/doing_it_backwards.at +++ /dev/null @@ -1,93 +0,0 @@ -#This problem checks to see if a particular problem from a list of valid -# sets and problems has been solved. If it has then it updates the counter -#(You would edit this file to say which sets and problems count.) - -#constants -my %validproblems = ( - 'SetNameHere' => { #now you show which problems are valid like: - '2' => 1, - '1' => 1, }, #and put more sets here - ); - -#check and see if this problem was solved -if ($validproblems{$problem->set_id} && - $validproblems{$problem->set_id}{$problem->problem_id} && - $problem->status == 1 && - $problem->num_correct == 1) { - #update counter; - $counter++; - } - -if ($counter >= $maxCounter) { - return 1; -} else { - return 0; -} - - -# -You have access to a variety of variables: -# - $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->last_answer : the last answer submitted -# - $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 -# -# - $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. The data in this hash will *not* be accessable -# by other achievements. If you plan to store something in this hash you have -# to write code to initialize the data. -# -# - $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. Like $localData, you need to -# initialize any variable you plan on using in this hash. 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->{completeProblems} : 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 -# on 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 in, or you need to pay very close attention -# to which evaluators are run and when. diff --git a/courses.dist/modelCourse/templates/achievements/double_integral.at b/courses.dist/modelCourse/templates/achievements/double_integral.at deleted file mode 100644 index a351b86d4c..0000000000 --- a/courses.dist/modelCourse/templates/achievements/double_integral.at +++ /dev/null @@ -1,92 +0,0 @@ -#This problem checks to see if a particular problem from a list of valid -# sets and problems has been solved. If it has then it updates the counter -#(You would edit this file to say which sets and problems count.) - -#constants -my %validproblems = ( - 'SetNameHere' => { #now you show which problems are valid like: - '2' => 1, - '1' => 1, }, #and put more sets here - ); - -#check and see if this problem was solved -if ($validproblems{$problem->set_id} && - $validproblems{$problem->set_id}{$problem->problem_id} && - $problem->status == 1 && - $problem->num_correct == 1) { - #update counter; - $counter++; - } - -if ($counter >= $maxCounter) { - return 1; -} else { - return 0; -} - -# -You have access to a variety of variables: -# - $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->last_answer : the last answer submitted -# - $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 -# -# - $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. The data in this hash will *not* be accessable -# by other achievements. If you plan to store something in this hash you have -# to write code to initialize the data. -# -# - $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. Like $localData, you need to -# initialize any variable you plan on using in this hash. 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->{completeProblems} : 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 -# on 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 in, or you need to pay very close attention -# to which evaluators are run and when. diff --git a/courses.dist/modelCourse/templates/achievements/early_bird.at b/courses.dist/modelCourse/templates/achievements/early_bird.at index f0bb5c25cf..18b4964251 100644 --- a/courses.dist/modelCourse/templates/achievements/early_bird.at +++ b/courses.dist/modelCourse/templates/achievements/early_bird.at @@ -1,82 +1,10 @@ -#This checks to see if the student has finished the set within a certain time - - #test to see if it is before 1 day after the open date - if ((time()-$set->open_date) > 86400) { - return 0; - } +# This achievement is awarded for completing a set within 1 day +# or 24 * 60 * 60 = 86400 seconds of it opening. +# +# See [templates]/achievements/achievement_readme.txt for details. - #if it is check to see if we have finished the set - foreach my $problemRecord (@setProblems) { - if ($problemRecord->status != 1) { - return 0; - } - } - - return 1; +# Check if this set has been completed. +return 0 unless $globalData->{completedSetIds}{ $set->set_id }; -# -You have access to a variety of variables: -# - $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->last_answer : the last answer submitted -# - $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 -# -# - $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. The data in this hash will *not* be accessable -# by other achievements. If you plan to store something in this hash you have -# to write code to initialize the data. -# -# - $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. Like $localData, you need to -# initialize any variable you plan on using in this hash. 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->{completeProblems} : 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 -# on 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 in, or you need to pay very close attention -# to which evaluators are run and when. \ No newline at end of file +# Now test if it is before 1 day after the open date. +return time - $set->open_date > 86400 ? 0 : 1; diff --git a/courses.dist/modelCourse/templates/achievements/earn_n_achievements.at b/courses.dist/modelCourse/templates/achievements/earn_n_achievements.at index 4c20344a09..c14635ce63 100644 --- a/courses.dist/modelCourse/templates/achievements/earn_n_achievements.at +++ b/courses.dist/modelCourse/templates/achievements/earn_n_achievements.at @@ -1,95 +1,15 @@ -# 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. +# This is a "earn n achievements" achievement. This evaluator can be assigned +# to multiple different achievements since it uses $maxCounter to determine +# if the desired number of problems to be completed. Notice how we update +# $counter (even though the appropriate variable is already given to use in +# $userAchievements) so that the achievement progress bar works correctly. +# +# See [templates]/achievements/achievement_readme.txt for details. # 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; +for my $key (keys %{$userAchievements}) { + ++$counter if $userAchievements->{$key} && $key !~ /^level/; } - -# 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. +return $counter >= $maxCounter ? 1 : 0; diff --git a/courses.dist/modelCourse/templates/achievements/example_complete_n_specific_problems.at b/courses.dist/modelCourse/templates/achievements/example_complete_n_specific_problems.at new file mode 100644 index 0000000000..7d5e2bccc3 --- /dev/null +++ b/courses.dist/modelCourse/templates/achievements/example_complete_n_specific_problems.at @@ -0,0 +1,35 @@ +# This is an example achievement evaluator that awards credit if n specific +# problems are completed. This is done by creating a list of valid problems +# and checking if a problem from that list was answered correctly. If a problem +# from that list is answered correctly, the $counter is increased. Credit +# is given when $maxCounter problems from the list have been answered, which +# is configured in the achievement manager. +# +# See [templates]/achievements/achievement_readme.txt for details. + +# Create a hash of all valid set ids and problem numbers. +# Set names (ids) are keys, and each is a hash of valid +# problem numbers. Use "_" for spaces in set ids. +my %validproblems = ( + 'SetName1' => { + '3' => 1, + '5' => 1, + }, + 'SetName2' => { + '2' => 1, + '4' => 1, + '6' => 1, + }, +); + +# Checks to see if a valid problem was solved, +# then updates the counter if so. +if ($validproblems{ $problem->set_id } + && $validproblems{ $problem->set_id }{ $problem->problem_id } + && $problem->status == 1 + && $problem->num_correct == 1) +{ + ++$counter; +} + +return $counter >= $maxCounter ? 1 : 0; diff --git a/courses.dist/modelCourse/templates/achievements/example_complete_n_specific_sets.at b/courses.dist/modelCourse/templates/achievements/example_complete_n_specific_sets.at new file mode 100644 index 0000000000..38690b4827 --- /dev/null +++ b/courses.dist/modelCourse/templates/achievements/example_complete_n_specific_sets.at @@ -0,0 +1,15 @@ +# This is an example achievement evaluator that awards credit if n specific +# sets are completed. This is done by counting how many set IDs from a list +# are present in the $globalData->{completedSetIds} hash. The $counter variable +# is updated so that the achievement progress bar works correctly. Credit is +# given when $maxCounter sets have been completed, which is configured in +# the achievement manager. +# +# See [templates]/achievements/achievement_readme.txt for details. + +$counter = 0; +for my $setID ('SetName1', 'SetName2') { + ++$counter if $globalData->{completedSetIds}{$setID}; +} + +return $counter >= $maxCounter ? 1 : 0; diff --git a/courses.dist/modelCourse/templates/achievements/example_complete_specific_problem.at b/courses.dist/modelCourse/templates/achievements/example_complete_specific_problem.at new file mode 100644 index 0000000000..4dff722c77 --- /dev/null +++ b/courses.dist/modelCourse/templates/achievements/example_complete_specific_problem.at @@ -0,0 +1,26 @@ +# This is an example achievement evaluator that awards credit if a specific +# problem is completed. This is done by creating a list of valid problems +# and checking if a problem from that list was answered correctly. +# +# See [templates]/achievements/achievement_readme.txt for details. + +# Create a hash of all valid set ids and problem numbers. +# Set names (ids) are keys, and each is a hash of valid +# problem numbers. Use "_" for spaces in set ids. +my %validproblems = ( + 'SetName' => { + '3' => 1, + '5' => 1, + }, +); + +# Checks to see if a valid problem was solved. +if ($validproblems{ $problem->set_id } + && $validproblems{ $problem->set_id }{ $problem->problem_id } + && $problem->status == 1 + && $problem->num_correct == 1) +{ + return 1; +} + +return 0; diff --git a/courses.dist/modelCourse/templates/achievements/example_complete_specific_set.at b/courses.dist/modelCourse/templates/achievements/example_complete_specific_set.at new file mode 100644 index 0000000000..e93980d4b2 --- /dev/null +++ b/courses.dist/modelCourse/templates/achievements/example_complete_specific_set.at @@ -0,0 +1,11 @@ +# This is an example achievement evaluator that awards credit if a specific +# set is completed. This is done by checking if a list of set IDs is is +# present in the $globalData->{completedSetIds} hash. +# +# See [templates]/achievements/achievement_readme.txt for details. + +for my $setID ('SetName1', 'SetName2') { + return 1 if $globalData->{completedSetIds}{$setID}; +} + +return 0; diff --git a/courses.dist/modelCourse/templates/achievements/extensions.at b/courses.dist/modelCourse/templates/achievements/extensions.at index 5be5cf1373..542f497834 100644 --- a/courses.dist/modelCourse/templates/achievements/extensions.at +++ b/courses.dist/modelCourse/templates/achievements/extensions.at @@ -1,9 +1,10 @@ -# This achievement executes unconditionally, and awards the user a certain number -# of ExtendDueDate, SuperExtendDueDate, and ResurrectHW reward items. How many of -# each is specified below. +# This achievement executes unconditionally, and awards the user a certain number +# of ExtendDueDate, SuperExtendDueDate, and ResurrectHW reward items. How many of +# each is specified below. This could also give other extension type reward items +# such as AddNewTestGW, ExtendDueDateGW, ExtendReducedDate, NoReducedCred, ReducedCred, +# RessurectGW, and SuperExtendReducedDate. -$globalData->{ExtendDueDate} += 10; -$globalData->{SuperExtendDueDate} += 5; -$globalData->{ResurrectHW} += 3; +$globalData->{ExtendDueDate} += 10; +$globalData->{SuperExtendDueDate} += 5; +$globalData->{ResurrectHW} += 3; return 1; - diff --git a/courses.dist/modelCourse/templates/achievements/heart_area.at b/courses.dist/modelCourse/templates/achievements/heart_area.at deleted file mode 100644 index 491560c4dd..0000000000 --- a/courses.dist/modelCourse/templates/achievements/heart_area.at +++ /dev/null @@ -1,88 +0,0 @@ -#This problem checks to see if a particular problem from a list of valid -# sets and problems has been solved. (You would edit this file to say which -# sets and problems count.) - -#constants -my %validproblems = ( - 'SetNameHere' => { #now you show which problems are valid like: - '2' => 1, - '1' => 1, }, #and put more sets here - ); - -#check and see if this problem was solved -if ($validproblems{$problem->set_id} && - $validproblems{$problem->set_id}{$problem->problem_id} && - $problem->status == 1 && - $problem->num_correct == 1) { - return 1; - } - - return 0; - - -# -You have access to a variety of variables: -# - $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->last_answer : the last answer submitted -# - $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 -# -# - $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. The data in this hash will *not* be accessable -# by other achievements. If you plan to store something in this hash you have -# to write code to initialize the data. -# -# - $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. Like $localData, you need to -# initialize any variable you plan on using in this hash. 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->{completeProblems} : 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 -# on 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 in, or you need to pay very close attention -# to which evaluators are run and when. diff --git a/courses.dist/modelCourse/templates/achievements/hows_your_finger.at b/courses.dist/modelCourse/templates/achievements/hows_your_finger.at index 47f5b9fc48..30913cdf1e 100644 --- a/courses.dist/modelCourse/templates/achievements/hows_your_finger.at +++ b/courses.dist/modelCourse/templates/achievements/hows_your_finger.at @@ -1,75 +1,6 @@ -#This checks to see if the student has above a certain number of attempts - - if ($problem->num_correct + $problem->num_incorrect >= 250) { - return 1; - } else { - return 0; - } - - -# -You have access to a variety of variables: -# - $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->last_answer : the last answer submitted -# - $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 '' +# This achievement is awarded if a student submits a problem more +# 250 times, either correctly or incorrectly. # -# - $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 -# -# - $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. The data in this hash will *not* be accessable -# by other achievements. If you plan to store something in this hash you have -# to write code to initialize the data. -# -# - $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. Like $localData, you need to -# initialize any variable you plan on using in this hash. 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->{completeProblems} : 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 -# on 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 in, or you need to pay very close attention -# to which evaluators are run and when. \ No newline at end of file +# See [templates]/achievements/achievement_readme.txt for details. + +return $problem->num_correct + $problem->num_incorrect < 250 ? 0 : 1; diff --git a/courses.dist/modelCourse/templates/achievements/integral_master.at b/courses.dist/modelCourse/templates/achievements/integral_master.at deleted file mode 100644 index 2bf1adc049..0000000000 --- a/courses.dist/modelCourse/templates/achievements/integral_master.at +++ /dev/null @@ -1,92 +0,0 @@ -#This problem checks to see if a particular problem from a list of valid -# sets and problems has been solved. If it has then it updates the counter -#(You would edit this file to say which sets and problems count.) - -#constants -my %validproblems = ( - 'SetNameHere' => { #now you show which problems are valid like: - '2' => 1, - '1' => 1, }, #and put more sets here - ); - -#check and see if this problem was solved -if ($validproblems{$problem->set_id} && - $validproblems{$problem->set_id}{$problem->problem_id} && - $problem->status == 1 && - $problem->num_correct == 1) { - #update counter; - $counter++; - } - -if ($counter >= $maxCounter) { - return 1; -} else { - return 0; -} - -# -You have access to a variety of variables: -# - $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->last_answer : the last answer submitted -# - $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 -# -# - $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. The data in this hash will *not* be accessable -# by other achievements. If you plan to store something in this hash you have -# to write code to initialize the data. -# -# - $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. Like $localData, you need to -# initialize any variable you plan on using in this hash. 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->{completeProblems} : 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 -# on 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 in, or you need to pay very close attention -# to which evaluators are run and when. \ No newline at end of file diff --git a/courses.dist/modelCourse/templates/achievements/its_all_relative.at b/courses.dist/modelCourse/templates/achievements/its_all_relative.at deleted file mode 100644 index 462164620a..0000000000 --- a/courses.dist/modelCourse/templates/achievements/its_all_relative.at +++ /dev/null @@ -1,88 +0,0 @@ -#This problem checks to see if a particular problem from a list of valid -# sets and problems has been solved. (You would edit this file to say which -# sets and problems count.) - -#constants -my %validproblems = ( - 'SetNameHere' => { #now you show which problems are valid like: - '1' => 1, - '2' => 1, }, #and put more sets here - ); - -#check and see if this problem was solved -if ($validproblems{$problem->set_id} && - $validproblems{$problem->set_id}{$problem->problem_id} && - $problem->status == 1 && - $problem->num_correct == 1) { - return 1; - } - - return 0; - - -# -You have access to a variety of variables: -# - $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->last_answer : the last answer submitted -# - $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 -# -# - $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. The data in this hash will *not* be accessable -# by other achievements. If you plan to store something in this hash you have -# to write code to initialize the data. -# -# - $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. Like $localData, you need to -# initialize any variable you plan on using in this hash. 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->{completeProblems} : 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 -# on 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 in, or you need to pay very close attention -# to which evaluators are run and when. diff --git a/courses.dist/modelCourse/templates/achievements/la_revolucion.at b/courses.dist/modelCourse/templates/achievements/la_revolucion.at deleted file mode 100644 index ddf33ec21a..0000000000 --- a/courses.dist/modelCourse/templates/achievements/la_revolucion.at +++ /dev/null @@ -1,88 +0,0 @@ -#This problem checks to see if a particular problem from a list of valid -# sets and problems has been solved. (You would edit this file to say which -# sets and problems count.) - -#constants -my %validproblems = ( - 'SetNameHere' => { #now you show which problems are valid like: - '2' => 1, - '1' => 1, }, #and put more sets here - ); - -#check and see if this problem was solved -if ($validproblems{$problem->set_id} && - $validproblems{$problem->set_id}{$problem->problem_id} && - $problem->status == 1 && - $problem->num_correct == 1) { - return 1; - } - - return 0; - - -# -You have access to a variety of variables: -# - $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->last_answer : the last answer submitted -# - $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 -# -# - $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. The data in this hash will *not* be accessable -# by other achievements. If you plan to store something in this hash you have -# to write code to initialize the data. -# -# - $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. Like $localData, you need to -# initialize any variable you plan on using in this hash. 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->{completeProblems} : 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 -# on 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 in, or you need to pay very close attention -# to which evaluators are run and when. \ No newline at end of file diff --git a/courses.dist/modelCourse/templates/achievements/lagrange_multipliers.at b/courses.dist/modelCourse/templates/achievements/lagrange_multipliers.at deleted file mode 100644 index 491560c4dd..0000000000 --- a/courses.dist/modelCourse/templates/achievements/lagrange_multipliers.at +++ /dev/null @@ -1,88 +0,0 @@ -#This problem checks to see if a particular problem from a list of valid -# sets and problems has been solved. (You would edit this file to say which -# sets and problems count.) - -#constants -my %validproblems = ( - 'SetNameHere' => { #now you show which problems are valid like: - '2' => 1, - '1' => 1, }, #and put more sets here - ); - -#check and see if this problem was solved -if ($validproblems{$problem->set_id} && - $validproblems{$problem->set_id}{$problem->problem_id} && - $problem->status == 1 && - $problem->num_correct == 1) { - return 1; - } - - return 0; - - -# -You have access to a variety of variables: -# - $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->last_answer : the last answer submitted -# - $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 -# -# - $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. The data in this hash will *not* be accessable -# by other achievements. If you plan to store something in this hash you have -# to write code to initialize the data. -# -# - $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. Like $localData, you need to -# initialize any variable you plan on using in this hash. 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->{completeProblems} : 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 -# on 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 in, or you need to pay very close attention -# to which evaluators are run and when. diff --git a/courses.dist/modelCourse/templates/achievements/last_minute.at b/courses.dist/modelCourse/templates/achievements/last_minute.at index 7e4932ae92..30736c541f 100644 --- a/courses.dist/modelCourse/templates/achievements/last_minute.at +++ b/courses.dist/modelCourse/templates/achievements/last_minute.at @@ -1,88 +1,14 @@ -# checks to see if a student finished a set close to the due date +# Achievement is awarded if the set is completed within thirty +# minutes of the due date. +# +# See [templates]/achievements/achievement_readme.txt for details. + +# Check if this set has been completed. +return 0 unless $globalData->{completedSetIds}{ $set->set_id }; -# Check that this is not a repeated submission of problem which has -# been solved before. # Do not consider this achievement if this is a repeated submission # of previously solved problem. +return 0 unless $problem->num_correct == 1; -return 0 unless ($problem->status == 1 && $problem->num_correct == 1); - - #test to see if it is within 30 min of the due date - if (($set->due_date - time()) > 1800) { - return 0; - } - - foreach my $problemRecord (@setProblems) { - if ($problemRecord->status != 1) { - return 0; - } - } - - return 1; - -# -You have access to a variety of variables: -# - $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->last_answer : the last answer submitted -# - $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 -# -# - $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. The data in this hash will *not* be accessable -# by other achievements. If you plan to store something in this hash you have -# to write code to initialize the data. -# -# - $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. Like $localData, you need to -# initialize any variable you plan on using in this hash. 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->{completeProblems} : 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 -# on 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 in, or you need to pay very close attention -# to which evaluators are run and when. +# Thirty minutes = 30 * 60 = 1800 seconds. +return $set->due_date - time > 1800 ? 0 : 1; diff --git a/courses.dist/modelCourse/templates/achievements/level_eight.at b/courses.dist/modelCourse/templates/achievements/level_eight.at index 6de08487d3..8dd529a5e8 100644 --- a/courses.dist/modelCourse/templates/achievements/level_eight.at +++ b/courses.dist/modelCourse/templates/achievements/level_eight.at @@ -1,91 +1,22 @@ # This is a "level" achievement and they behave slightly differently. When -# a level achievement is earned the system uses the icon and title of the +# a level achievement is earned the system uses the icon and title of the # level achievement as the icon and title of that students level. There -# are two additional variables available to level achievements -# - $achievementPoints : the number of achievement points the current +# are two additional variables available to level achievements: +# - $achievementPoints: the number of achievement points the current # user has. (Changes to this variable will *not* be saved.) -# - $nextLevelPoints : the number of points needed to earn a level. -# (Changes to this variable will be saved if a new level is earned.) -# These variables are used to construct the users level progress bar +# - $nextLevelPoints: the number of points needed to earn a level. +# (Changes to this variable will be saved if a new level is earned.) +# These variables are used to construct the users level progress bar. +# +# This evaluator updates next level threshold and awards achievement items. -#Constants: -#Threshold for level 9 +# Threshold for level 9 my $newLevelThreshold = 1200; -#Code - if ($achievementPoints >= $nextLevelPoints) { - #set new threshold and return 1 - $globalData->{DoubleSet}++; - $nextLevelPoints = $newLevelThreshold; - return 1; -} else { - return 0; + $nextLevelPoints = $newLevelThreshold; + ++$globalData->{DoubleSet}; + return 1; } -# 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->last_answer : the last answer submitted -# - $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 -# -# - $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. The data in this hash will *not* be accessable -# by other achievements. If you plan to store something in this hash you have -# to write code to initialize the data. -# -# - $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. Like $localData, you need to -# initialize any variable you plan on using in this hash. 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 -# on 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 in, or you need to pay very close attention -# to which evaluators are run and when. \ No newline at end of file +return 0; diff --git a/courses.dist/modelCourse/templates/achievements/level_five.at b/courses.dist/modelCourse/templates/achievements/level_five.at index ab70832489..a22c38276e 100644 --- a/courses.dist/modelCourse/templates/achievements/level_five.at +++ b/courses.dist/modelCourse/templates/achievements/level_five.at @@ -1,91 +1,22 @@ # This is a "level" achievement and they behave slightly differently. When -# a level achievement is earned the system uses the icon and title of the +# a level achievement is earned the system uses the icon and title of the # level achievement as the icon and title of that students level. There -# are two additional variables available to level achievements -# - $achievementPoints : the number of achievement points the current +# are two additional variables available to level achievements: +# - $achievementPoints: the number of achievement points the current # user has. (Changes to this variable will *not* be saved.) -# - $nextLevelPoints : the number of points needed to earn a level. -# (Changes to this variable will be saved if a new level is earned.) -# These variables are used to construct the users level progress bar +# - $nextLevelPoints: the number of points needed to earn a level. +# (Changes to this variable will be saved if a new level is earned.) +# These variables are used to construct the users level progress bar. +# +# This evaluator updates next level threshold and awards achievement items. -#Constants: -#Threshold for level 6 +# Threshold for level 6 my $newLevelThreshold = 750; -#Code - if ($achievementPoints >= $nextLevelPoints) { - #set new threshold and return 1 - $globalData->{DuplicateProb}++; - $nextLevelPoints = $newLevelThreshold; - return 1; -} else { - return 0; + $nextLevelPoints = $newLevelThreshold; + ++$globalData->{DuplicateProb}; + return 1; } -# 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->last_answer : the last answer submitted -# - $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 -# -# - $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. The data in this hash will *not* be accessable -# by other achievements. If you plan to store something in this hash you have -# to write code to initialize the data. -# -# - $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. Like $localData, you need to -# initialize any variable you plan on using in this hash. 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 -# on 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 in, or you need to pay very close attention -# to which evaluators are run and when. \ No newline at end of file +return 0; diff --git a/courses.dist/modelCourse/templates/achievements/level_four.at b/courses.dist/modelCourse/templates/achievements/level_four.at index b7bbe3e4f0..695b77a1a7 100644 --- a/courses.dist/modelCourse/templates/achievements/level_four.at +++ b/courses.dist/modelCourse/templates/achievements/level_four.at @@ -1,91 +1,22 @@ # This is a "level" achievement and they behave slightly differently. When -# a level achievement is earned the system uses the icon and title of the +# a level achievement is earned the system uses the icon and title of the # level achievement as the icon and title of that students level. There -# are two additional variables available to level achievements -# - $achievementPoints : the number of achievement points the current +# are two additional variables available to level achievements: +# - $achievementPoints: the number of achievement points the current # user has. (Changes to this variable will *not* be saved.) -# - $nextLevelPoints : the number of points needed to earn a level. -# (Changes to this variable will be saved if a new level is earned.) -# These variables are used to construct the users level progress bar +# - $nextLevelPoints: the number of points needed to earn a level. +# (Changes to this variable will be saved if a new level is earned.) +# These variables are used to construct the users level progress bar. +# +# This evaluator updates next level threshold and awards achievement items. -#Constants: -#Threshold for level 5 +# Threshold for level 5 my $newLevelThreshold = 600; -#Code - if ($achievementPoints >= $nextLevelPoints) { - #set new threshold and return 1 - $globalData->{DoubleProb}++; - $nextLevelPoints = $newLevelThreshold; - return 1; -} else { - return 0; + $nextLevelPoints = $newLevelThreshold; + ++$globalData->{DoubleProb}; + return 1; } -# 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->last_answer : the last answer submitted -# - $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 -# -# - $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. The data in this hash will *not* be accessable -# by other achievements. If you plan to store something in this hash you have -# to write code to initialize the data. -# -# - $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. Like $localData, you need to -# initialize any variable you plan on using in this hash. 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 -# on 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 in, or you need to pay very close attention -# to which evaluators are run and when. \ No newline at end of file +return 0; diff --git a/courses.dist/modelCourse/templates/achievements/level_nine.at b/courses.dist/modelCourse/templates/achievements/level_nine.at index de4874a15e..611014bfe3 100644 --- a/courses.dist/modelCourse/templates/achievements/level_nine.at +++ b/courses.dist/modelCourse/templates/achievements/level_nine.at @@ -1,91 +1,22 @@ # This is a "level" achievement and they behave slightly differently. When -# a level achievement is earned the system uses the icon and title of the +# a level achievement is earned the system uses the icon and title of the # level achievement as the icon and title of that students level. There -# are two additional variables available to level achievements -# - $achievementPoints : the number of achievement points the current +# are two additional variables available to level achievements: +# - $achievementPoints: the number of achievement points the current # user has. (Changes to this variable will *not* be saved.) -# - $nextLevelPoints : the number of points needed to earn a level. -# (Changes to this variable will be saved if a new level is earned.) -# These variables are used to construct the users level progress bar +# - $nextLevelPoints: the number of points needed to earn a level. +# (Changes to this variable will be saved if a new level is earned.) +# These variables are used to construct the users level progress bar. +# +# This evaluator updates next level threshold and awards achievement items. -#Constants: -#Level 10 threshold +# Threshold for level 10 my $newLevelThreshold = 1350; -#Code - if ($achievementPoints >= $nextLevelPoints) { - #set new threshold and return 1 - $globalData->{ResurrectHW}++; - $nextLevelPoints = $newLevelThreshold; - return 1; -} else { - return 0; + $nextLevelPoints = $newLevelThreshold; + ++$globalData->{ResurrectHW}; + return 1; } -# 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->last_answer : the last answer submitted -# - $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 -# -# - $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. The data in this hash will *not* be accessable -# by other achievements. If you plan to store something in this hash you have -# to write code to initialize the data. -# -# - $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. Like $localData, you need to -# initialize any variable you plan on using in this hash. 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 -# on 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 in, or you need to pay very close attention -# to which evaluators are run and when. +return 0; diff --git a/courses.dist/modelCourse/templates/achievements/level_one.at b/courses.dist/modelCourse/templates/achievements/level_one.at index 7fac596d0e..358e63968f 100644 --- a/courses.dist/modelCourse/templates/achievements/level_one.at +++ b/courses.dist/modelCourse/templates/achievements/level_one.at @@ -1,89 +1,20 @@ # This is a "level" achievement and they behave slightly differently. When -# a level achievement is earned the system uses the icon and title of the +# a level achievement is earned the system uses the icon and title of the # level achievement as the icon and title of that students level. There -# are two additional variables available to level achievements -# - $achievementPoints : the number of achievement points the current +# are two additional variables available to level achievements: +# - $achievementPoints: the number of achievement points the current # user has. (Changes to this variable will *not* be saved.) -# - $nextLevelPoints : the number of points needed to earn a level. -# (Changes to this variable will be saved if a new level is earned.) -# These variables are used to construct the users level progress bar - -#Constants: -#Threshold for level 2 -my $newLevelThreshold = 150; +# - $nextLevelPoints: the number of points needed to earn a level. +# (Changes to this variable will be saved if a new level is earned.) +# These variables are used to construct the users level progress bar. +# +# Level 1 is earned immediately and configures how many achievement +# points are needed for level 2. -$globalData->{HalfCreditProb}++; +# Threshold for level 2. +$nextLevelPoints = 150; -#Code +# Award achievement item. +++$globalData->{HalfCreditProb}; -#level 1 is earned immediately -$nextLevelPoints = $newLevelThreshold; return 1; - - -# 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->last_answer : the last answer submitted -# - $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 -# -# - $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. The data in this hash will *not* be accessable -# by other achievements. If you plan to store something in this hash you have -# to write code to initialize the data. -# -# - $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. Like $localData, you need to -# initialize any variable you plan on using in this hash. 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 -# on 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 in, or you need to pay very close attention -# to which evaluators are run and when. \ No newline at end of file diff --git a/courses.dist/modelCourse/templates/achievements/level_seven.at b/courses.dist/modelCourse/templates/achievements/level_seven.at index 9c2095363c..2238564d34 100644 --- a/courses.dist/modelCourse/templates/achievements/level_seven.at +++ b/courses.dist/modelCourse/templates/achievements/level_seven.at @@ -1,91 +1,22 @@ # This is a "level" achievement and they behave slightly differently. When -# a level achievement is earned the system uses the icon and title of the +# a level achievement is earned the system uses the icon and title of the # level achievement as the icon and title of that students level. There -# are two additional variables available to level achievements -# - $achievementPoints : the number of achievement points the current +# are two additional variables available to level achievements: +# - $achievementPoints: the number of achievement points the current # user has. (Changes to this variable will *not* be saved.) -# - $nextLevelPoints : the number of points needed to earn a level. -# (Changes to this variable will be saved if a new level is earned.) -# These variables are used to construct the users level progress bar +# - $nextLevelPoints: the number of points needed to earn a level. +# (Changes to this variable will be saved if a new level is earned.) +# These variables are used to construct the users level progress bar. +# +# This evaluator updates next level threshold and awards achievement items. -#Constants: -#Threshold for level 8 +# Threshold for level 8 my $newLevelThreshold = 1050; -#Code - if ($achievementPoints >= $nextLevelPoints) { - #set new threshold and return 1 - $globalData->{SuperExtendDueDate}++; - $nextLevelPoints = $newLevelThreshold; - return 1; -} else { - return 0; + $nextLevelPoints = $newLevelThreshold; + ++$globalData->{SuperExtendDueDate}; + return 1; } -# 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->last_answer : the last answer submitted -# - $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 -# -# - $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. The data in this hash will *not* be accessable -# by other achievements. If you plan to store something in this hash you have -# to write code to initialize the data. -# -# - $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. Like $localData, you need to -# initialize any variable you plan on using in this hash. 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 -# on 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 in, or you need to pay very close attention -# to which evaluators are run and when. \ No newline at end of file +return 0; diff --git a/courses.dist/modelCourse/templates/achievements/level_six.at b/courses.dist/modelCourse/templates/achievements/level_six.at index 89bee15a3d..c019a9b4ce 100644 --- a/courses.dist/modelCourse/templates/achievements/level_six.at +++ b/courses.dist/modelCourse/templates/achievements/level_six.at @@ -1,91 +1,22 @@ # This is a "level" achievement and they behave slightly differently. When -# a level achievement is earned the system uses the icon and title of the +# a level achievement is earned the system uses the icon and title of the # level achievement as the icon and title of that students level. There -# are two additional variables available to level achievements -# - $achievementPoints : the number of achievement points the current +# are two additional variables available to level achievements: +# - $achievementPoints: the number of achievement points the current # user has. (Changes to this variable will *not* be saved.) -# - $nextLevelPoints : the number of points needed to earn a level. -# (Changes to this variable will be saved if a new level is earned.) -# These variables are used to construct the users level progress bar +# - $nextLevelPoints: the number of points needed to earn a level. +# (Changes to this variable will be saved if a new level is earned.) +# These variables are used to construct the users level progress bar. +# +# This evaluator updates next level threshold and awards achievement items. -#Constants: -#Threshold for level 7 +# Threshold for level 7 my $newLevelThreshold = 900; -#Code - if ($achievementPoints >= $nextLevelPoints) { - #set new threshold and return 1 - $globalData->{FullCreditProb}++; - $nextLevelPoints = $newLevelThreshold; - return 1; -} else { - return 0; + $nextLevelPoints = $newLevelThreshold; + ++$globalData->{FullCreditProb}; + return 1; } -# 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->last_answer : the last answer submitted -# - $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 -# -# - $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. The data in this hash will *not* be accessable -# by other achievements. If you plan to store something in this hash you have -# to write code to initialize the data. -# -# - $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. Like $localData, you need to -# initialize any variable you plan on using in this hash. 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 -# on 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 in, or you need to pay very close attention -# to which evaluators are run and when. \ No newline at end of file +return 0; diff --git a/courses.dist/modelCourse/templates/achievements/level_ten.at b/courses.dist/modelCourse/templates/achievements/level_ten.at index f114a106fe..48d15521bb 100644 --- a/courses.dist/modelCourse/templates/achievements/level_ten.at +++ b/courses.dist/modelCourse/templates/achievements/level_ten.at @@ -1,91 +1,22 @@ # This is a "level" achievement and they behave slightly differently. When -# a level achievement is earned the system uses the icon and title of the +# a level achievement is earned the system uses the icon and title of the # level achievement as the icon and title of that students level. There -# are two additional variables available to level achievements -# - $achievementPoints : the number of achievement points the current +# are two additional variables available to level achievements: +# - $achievementPoints: the number of achievement points the current # user has. (Changes to this variable will *not* be saved.) -# - $nextLevelPoints : the number of points needed to earn a level. -# (Changes to this variable will be saved if a new level is earned.) -# These variables are used to construct the users level progress bar +# - $nextLevelPoints: the number of points needed to earn a level. +# (Changes to this variable will be saved if a new level is earned.) +# These variables are used to construct the users level progress bar. +# +# This evaluator updates next level threshold and awards achievement items. -#Constants: -#Level 10 is the last level so dont set a threshhold to remove the progress bar +# Level 10 is the last level, so set to '' to remove the progress bar. my $newLevelThreshold = ''; -#Code - if ($achievementPoints >= $nextLevelPoints) { - #set new threshold and return 1 - $globalData->{FullCreditSet}++; - $nextLevelPoints = $newLevelThreshold; - return 1; -} else { - return 0; + $nextLevelPoints = $newLevelThreshold; + ++$globalData->{FullCreditSet}; + return 1; } -# 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->last_answer : the last answer submitted -# - $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 -# -# - $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. The data in this hash will *not* be accessable -# by other achievements. If you plan to store something in this hash you have -# to write code to initialize the data. -# -# - $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. Like $localData, you need to -# initialize any variable you plan on using in this hash. 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 -# on 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 in, or you need to pay very close attention -# to which evaluators are run and when. \ No newline at end of file +return 0; diff --git a/courses.dist/modelCourse/templates/achievements/level_three.at b/courses.dist/modelCourse/templates/achievements/level_three.at index b7964cee4c..aa826f5fe7 100644 --- a/courses.dist/modelCourse/templates/achievements/level_three.at +++ b/courses.dist/modelCourse/templates/achievements/level_three.at @@ -1,91 +1,22 @@ # This is a "level" achievement and they behave slightly differently. When -# a level achievement is earned the system uses the icon and title of the +# a level achievement is earned the system uses the icon and title of the # level achievement as the icon and title of that students level. There -# are two additional variables available to level achievements -# - $achievementPoints : the number of achievement points the current +# are two additional variables available to level achievements: +# - $achievementPoints: the number of achievement points the current # user has. (Changes to this variable will *not* be saved.) -# - $nextLevelPoints : the number of points needed to earn a level. -# (Changes to this variable will be saved if a new level is earned.) -# These variables are used to construct the users level progress bar +# - $nextLevelPoints: the number of points needed to earn a level. +# (Changes to this variable will be saved if a new level is earned.) +# These variables are used to construct the users level progress bar. +# +# This evaluator updates next level threshold and awards achievement items. -#Constants: -#Threshold for level 4 +# Threshold for level 4 my $newLevelThreshold = 450; -#Code - if ($achievementPoints >= $nextLevelPoints) { - #set new threshold and return 1 - $globalData->{ExtendDueDate}++; - $nextLevelPoints = $newLevelThreshold; - return 1; -} else { - return 0; + $nextLevelPoints = $newLevelThreshold; + ++$globalData->{ExtendDueDate}; + return 1; } -# 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->last_answer : the last answer submitted -# - $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 -# -# - $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. The data in this hash will *not* be accessable -# by other achievements. If you plan to store something in this hash you have -# to write code to initialize the data. -# -# - $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. Like $localData, you need to -# initialize any variable you plan on using in this hash. 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 -# on 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 in, or you need to pay very close attention -# to which evaluators are run and when. \ No newline at end of file +return 0; diff --git a/courses.dist/modelCourse/templates/achievements/level_two.at b/courses.dist/modelCourse/templates/achievements/level_two.at index 92528d9ef4..e4955ed38d 100644 --- a/courses.dist/modelCourse/templates/achievements/level_two.at +++ b/courses.dist/modelCourse/templates/achievements/level_two.at @@ -1,91 +1,22 @@ # This is a "level" achievement and they behave slightly differently. When -# a level achievement is earned the system uses the icon and title of the +# a level achievement is earned the system uses the icon and title of the # level achievement as the icon and title of that students level. There -# are two additional variables available to level achievements -# - $achievementPoints : the number of achievement points the current +# are two additional variables available to level achievements: +# - $achievementPoints: the number of achievement points the current # user has. (Changes to this variable will *not* be saved.) -# - $nextLevelPoints : the number of points needed to earn a level. -# (Changes to this variable will be saved if a new level is earned.) -# These variables are used to construct the users level progress bar +# - $nextLevelPoints: the number of points needed to earn a level. +# (Changes to this variable will be saved if a new level is earned.) +# These variables are used to construct the users level progress bar. +# +# This evaluator updates next level threshold and awards achievement items. -#Constants: -#Threshold for level 3 +# Threshold for level 3 my $newLevelThreshold = 300; -#Code - if ($achievementPoints >= $nextLevelPoints) { - #set new threshold and return 1 - $nextLevelPoints = $newLevelThreshold; - $globalData->{ResetIncorrectAttempts}++; - return 1; -} else { - return 0; + $nextLevelPoints = $newLevelThreshold; + ++$globalData->{ResetIncorrectAttempts}; + return 1; } -# 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->last_answer : the last answer submitted -# - $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 -# -# - $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. The data in this hash will *not* be accessable -# by other achievements. If you plan to store something in this hash you have -# to write code to initialize the data. -# -# - $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. Like $localData, you need to -# initialize any variable you plan on using in this hash. 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 -# on 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 in, or you need to pay very close attention -# to which evaluators are run and when. \ No newline at end of file +return 0; diff --git a/courses.dist/modelCourse/templates/achievements/line_integrals.at b/courses.dist/modelCourse/templates/achievements/line_integrals.at deleted file mode 100644 index 6a77dd6d1f..0000000000 --- a/courses.dist/modelCourse/templates/achievements/line_integrals.at +++ /dev/null @@ -1,91 +0,0 @@ -#This problem checks to see if a particular problem from a list of valid -# sets and problems has been solved. If it has then it updates the counter -#(You would edit this file to say which sets and problems count.) - -#This problem checks to see if a particular problem from a list of valid -# sets and problems has been solved. (You would edit this file to say which -# sets and problems count.) - -#constants -my %validproblems = ( - 'SetNameHere' => { #now you show which problems are valid like: - '2' => 1, - '1' => 1, }, #and put more sets here - ); - -#check and see if this problem was solved -if ($validproblems{$problem->set_id} && - $validproblems{$problem->set_id}{$problem->problem_id} && - $problem->status == 1 && - $problem->num_correct == 1) { - return 1; - } - - return 0; - -# -You have access to a variety of variables: -# - $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->last_answer : the last answer submitted -# - $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 -# -# - $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. The data in this hash will *not* be accessable -# by other achievements. If you plan to store something in this hash you have -# to write code to initialize the data. -# -# - $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. Like $localData, you need to -# initialize any variable you plan on using in this hash. 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->{completeProblems} : 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 -# on 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 in, or you need to pay very close attention -# to which evaluators are run and when. \ No newline at end of file diff --git a/courses.dist/modelCourse/templates/achievements/lines_and_planes.at b/courses.dist/modelCourse/templates/achievements/lines_and_planes.at deleted file mode 100644 index 8d03977cea..0000000000 --- a/courses.dist/modelCourse/templates/achievements/lines_and_planes.at +++ /dev/null @@ -1,96 +0,0 @@ -#This problem checks to see if a particular problem from a list of valid -# sets and problems has been solved. If it has then it updates the counter -#(You would edit this file to say which sets and problems count.) - -#constants -my %validproblems = ( - 'SetNameHere' => { #now you show which problems are valid like: - '1' => 1, - '2' => 1, - '3' => 1, - '4' => 1, - '5' => 1, - '6' => 1, }, #and put more sets here - ); - -#check and see if this problem was solved -if ($validproblems{$problem->set_id} && - $validproblems{$problem->set_id}{$problem->problem_id} && - $problem->status == 1 && - $problem->num_correct == 1) { - #update counter; - $counter++; - } - -if ($counter >= $maxCounter) { - return 1; -} else { - return 0; -} - -# -You have access to a variety of variables: -# - $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->last_answer : the last answer submitted -# - $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 -# -# - $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. The data in this hash will *not* be accessable -# by other achievements. If you plan to store something in this hash you have -# to write code to initialize the data. -# -# - $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. Like $localData, you need to -# initialize any variable you plan on using in this hash. 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->{completeProblems} : 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 -# on 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 in, or you need to pay very close attention -# to which evaluators are run and when. diff --git a/courses.dist/modelCourse/templates/achievements/many_fractions.at b/courses.dist/modelCourse/templates/achievements/many_fractions.at deleted file mode 100644 index 491560c4dd..0000000000 --- a/courses.dist/modelCourse/templates/achievements/many_fractions.at +++ /dev/null @@ -1,88 +0,0 @@ -#This problem checks to see if a particular problem from a list of valid -# sets and problems has been solved. (You would edit this file to say which -# sets and problems count.) - -#constants -my %validproblems = ( - 'SetNameHere' => { #now you show which problems are valid like: - '2' => 1, - '1' => 1, }, #and put more sets here - ); - -#check and see if this problem was solved -if ($validproblems{$problem->set_id} && - $validproblems{$problem->set_id}{$problem->problem_id} && - $problem->status == 1 && - $problem->num_correct == 1) { - return 1; - } - - return 0; - - -# -You have access to a variety of variables: -# - $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->last_answer : the last answer submitted -# - $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 -# -# - $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. The data in this hash will *not* be accessable -# by other achievements. If you plan to store something in this hash you have -# to write code to initialize the data. -# -# - $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. Like $localData, you need to -# initialize any variable you plan on using in this hash. 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->{completeProblems} : 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 -# on 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 in, or you need to pay very close attention -# to which evaluators are run and when. diff --git a/courses.dist/modelCourse/templates/achievements/n_correct_in_a_row.at b/courses.dist/modelCourse/templates/achievements/n_correct_in_a_row.at new file mode 100644 index 0000000000..55a8ad495b --- /dev/null +++ b/courses.dist/modelCourse/templates/achievements/n_correct_in_a_row.at @@ -0,0 +1,18 @@ +# This achievement is awarded for answering n problems in a row without +# any incorrect answers. This is done by resetting the $counter for any +# incorrect submit. This can be used by multiple achievements, so just +# set the $maxCounter to determine how many in the row are needed. +# +# See [templates]/achievements/achievement_readme.txt for details. + +# Reset counter if they got something wrong. +if ($problem->status < 1) { + $counter = 0; + return 0; +} + +# Only increase the counter if this is the first time they got +# got the problem correct. +++$counter if $problem->num_correct == 1 && $problem->num_incorrect == 0; + +return $counter >= $maxCounter ? 1 : 0; diff --git a/courses.dist/modelCourse/templates/achievements/night_owl.at b/courses.dist/modelCourse/templates/achievements/night_owl.at index 3507e88528..8a0913508c 100644 --- a/courses.dist/modelCourse/templates/achievements/night_owl.at +++ b/courses.dist/modelCourse/templates/achievements/night_owl.at @@ -1,94 +1,14 @@ -# checks to see if a student finished a set between 12AM and 2AM +# This achievement is awarded for completing a set between 12AM and 2AM. +# +# See [templates]/achievements/achievement_readme.txt for details. -# Check that this is not a repeated submission of problem which has -# been solved before. # Do not consider this achievement if this is a repeated submission # of previously solved problem. +return 0 unless $problem->status == 1 && $problem->num_correct == 1; -return 0 unless ($problem->status == 1 && $problem->num_correct == 1); - - #test to see if it is between midnight and 2am - if ($courseDateTime[2] > 1) { - return 0; - } - - #if it is check to see if we have finished the set - - foreach my $problemRecord (@setProblems) { - if ($problemRecord->status != 1) { - return 0; - } - } - - return 1; +# Now check if this set has been completed. +return 0 unless $globalData->{completedSetIds}{ $set->set_id }; -# -You have access to a variety of variables: -# - $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->last_answer : the last answer submitted -# - $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 -# -# - $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. The data in this hash will *not* be accessable -# by other achievements. If you plan to store something in this hash you have -# to write code to initialize the data. -# -# - $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. Like $localData, you need to -# initialize any variable you plan on using in this hash. 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->{completeProblems} : 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 -# on 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 in, or you need to pay very close attention -# to which evaluators are run and when. -# -# - @courseDateTime - array of time information in course timezone -# (sec,min,hour,day,month,year,day_of_week) as produced by -# https://metacpan.org/pod/DateTime +# Finally check the time. $courseDateTime[2] is the hour in the +# course's timezone. +return $courseDateTime[2] > 1 ? 0 : 1; diff --git a/courses.dist/modelCourse/templates/achievements/on_fire.at b/courses.dist/modelCourse/templates/achievements/on_fire.at deleted file mode 100644 index baddd04e8f..0000000000 --- a/courses.dist/modelCourse/templates/achievements/on_fire.at +++ /dev/null @@ -1,86 +0,0 @@ -#This checks to see if the student has solved 10 problems without having any -# incorrect answers - -# reset counter if they got something wrong -if ($problem->status < 1) { - $counter = 0; - return 0; -# if they are right update the counter -} elsif ($problem->status == 1 && - $problem->num_correct == 1 && - $problem->num_incorrect == 0 ) { - $counter++; -} - -if ($counter >= $maxCounter) { - return 1; -} else { - return 0; -} - -# -You have access to a variety of variables: -# - $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->last_answer : the last answer submitted -# - $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 -# -# - $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. The data in this hash will *not* be accessable -# by other achievements. If you plan to store something in this hash you have -# to write code to initialize the data. -# -# - $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. Like $localData, you need to -# initialize any variable you plan on using in this hash. 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->{completeProblems} : 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 -# on 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 in, or you need to pay very close attention -# to which evaluators are run and when. diff --git a/courses.dist/modelCourse/templates/achievements/on_one_hand.at b/courses.dist/modelCourse/templates/achievements/on_one_hand.at index 26ec33c507..22153be0f0 100644 --- a/courses.dist/modelCourse/templates/achievements/on_one_hand.at +++ b/courses.dist/modelCourse/templates/achievements/on_one_hand.at @@ -1,82 +1,16 @@ -#This checks to see if the student has finished the set -# with fewer than a certain number of incorrect submissions - - my $numfails = 0; +# This achievement is awarded for finishing a set with fewer than +# 5 incorrect submissions. +# +# See [templates]/achievements/achievement_readme.txt for details. - #cycle through and leave if we have too many incorrects or a wrong problem - foreach my $problemRecord (@setProblems) { - $numfails += $problemRecord->num_incorrect; - if ($problemRecord->status != 1 || $numfails >5) { - return 0; - } - } - - return 1; +# Check if set is complete. +return 0 unless $globalData->{completedSetIds}{ $set->set_id }; +# Count up the number of incorrect submissions. +my $numIncorrect = 0; +for my $problemRecord (@setProblems) { + $numIncorrect += $problemRecord->num_incorrect; + return 0 if $numIncorrect > 5; +} -# -You have access to a variety of variables: -# - $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->last_answer : the last answer submitted -# - $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 -# -# - $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. The data in this hash will *not* be accessable -# by other achievements. If you plan to store something in this hash you have -# to write code to initialize the data. -# -# - $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. Like $localData, you need to -# initialize any variable you plan on using in this hash. 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->{completeProblems} : 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 -# on 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 in, or you need to pay very close attention -# to which evaluators are run and when. \ No newline at end of file +return 1; diff --git a/courses.dist/modelCourse/templates/achievements/on_the_hour.at b/courses.dist/modelCourse/templates/achievements/on_the_hour.at index be89f3f4ba..a9620ac641 100644 --- a/courses.dist/modelCourse/templates/achievements/on_the_hour.at +++ b/courses.dist/modelCourse/templates/achievements/on_the_hour.at @@ -1,81 +1,10 @@ -# checks to see if a studen finished a problem at the top of an hour - my @timeData = localtime(time); - - #test to see if it is near the top of an hour - if ($timeData[1] > 0) { - return 0; - } +# This achievement is awarded if a problem is completed at the +# top of an hour. +# +# See [templates]/achievements/achievement_readme.txt for details. - #test to see if the problem is correct and this is the first run - if ($problem-> status != 1 || $problem->num_correct != 1) { - return 0; - } - - return 1; +# Check to see if is the top of an hour. +return 0 unless $courseDateTime[1] == 0; -# -You have access to a variety of variables: -# - $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->last_answer : the last answer submitted -# - $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 -# -# - $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. The data in this hash will *not* be accessable -# by other achievements. If you plan to store something in this hash you have -# to write code to initialize the data. -# -# - $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. Like $localData, you need to -# initialize any variable you plan on using in this hash. 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->{completeProblems} : 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 -# on 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 in, or you need to pay very close attention -# to which evaluators are run and when. \ No newline at end of file +# Check to see if the problem is completed and this is the first time. +return $problem->status == 1 && $problem->num_correct == 1 ? 1 : 0; diff --git a/courses.dist/modelCourse/templates/achievements/one_click.at b/courses.dist/modelCourse/templates/achievements/one_click.at index 837eaf26e9..95b2c2ff0f 100644 --- a/courses.dist/modelCourse/templates/achievements/one_click.at +++ b/courses.dist/modelCourse/templates/achievements/one_click.at @@ -1,76 +1,6 @@ -#This checks to see if the student has finished the problem with no -# incorrect submissions - - if ($problem->status == 1 && $problem->num_incorrect == 0) { - return 1; - } else { - return 0; - } - - -# -You have access to a variety of variables: -# - $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->last_answer : the last answer submitted -# - $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 '' +# This achievement is awarded for completing a problem with no +# incorrect submissions. # -# - $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 -# -# - $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. The data in this hash will *not* be accessable -# by other achievements. If you plan to store something in this hash you have -# to write code to initialize the data. -# -# - $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. Like $localData, you need to -# initialize any variable you plan on using in this hash. 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->{completeProblems} : 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 -# on 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 in, or you need to pay very close attention -# to which evaluators are run and when. \ No newline at end of file +# See [templates]/achievements/achievement_readme.txt for details. + +return $problem->status == 1 && $problem->num_incorrect == 0 ? 1 : 0; diff --git a/courses.dist/modelCourse/templates/achievements/optimizer_prime.at b/courses.dist/modelCourse/templates/achievements/optimizer_prime.at deleted file mode 100644 index 491560c4dd..0000000000 --- a/courses.dist/modelCourse/templates/achievements/optimizer_prime.at +++ /dev/null @@ -1,88 +0,0 @@ -#This problem checks to see if a particular problem from a list of valid -# sets and problems has been solved. (You would edit this file to say which -# sets and problems count.) - -#constants -my %validproblems = ( - 'SetNameHere' => { #now you show which problems are valid like: - '2' => 1, - '1' => 1, }, #and put more sets here - ); - -#check and see if this problem was solved -if ($validproblems{$problem->set_id} && - $validproblems{$problem->set_id}{$problem->problem_id} && - $problem->status == 1 && - $problem->num_correct == 1) { - return 1; - } - - return 0; - - -# -You have access to a variety of variables: -# - $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->last_answer : the last answer submitted -# - $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 -# -# - $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. The data in this hash will *not* be accessable -# by other achievements. If you plan to store something in this hash you have -# to write code to initialize the data. -# -# - $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. Like $localData, you need to -# initialize any variable you plan on using in this hash. 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->{completeProblems} : 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 -# on 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 in, or you need to pay very close attention -# to which evaluators are run and when. diff --git a/courses.dist/modelCourse/templates/achievements/partial_derivatives.at b/courses.dist/modelCourse/templates/achievements/partial_derivatives.at deleted file mode 100644 index 692a1fe2f8..0000000000 --- a/courses.dist/modelCourse/templates/achievements/partial_derivatives.at +++ /dev/null @@ -1,94 +0,0 @@ -#This problem checks to see if a particular problem from a list of valid -# sets and problems has been solved. If it has then it updates the counter -#(You would edit this file to say which sets and problems count.) - -#constants -my %validproblems = ( - 'SetNameHere' => { #now you show which problems are valid like: - '1' => 1, - '2' => 1, - '3' => 1, - '5' => 1, }, #and put more sets here - ); - -#check and see if this problem was solved -if ($validproblems{$problem->set_id} && - $validproblems{$problem->set_id}{$problem->problem_id} && - $problem->status == 1 && - $problem->num_correct == 1) { - #update counter; - $counter++; - } - -if ($counter >= $maxCounter) { - return 1; -} else { - return 0; -} - -# -You have access to a variety of variables: -# - $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->last_answer : the last answer submitted -# - $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 -# -# - $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. The data in this hash will *not* be accessable -# by other achievements. If you plan to store something in this hash you have -# to write code to initialize the data. -# -# - $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. Like $localData, you need to -# initialize any variable you plan on using in this hash. 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->{completeProblems} : 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 -# on 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 in, or you need to pay very close attention -# to which evaluators are run and when. diff --git a/courses.dist/modelCourse/templates/achievements/pattern_recognition.at b/courses.dist/modelCourse/templates/achievements/pattern_recognition.at deleted file mode 100644 index 491560c4dd..0000000000 --- a/courses.dist/modelCourse/templates/achievements/pattern_recognition.at +++ /dev/null @@ -1,88 +0,0 @@ -#This problem checks to see if a particular problem from a list of valid -# sets and problems has been solved. (You would edit this file to say which -# sets and problems count.) - -#constants -my %validproblems = ( - 'SetNameHere' => { #now you show which problems are valid like: - '2' => 1, - '1' => 1, }, #and put more sets here - ); - -#check and see if this problem was solved -if ($validproblems{$problem->set_id} && - $validproblems{$problem->set_id}{$problem->problem_id} && - $problem->status == 1 && - $problem->num_correct == 1) { - return 1; - } - - return 0; - - -# -You have access to a variety of variables: -# - $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->last_answer : the last answer submitted -# - $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 -# -# - $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. The data in this hash will *not* be accessable -# by other achievements. If you plan to store something in this hash you have -# to write code to initialize the data. -# -# - $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. Like $localData, you need to -# initialize any variable you plan on using in this hash. 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->{completeProblems} : 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 -# on 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 in, or you need to pay very close attention -# to which evaluators are run and when. diff --git a/courses.dist/modelCourse/templates/achievements/persistence.at b/courses.dist/modelCourse/templates/achievements/persistence.at index 33d18f7d8e..c2e7416b54 100644 --- a/courses.dist/modelCourse/templates/achievements/persistence.at +++ b/courses.dist/modelCourse/templates/achievements/persistence.at @@ -1,76 +1,13 @@ -#This checks to see if the student has solved the problem after a certain -# number of incorrect attempts - - if ($problem->status == 1 && $problem->num_correct == 1 && $problem->num_incorrect >= 20) { - return 1 - } else { - return 0; - } +# Award this achievement if a student solves a problem after +# answering it incorrectly more than 20 times. +# +# See [templates]/achievements/achievement_readme.txt for details. +if ($problem->status == 1 + && $problem->num_correct == 1 + && $problem->num_incorrect >= 20) +{ + return 1; +} -# -You have access to a variety of variables: -# - $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->last_answer : the last answer submitted -# - $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 -# -# - $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. The data in this hash will *not* be accessable -# by other achievements. If you plan to store something in this hash you have -# to write code to initialize the data. -# -# - $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. Like $localData, you need to -# initialize any variable you plan on using in this hash. 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->{completeProblems} : 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 -# on 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 in, or you need to pay very close attention -# to which evaluators are run and when. \ No newline at end of file +return 0; diff --git a/courses.dist/modelCourse/templates/achievements/preamble.at b/courses.dist/modelCourse/templates/achievements/preamble.at index e69de29bb2..a32ec95b93 100644 --- a/courses.dist/modelCourse/templates/achievements/preamble.at +++ b/courses.dist/modelCourse/templates/achievements/preamble.at @@ -0,0 +1,4 @@ +# This is prepended to the start of every achievement evaluator. Any code +# here will be processed before the actual evaluator code is, and if this +# returns 0 or 1, the actual evaluator will not be processed. + diff --git a/courses.dist/modelCourse/templates/achievements/put_me_in_coach.at b/courses.dist/modelCourse/templates/achievements/put_me_in_coach.at deleted file mode 100644 index 2bf1adc049..0000000000 --- a/courses.dist/modelCourse/templates/achievements/put_me_in_coach.at +++ /dev/null @@ -1,92 +0,0 @@ -#This problem checks to see if a particular problem from a list of valid -# sets and problems has been solved. If it has then it updates the counter -#(You would edit this file to say which sets and problems count.) - -#constants -my %validproblems = ( - 'SetNameHere' => { #now you show which problems are valid like: - '2' => 1, - '1' => 1, }, #and put more sets here - ); - -#check and see if this problem was solved -if ($validproblems{$problem->set_id} && - $validproblems{$problem->set_id}{$problem->problem_id} && - $problem->status == 1 && - $problem->num_correct == 1) { - #update counter; - $counter++; - } - -if ($counter >= $maxCounter) { - return 1; -} else { - return 0; -} - -# -You have access to a variety of variables: -# - $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->last_answer : the last answer submitted -# - $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 -# -# - $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. The data in this hash will *not* be accessable -# by other achievements. If you plan to store something in this hash you have -# to write code to initialize the data. -# -# - $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. Like $localData, you need to -# initialize any variable you plan on using in this hash. 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->{completeProblems} : 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 -# on 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 in, or you need to pay very close attention -# to which evaluators are run and when. \ No newline at end of file diff --git a/courses.dist/modelCourse/templates/achievements/reaching_a_limit.at b/courses.dist/modelCourse/templates/achievements/reaching_a_limit.at deleted file mode 100644 index f49550a862..0000000000 --- a/courses.dist/modelCourse/templates/achievements/reaching_a_limit.at +++ /dev/null @@ -1,93 +0,0 @@ -#This problem checks to see if a particular problem from a list of valid -# sets and problems has been solved. If it has then it updates the counter -#(You would edit this file to say which sets and problems count.) - -#constants -my %validproblems = ( - 'SetNameHere' => { #now you show which problems are valid like: - '2' => 1, - '1' => 1, }, #and put more sets here - ); - -#check and see if this problem was solved -if ($validproblems{$problem->set_id} && - $validproblems{$problem->set_id}{$problem->problem_id} && - $problem->status == 1 && - $problem->num_correct == 1) { - #update counter; - $counter++; - } - -if ($counter >= $maxCounter) { - return 1; -} else { - return 0; -} - - -# -You have access to a variety of variables: -# - $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->last_answer : the last answer submitted -# - $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 -# -# - $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. The data in this hash will *not* be accessable -# by other achievements. If you plan to store something in this hash you have -# to write code to initialize the data. -# -# - $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. Like $localData, you need to -# initialize any variable you plan on using in this hash. 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->{completeProblems} : 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 -# on 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 in, or you need to pay very close attention -# to which evaluators are run and when. diff --git a/courses.dist/modelCourse/templates/achievements/really_early_bird.at b/courses.dist/modelCourse/templates/achievements/really_early_bird.at index 840a07debb..77438d3840 100644 --- a/courses.dist/modelCourse/templates/achievements/really_early_bird.at +++ b/courses.dist/modelCourse/templates/achievements/really_early_bird.at @@ -1,82 +1,10 @@ -#This checks to see if the student has finished the set within a certain time - - #test to see if it is before 2 hours after the open date - if ((time()-$set->open_date) > 7200) { - return 0; - } +# This achievement is awarded for completing a set within 2 hours +# or 2 * 60 * 60 = 7200 seconds of it opening. +# +# See [templates]/achievements/achievement_readme.txt for details. - #if it is check to see if we have finished the set - foreach my $problemRecord (@setProblems) { - if ($problemRecord->status != 1) { - return 0; - } - } - - return 1; +# Check if this set has been completed. +return 0 unless $globalData->{completedSetIds}{ $set->set_id }; -# -You have access to a variety of variables: -# - $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->last_answer : the last answer submitted -# - $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 -# -# - $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. The data in this hash will *not* be accessable -# by other achievements. If you plan to store something in this hash you have -# to write code to initialize the data. -# -# - $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. Like $localData, you need to -# initialize any variable you plan on using in this hash. 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->{completeProblems} : 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 -# on 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 in, or you need to pay very close attention -# to which evaluators are run and when. \ No newline at end of file +# Now test if it is before 2 hours after the open date. +return time - $set->open_date > 7200 ? 0 : 1; diff --git a/courses.dist/modelCourse/templates/achievements/revolucion_redux.at b/courses.dist/modelCourse/templates/achievements/revolucion_redux.at deleted file mode 100644 index 491560c4dd..0000000000 --- a/courses.dist/modelCourse/templates/achievements/revolucion_redux.at +++ /dev/null @@ -1,88 +0,0 @@ -#This problem checks to see if a particular problem from a list of valid -# sets and problems has been solved. (You would edit this file to say which -# sets and problems count.) - -#constants -my %validproblems = ( - 'SetNameHere' => { #now you show which problems are valid like: - '2' => 1, - '1' => 1, }, #and put more sets here - ); - -#check and see if this problem was solved -if ($validproblems{$problem->set_id} && - $validproblems{$problem->set_id}{$problem->problem_id} && - $problem->status == 1 && - $problem->num_correct == 1) { - return 1; - } - - return 0; - - -# -You have access to a variety of variables: -# - $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->last_answer : the last answer submitted -# - $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 -# -# - $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. The data in this hash will *not* be accessable -# by other achievements. If you plan to store something in this hash you have -# to write code to initialize the data. -# -# - $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. Like $localData, you need to -# initialize any variable you plan on using in this hash. 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->{completeProblems} : 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 -# on 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 in, or you need to pay very close attention -# to which evaluators are run and when. diff --git a/courses.dist/modelCourse/templates/achievements/seeing_green.at b/courses.dist/modelCourse/templates/achievements/seeing_green.at index 1c311cb5dc..da49c2c1f5 100644 --- a/courses.dist/modelCourse/templates/achievements/seeing_green.at +++ b/courses.dist/modelCourse/templates/achievements/seeing_green.at @@ -1,84 +1,15 @@ -#This checks to see if the student has finished the set -# with fewer than a certain number of incorrect submissions +# This achievement is rewarded for completing a set with no incorrect +# submissions. +# +# See [templates]/achievements/achievement_readme.txt for details. - my $allcorrect = 1; - - foreach my $problemRecord (@setProblems) { - if ($problemRecord->status != 1 || $problemRecord->num_incorrect != 0) { - $allcorrect = 0; - last; - } - } - - if ($allcorrect) { - return 1; - } else { - return 0; - } +# Check if this set has been completed. +return 0 unless $globalData->{completedSetIds}{ $set->set_id }; -# -You have access to a variety of variables: -# - $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->last_answer : the last answer submitted -# - $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 -# -# - $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. The data in this hash will *not* be accessable -# by other achievements. If you plan to store something in this hash you have -# to write code to initialize the data. -# -# - $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. Like $localData, you need to -# initialize any variable you plan on using in this hash. 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->{completeProblems} : 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 -# on 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 in, or you need to pay very close attention -# to which evaluators are run and when. \ No newline at end of file +# Check if any problem has an incorrect submission. +for my $problemRecord (@setProblems) { + return 0 unless $problemRecord->num_incorrect == 0; +} + +# No incorrect submissions found. Award achievement. +return 1; diff --git a/courses.dist/modelCourse/templates/achievements/speed_mather.at b/courses.dist/modelCourse/templates/achievements/speed_mather.at index 036a2e4b3e..939072008c 100644 --- a/courses.dist/modelCourse/templates/achievements/speed_mather.at +++ b/courses.dist/modelCourse/templates/achievements/speed_mather.at @@ -1,93 +1,13 @@ -#This checks to see if the student has finished the whole set in -# less than 10 minutes from time to first input to time to last answer. - -# If the set id doest equal the id of the last set then set -# *this* set as the last set, and set the start time +# This achievement is awarded for completing a set in less than +# 1 hour from the first submit to last answer. +# +# See [templates]/achievements/achievement_readme.txt for details. -if ($problem->set_id ne $localData->{last_set}) { - $localData->{last_set} = $problem->set_id; - $localData->{start_time} = time(); - return 0; -} +# Store the start times of every attempted set. +$localData->{start_times}{ $set->set_id } //= time; -# of we spent more than 10 minutes on the set then leave -if ((time() - $localData->{start_time}) > 3600) { - return 0; -} else { #if it is check to see if we have finished the set - - foreach my $problemRecord (@setProblems) { - if ($problemRecord->status != 1) { - return 0; - } - } - - #the set is done so we are finished - return 1; -} +# Return unless set is complete. +return 0 unless $globalData->{completedSetIds}{ $set->set_id }; -# -You have access to a variety of variables: -# - $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->last_answer : the last answer submitted -# - $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 -# -# - $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. The data in this hash will *not* be accessable -# by other achievements. If you plan to store something in this hash you have -# to write code to initialize the data. -# -# - $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. Like $localData, you need to -# initialize any variable you plan on using in this hash. 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->{completeProblems} : 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 -# on 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 in, or you need to pay very close attention -# to which evaluators are run and when. \ No newline at end of file +# Check if more than 1 hour = 60 * 60 = 3600 seconds have passed. +return time - $localData->{start_times}{ $set->set_id } > 3600 ? 0 : 1; diff --git a/courses.dist/modelCourse/templates/achievements/still_not_right.at b/courses.dist/modelCourse/templates/achievements/still_not_right.at index e0d51da580..80b968f712 100644 --- a/courses.dist/modelCourse/templates/achievements/still_not_right.at +++ b/courses.dist/modelCourse/templates/achievements/still_not_right.at @@ -1,89 +1,33 @@ -# checks to see if the student has inputted the same answer many times in a -# row. Because the $problem-last_answer field is updated *after* the -# achievements are evaluated, this acheivement will pop up late. +# This achievement is awarded if the student has inputted the same answer +# many times in a row. Because the $problem->last_answer field is updated +# *after* the achievements are evaluated, this achievement will pop up late. +# +# See [templates]/achievements/achievement_readme.txt for details. - $localData->{incorrect_streak} = 0 unless $localData->{incorrect_streak}; +# Initialize $localData. +$localData->{incorrect_streak} //= 0; - if ($problem->status == 1) { - return 0; - } elsif ($problem->set_id ne $localData->{set_id} || - $problem->problem_id ne $localData->{problem_id} || - $problem->last_answer ne $localData->{last_answer}) { - $localData->{set_id} = $problem->set_id; - $localData->{problem_id} = $problem->problem_id; - $localData->{last_answer} = $problem->last_answer; - $localData->{incorrect_streak} = 1; +# If the problem is correct, reset counter and move on. +if ($problem->status == 1) { + $localData->{incorrect_streak} = 0; return 0; - } elsif ($localData->{incorrect_streak} == 9) { - return 1; - } else { - $localData->{incorrect_streak}++; +} + +# Check if the student is working on the same problem, with +# the same last answer. If not update data. +if ($problem->set_id ne $localData->{set_id} + || $problem->problem_id ne $localData->{problem_id} + || $problem->last_answer ne $localData->{last_answer}) +{ + $localData->{set_id} = $problem->set_id; + $localData->{problem_id} = $problem->problem_id; + $localData->{last_answer} = $problem->last_answer; + $localData->{incorrect_streak} = 1; return 0; - } +} -# -You have access to a variety of variables: -# - $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->last_answer : the last answer submitted -# - $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 -# -# - $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. The data in this hash will *not* be accessable -# by other achievements. If you plan to store something in this hash you have -# to write code to initialize the data. -# -# - $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. Like $localData, you need to -# initialize any variable you plan on using in this hash. 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->{completeProblems} : 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 -# on 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 in, or you need to pay very close attention -# to which evaluators are run and when. \ No newline at end of file +# Award achievement or increment streak. +return 1 if $localData->{incorrect_streak} == 9; + +++$localData->{incorrect_streak}; +return 0; diff --git a/courses.dist/modelCourse/templates/achievements/super_persistence.at b/courses.dist/modelCourse/templates/achievements/super_persistence.at index 2a1e8a2127..676b2480b2 100644 --- a/courses.dist/modelCourse/templates/achievements/super_persistence.at +++ b/courses.dist/modelCourse/templates/achievements/super_persistence.at @@ -1,76 +1,13 @@ -#This checks to see if the student has solved the problem after a certain -# number of incorrect attempts - - if ($problem->status == 1 && $problem->num_correct == 1 && $problem->num_incorrect >= 100) { - return 1 - } else { - return 0; - } +# Award this achievement if a student solves a problem after +# answering it incorrectly more than 100 times. +# +# See [templates]/achievements/achievement_readme.txt for details. +if ($problem->status == 1 + && $problem->num_correct == 1 + && $problem->num_incorrect >= 100) +{ + return 1; +} -# -You have access to a variety of variables: -# - $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->last_answer : the last answer submitted -# - $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 -# -# - $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. The data in this hash will *not* be accessable -# by other achievements. If you plan to store something in this hash you have -# to write code to initialize the data. -# -# - $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. Like $localData, you need to -# initialize any variable you plan on using in this hash. 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->{completeProblems} : 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 -# on 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 in, or you need to pay very close attention -# to which evaluators are run and when. \ No newline at end of file +return 0; diff --git a/courses.dist/modelCourse/templates/achievements/super_speed_math.at b/courses.dist/modelCourse/templates/achievements/super_speed_math.at index 32b6474fda..666d6ee5bb 100644 --- a/courses.dist/modelCourse/templates/achievements/super_speed_math.at +++ b/courses.dist/modelCourse/templates/achievements/super_speed_math.at @@ -1,93 +1,13 @@ -#This checks to see if the student has finished the whole set in -# less than 10 minutes from time to first input to time to last answer. - -# If the set id doest equal the id of the last set then set -# *this* set as the last set, and set the start time +# This achievement is awarded for completing a set in less than +# 10 minutes from the first submit to last answer. +# +# See [templates]/achievements/achievement_readme.txt for details. -if ($problem->set_id ne $localData->{last_set}) { - $localData->{last_set} = $problem->set_id; - $localData->{start_time} = time(); - return 0; -} +# Store the start times of every attempted set. +$localData->{start_times}{ $set->set_id } //= time; -# of we spent more than 10 minutes on the set then leave -if ((time() - $localData->{start_time}) > 600) { - return 0; -} else { #if it is check to see if we have finished the set - - foreach my $problemRecord (@setProblems) { - if ($problemRecord->status != 1) { - return 0; - } - } - - #the set is done so we are finished - return 1; -} +# Return unless set is complete. +return 0 unless $globalData->{completedSetIds}{ $set->set_id }; -# -You have access to a variety of variables: -# - $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->last_answer : the last answer submitted -# - $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 -# -# - $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. The data in this hash will *not* be accessable -# by other achievements. If you plan to store something in this hash you have -# to write code to initialize the data. -# -# - $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. Like $localData, you need to -# initialize any variable you plan on using in this hash. 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->{completeProblems} : 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 -# on 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 in, or you need to pay very close attention -# to which evaluators are run and when. \ No newline at end of file +# Check if more than 10 minutes = 10 * 60 = 600 seconds have passed. +return time - $localData->{start_times}{ $set->set_id } > 600 ? 0 : 1; diff --git a/courses.dist/modelCourse/templates/achievements/tangent_plane.at b/courses.dist/modelCourse/templates/achievements/tangent_plane.at deleted file mode 100644 index 878b48c1ad..0000000000 --- a/courses.dist/modelCourse/templates/achievements/tangent_plane.at +++ /dev/null @@ -1,88 +0,0 @@ -#This problem checks to see if a particular problem from a list of valid -# sets and problems has been solved. (You would edit this file to say which -# sets and problems count.) - -#constants -my %validproblems = ( - 'SetNameHere' => { #now you show which problems are valid like: - '1' => 1, - '3' => 1, }, #and put more sets here - ); - -#check and see if this problem was solved -if ($validproblems{$problem->set_id} && - $validproblems{$problem->set_id}{$problem->problem_id} && - $problem->status == 1 && - $problem->num_correct == 1) { - return 1; - } - - return 0; - - -# -You have access to a variety of variables: -# - $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->last_answer : the last answer submitted -# - $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 -# -# - $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. The data in this hash will *not* be accessable -# by other achievements. If you plan to store something in this hash you have -# to write code to initialize the data. -# -# - $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. Like $localData, you need to -# initialize any variable you plan on using in this hash. 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->{completeProblems} : 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 -# on 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 in, or you need to pay very close attention -# to which evaluators are run and when. diff --git a/courses.dist/modelCourse/templates/achievements/taylor_hero.at b/courses.dist/modelCourse/templates/achievements/taylor_hero.at deleted file mode 100644 index 491560c4dd..0000000000 --- a/courses.dist/modelCourse/templates/achievements/taylor_hero.at +++ /dev/null @@ -1,88 +0,0 @@ -#This problem checks to see if a particular problem from a list of valid -# sets and problems has been solved. (You would edit this file to say which -# sets and problems count.) - -#constants -my %validproblems = ( - 'SetNameHere' => { #now you show which problems are valid like: - '2' => 1, - '1' => 1, }, #and put more sets here - ); - -#check and see if this problem was solved -if ($validproblems{$problem->set_id} && - $validproblems{$problem->set_id}{$problem->problem_id} && - $problem->status == 1 && - $problem->num_correct == 1) { - return 1; - } - - return 0; - - -# -You have access to a variety of variables: -# - $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->last_answer : the last answer submitted -# - $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 -# -# - $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. The data in this hash will *not* be accessable -# by other achievements. If you plan to store something in this hash you have -# to write code to initialize the data. -# -# - $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. Like $localData, you need to -# initialize any variable you plan on using in this hash. 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->{completeProblems} : 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 -# on 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 in, or you need to pay very close attention -# to which evaluators are run and when. diff --git a/courses.dist/modelCourse/templates/achievements/the_fundamentals.at b/courses.dist/modelCourse/templates/achievements/the_fundamentals.at deleted file mode 100644 index 491560c4dd..0000000000 --- a/courses.dist/modelCourse/templates/achievements/the_fundamentals.at +++ /dev/null @@ -1,88 +0,0 @@ -#This problem checks to see if a particular problem from a list of valid -# sets and problems has been solved. (You would edit this file to say which -# sets and problems count.) - -#constants -my %validproblems = ( - 'SetNameHere' => { #now you show which problems are valid like: - '2' => 1, - '1' => 1, }, #and put more sets here - ); - -#check and see if this problem was solved -if ($validproblems{$problem->set_id} && - $validproblems{$problem->set_id}{$problem->problem_id} && - $problem->status == 1 && - $problem->num_correct == 1) { - return 1; - } - - return 0; - - -# -You have access to a variety of variables: -# - $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->last_answer : the last answer submitted -# - $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 -# -# - $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. The data in this hash will *not* be accessable -# by other achievements. If you plan to store something in this hash you have -# to write code to initialize the data. -# -# - $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. Like $localData, you need to -# initialize any variable you plan on using in this hash. 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->{completeProblems} : 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 -# on 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 in, or you need to pay very close attention -# to which evaluators are run and when. diff --git a/courses.dist/modelCourse/templates/achievements/the_lhopital.at b/courses.dist/modelCourse/templates/achievements/the_lhopital.at deleted file mode 100644 index 491560c4dd..0000000000 --- a/courses.dist/modelCourse/templates/achievements/the_lhopital.at +++ /dev/null @@ -1,88 +0,0 @@ -#This problem checks to see if a particular problem from a list of valid -# sets and problems has been solved. (You would edit this file to say which -# sets and problems count.) - -#constants -my %validproblems = ( - 'SetNameHere' => { #now you show which problems are valid like: - '2' => 1, - '1' => 1, }, #and put more sets here - ); - -#check and see if this problem was solved -if ($validproblems{$problem->set_id} && - $validproblems{$problem->set_id}{$problem->problem_id} && - $problem->status == 1 && - $problem->num_correct == 1) { - return 1; - } - - return 0; - - -# -You have access to a variety of variables: -# - $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->last_answer : the last answer submitted -# - $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 -# -# - $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. The data in this hash will *not* be accessable -# by other achievements. If you plan to store something in this hash you have -# to write code to initialize the data. -# -# - $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. Like $localData, you need to -# initialize any variable you plan on using in this hash. 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->{completeProblems} : 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 -# on 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 in, or you need to pay very close attention -# to which evaluators are run and when. diff --git a/courses.dist/modelCourse/templates/achievements/third_time.at b/courses.dist/modelCourse/templates/achievements/third_time.at index 3d76898e3d..cd1ccf9993 100644 --- a/courses.dist/modelCourse/templates/achievements/third_time.at +++ b/courses.dist/modelCourse/templates/achievements/third_time.at @@ -1,75 +1,13 @@ -#This checks to see if the student has a certain number of attempts +# This achievement is awarded for completing a problem correctly on the +# third submit. +# +# See [templates]/achievements/achievement_readme.txt for details. - if ($problem->num_correct == 1 and $problem->num_incorrect == 2 and $problem->status == 1) { +if ($problem->num_correct == 1 + && $problem->num_incorrect == 2 + && $problem->status == 1) +{ return 1; - } else { - return 0; - } - +} -# -You have access to a variety of variables: -# - $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->last_answer : the last answer submitted -# - $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 -# -# - $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. The data in this hash will *not* be accessable -# by other achievements. If you plan to store something in this hash you have -# to write code to initialize the data. -# -# - $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. Like $localData, you need to -# initialize any variable you plan on using in this hash. 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->{completeProblems} : 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 -# on 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 in, or you need to pay very close attention -# to which evaluators are run and when. \ No newline at end of file +return 0; diff --git a/courses.dist/modelCourse/templates/achievements/three_in_a_row.at b/courses.dist/modelCourse/templates/achievements/three_in_a_row.at deleted file mode 100644 index baddd04e8f..0000000000 --- a/courses.dist/modelCourse/templates/achievements/three_in_a_row.at +++ /dev/null @@ -1,86 +0,0 @@ -#This checks to see if the student has solved 10 problems without having any -# incorrect answers - -# reset counter if they got something wrong -if ($problem->status < 1) { - $counter = 0; - return 0; -# if they are right update the counter -} elsif ($problem->status == 1 && - $problem->num_correct == 1 && - $problem->num_incorrect == 0 ) { - $counter++; -} - -if ($counter >= $maxCounter) { - return 1; -} else { - return 0; -} - -# -You have access to a variety of variables: -# - $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->last_answer : the last answer submitted -# - $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 -# -# - $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. The data in this hash will *not* be accessable -# by other achievements. If you plan to store something in this hash you have -# to write code to initialize the data. -# -# - $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. Like $localData, you need to -# initialize any variable you plan on using in this hash. 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->{completeProblems} : 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 -# on 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 in, or you need to pay very close attention -# to which evaluators are run and when. diff --git a/courses.dist/modelCourse/templates/achievements/to_infinity.at b/courses.dist/modelCourse/templates/achievements/to_infinity.at deleted file mode 100644 index 491560c4dd..0000000000 --- a/courses.dist/modelCourse/templates/achievements/to_infinity.at +++ /dev/null @@ -1,88 +0,0 @@ -#This problem checks to see if a particular problem from a list of valid -# sets and problems has been solved. (You would edit this file to say which -# sets and problems count.) - -#constants -my %validproblems = ( - 'SetNameHere' => { #now you show which problems are valid like: - '2' => 1, - '1' => 1, }, #and put more sets here - ); - -#check and see if this problem was solved -if ($validproblems{$problem->set_id} && - $validproblems{$problem->set_id}{$problem->problem_id} && - $problem->status == 1 && - $problem->num_correct == 1) { - return 1; - } - - return 0; - - -# -You have access to a variety of variables: -# - $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->last_answer : the last answer submitted -# - $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 -# -# - $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. The data in this hash will *not* be accessable -# by other achievements. If you plan to store something in this hash you have -# to write code to initialize the data. -# -# - $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. Like $localData, you need to -# initialize any variable you plan on using in this hash. 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->{completeProblems} : 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 -# on 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 in, or you need to pay very close attention -# to which evaluators are run and when. diff --git a/courses.dist/modelCourse/templates/achievements/trig_ninja.at b/courses.dist/modelCourse/templates/achievements/trig_ninja.at deleted file mode 100644 index 491560c4dd..0000000000 --- a/courses.dist/modelCourse/templates/achievements/trig_ninja.at +++ /dev/null @@ -1,88 +0,0 @@ -#This problem checks to see if a particular problem from a list of valid -# sets and problems has been solved. (You would edit this file to say which -# sets and problems count.) - -#constants -my %validproblems = ( - 'SetNameHere' => { #now you show which problems are valid like: - '2' => 1, - '1' => 1, }, #and put more sets here - ); - -#check and see if this problem was solved -if ($validproblems{$problem->set_id} && - $validproblems{$problem->set_id}{$problem->problem_id} && - $problem->status == 1 && - $problem->num_correct == 1) { - return 1; - } - - return 0; - - -# -You have access to a variety of variables: -# - $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->last_answer : the last answer submitted -# - $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 -# -# - $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. The data in this hash will *not* be accessable -# by other achievements. If you plan to store something in this hash you have -# to write code to initialize the data. -# -# - $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. Like $localData, you need to -# initialize any variable you plan on using in this hash. 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->{completeProblems} : 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 -# on 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 in, or you need to pay very close attention -# to which evaluators are run and when. diff --git a/courses.dist/modelCourse/templates/achievements/triple_integral.at b/courses.dist/modelCourse/templates/achievements/triple_integral.at deleted file mode 100644 index a351b86d4c..0000000000 --- a/courses.dist/modelCourse/templates/achievements/triple_integral.at +++ /dev/null @@ -1,92 +0,0 @@ -#This problem checks to see if a particular problem from a list of valid -# sets and problems has been solved. If it has then it updates the counter -#(You would edit this file to say which sets and problems count.) - -#constants -my %validproblems = ( - 'SetNameHere' => { #now you show which problems are valid like: - '2' => 1, - '1' => 1, }, #and put more sets here - ); - -#check and see if this problem was solved -if ($validproblems{$problem->set_id} && - $validproblems{$problem->set_id}{$problem->problem_id} && - $problem->status == 1 && - $problem->num_correct == 1) { - #update counter; - $counter++; - } - -if ($counter >= $maxCounter) { - return 1; -} else { - return 0; -} - -# -You have access to a variety of variables: -# - $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->last_answer : the last answer submitted -# - $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 -# -# - $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. The data in this hash will *not* be accessable -# by other achievements. If you plan to store something in this hash you have -# to write code to initialize the data. -# -# - $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. Like $localData, you need to -# initialize any variable you plan on using in this hash. 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->{completeProblems} : 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 -# on 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 in, or you need to pay very close attention -# to which evaluators are run and when. diff --git a/courses.dist/modelCourse/templates/achievements/vector_fields.at b/courses.dist/modelCourse/templates/achievements/vector_fields.at deleted file mode 100644 index 25d6b90be5..0000000000 --- a/courses.dist/modelCourse/templates/achievements/vector_fields.at +++ /dev/null @@ -1,92 +0,0 @@ -#This problem checks to see if a particular problem from a list of valid -# sets and problems has been solved. (You would edit this file to say which -# sets and problems count.) - -#constants -my %validproblems = ( - 'SetNameHere' => { #now you show which problems are valid like: - '2' => 1, - '1' => 1, }, #and put more sets here - ); - -#check and see if this problem was solved -if ($validproblems{$problem->set_id} && - $validproblems{$problem->set_id}{$problem->problem_id} && - $problem->status == 1 && - $problem->num_correct == 1) { - #update counter; - $counter++; - } - -if ($counter >= $maxCounter) { - return 1; -} else { - return 0; -} - -# -You have access to a variety of variables: -# - $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->last_answer : the last answer submitted -# - $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 -# -# - $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. The data in this hash will *not* be accessable -# by other achievements. If you plan to store something in this hash you have -# to write code to initialize the data. -# -# - $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. Like $localData, you need to -# initialize any variable you plan on using in this hash. 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->{completeProblems} : 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 -# on 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 in, or you need to pay very close attention -# to which evaluators are run and when. \ No newline at end of file