WeBWorK::Utils::Sets - contains utility subroutines for sets.
Usage: format_set_name_internal($set_name)
This is for formatting set names input via text inputs in the user interface for internal use. Set names are allowed to be input with spaces, but internally spaces are not allowed and are converted to underscores.
Usage: format_set_name_display($set_name)
This formats set names for display, converting underscores back into spaces.
Usage: grade_set($db, $set, $studentName, $setIsVersioned = 0, $wantProblemDetails)
The arguments $db
, $set
, and $studentName
are required. If $setIsVersioned
is true, then the given set is assumed to be a set version.
In list context this returns a list containing the total number of correct problems, and the total number of problems in the set. If $wantProblemDetails
is true, then a reference to an array of the scores for each problem, and a reference to the array of the number of incorrect attempts for each problem are also included in the returned list.
In scalar context this returns the percentage correct.
Usage: grade_gateway($db, $set, $setName, $studentName)
All arguments are required.
In list context this returns a list fo the total number of correct problems for the highest scoring version of this test, and the total number of problems in that version.
In scalar context this returns the percentage correct for the highest scoring version of this test.
Usage: grade_all_sets($db, $studentName)
All arguments listed are required.
In list context this returns the total course score for all sets and the maximum possible course score.
In scalar context this returns the percentage score for all sets in the course.
Usage: is_restricted($db, $set, $studentName)
All arguments are required.
This returns 1 if release of the set is restricted for the student given in $studentName
, and 0 otherwise.
Usage: get_test_problem_position($db, $problem)
Given $problem
which should be a problem version, get_test_problem_position returns the 0 based problem number for the problem on the test, and the 1 based page number for the page on the test that the problem is on.
Usage: list_set_versions($db, $studentName, $setName, $setIsVersioned)
Construct a list of versioned sets for this student user. This returns a reference to an array of names of set versions and whether or not the user is assigned to the set. The list of names will be a list of set versions if the set is versioned (i.e., if setIsVersioned
is true), and a list containing only the original set id otherwise.