NAME

WeBWorK::Utils::Sets - contains utility subroutines for sets.

format_set_name_internal

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.

format_set_name_internal

Usage: format_set_name_display($set_name)

This formats set names for display, converting underscores back into spaces.

grade_set

Usage: grade_set($db, $set, $studentName, $setIsVersioned = 0, $wantProblemDetails = 0)

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, the total number of problems in the set, and a reference to an array of merged user problem records from 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 before the reference to the array of problem records.

In scalar context this returns the percentage correct.

grade_gateway

Usage: grade_gateway($db, $setName, $studentName)

All arguments are required.

In list context this returns a list of the total number of correct problems for the highest scoring version of this test, the total number of problems in that version, a reference to an array of merged user problem records from that version, and a reference to an array of merged user set versions for this user and set.

In scalar context this returns the percentage correct for the highest scoring version of this test.

grade_all_sets

Usage: grade_all_sets($db, $ce, $studentName, $getSetGradeConditionally)

The arguments $db, $ce, and $studentName are rrequired.

The $getSetGradeConditionally is an optional argument that if provided should be a reference to a subroutine that will be passed the arguments $db, $ce, $studentName listed above, and $userSet which is a merged user set record from the database, and must either return a reference to a hash containing the keys totalRight and total with the grade for the set, or undef. If it returns undef then the set will not be included in the grade computation. Otherwise the values for totalRight and total that are returned will be added into the grade. If the optional last arugment is not provided, then a default method will be used that returns the set grade if after the open date, and undef otherwise.

This returns the total course score for all sets, the maximum possible course score, and an array reference containing references to the user sets that were included in those two tallies.

is_restricted

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.

get_test_problem_position

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.

list_set_versions

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.