Skip to content

Commit

Permalink
more efficient database accessing
Browse files Browse the repository at this point in the history
Co-authored-by: Glenn Rice <47527406+drgrice1@users.noreply.github.com>
  • Loading branch information
Alex-Jordan and drgrice1 committed Dec 18, 2024
1 parent f455e39 commit e34631c
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 9 deletions.
4 changes: 1 addition & 3 deletions lib/WeBWorK/AchievementItems/ExtendDueDate.pm
Original file line number Diff line number Diff line change
Expand Up @@ -79,9 +79,7 @@ sub use_item ($self, $userName, $c) {

# Change the seed for all of the problems if the set is currently closed.
if (after($set->due_date)) {
my @probIDs = $db->listUserProblems($userName, $setID);
for my $probID (@probIDs) {
my $problem = $db->getUserProblem($userName, $setID, $probID);
for my $problem ($db->getUserProblemsWhere({ user_id => $userName, set_id => $setID })) {
$problem->problem_seed($problem->problem_seed % 2**31 + 1);
$db->putUserProblem($problem);
}
Expand Down
4 changes: 1 addition & 3 deletions lib/WeBWorK/AchievementItems/ReducedCred.pm
Original file line number Diff line number Diff line change
Expand Up @@ -85,9 +85,7 @@ sub use_item ($self, $userName, $c) {

# Change the seed for all of the problems if the set is currently closed.
if (after($set->due_date)) {
my @probIDs = $db->listUserProblems($userName, $setID);
for my $probID (@probIDs) {
my $problem = $db->getUserProblem($userName, $setID, $probID);
for my $problem ($db->getUserProblemsWhere({ user_id => $userName, set_id => $setID })) {
$problem->problem_seed($problem->problem_seed % 2**31 + 1);
$db->putUserProblem($problem);
}
Expand Down
4 changes: 1 addition & 3 deletions lib/WeBWorK/AchievementItems/SuperExtendDueDate.pm
Original file line number Diff line number Diff line change
Expand Up @@ -79,9 +79,7 @@ sub use_item ($self, $userName, $c) {

# Change the seed for all of the problems if the set is currently closed.
if (after($set->due_date)) {
my @probIDs = $db->listUserProblems($userName, $setID);
for my $probID (@probIDs) {
my $problem = $db->getUserProblem($userName, $setID, $probID);
for my $problem ($db->getUserProblemsWhere({ user_id => $userName, set_id => $setID })) {
$problem->problem_seed($problem->problem_seed % 2**31 + 1);
$db->putUserProblem($problem);
}
Expand Down

0 comments on commit e34631c

Please sign in to comment.