| … | |
… | |
| 76 | |
76 | |
| 77 | # When a new problem is added to a set, all students to whom the set |
77 | # When a new problem is added to a set, all students to whom the set |
| 78 | # it belongs to is assigned should have it assigned to them. |
78 | # it belongs to is assigned should have it assigned to them. |
| 79 | # Note that this does NOT assign to all users of a course, just all users |
79 | # Note that this does NOT assign to all users of a course, just all users |
| 80 | # of a set. |
80 | # of a set. |
| 81 | sub assignProblemToAllUsers { |
81 | sub assignProblemToAllSetUsers { |
| 82 | my ($self, $globalProblem) = @_; |
82 | my ($self, $globalProblem) = @_; |
| 83 | my $db = $self->{db}; |
83 | my $db = $self->{db}; |
| 84 | my $setID = $globalProblem->set_id; |
84 | my $setID = $globalProblem->set_id; |
| 85 | my @users = $db->listSetUsers($setID); |
85 | my @users = $db->listSetUsers($setID); |
| 86 | |
86 | |
| … | |
… | |
| 95 | # This function caches database data as a speed optimization. |
95 | # This function caches database data as a speed optimization. |
| 96 | sub assignSetToAllUsers { |
96 | sub assignSetToAllUsers { |
| 97 | my ($self, $setID) = @_; |
97 | my ($self, $setID) = @_; |
| 98 | my $db = $self->{db}; |
98 | my $db = $self->{db}; |
| 99 | my @problems = (); |
99 | my @problems = (); |
| 100 | my @users = $db->listUsers($setID); |
100 | my @users = $db->listUsers; |
| 101 | my @problemRecords = map {$db->getGlobalProblem($setID, $_)} $db->listGlobalProblems($setID); |
101 | my @problemRecords = map {$db->getGlobalProblem($setID, $_)} $db->listGlobalProblems($setID); |
| 102 | |
102 | |
| 103 | foreach my $user (@users) { |
103 | foreach my $user (@users) { |
| 104 | # FIXME: Create a UserSet record for the user!!!! |
104 | # FIXME: Create a UserSet record for the user!!!! |
| 105 | my $userSet = $db->{set_user}->{record}->new; |
105 | my $userSet = $db->{set_user}->{record}->new; |