[system] / trunk / webwork-modperl / lib / WeBWorK / DB.pm Repository:
ViewVC logotype

Diff of /trunk/webwork-modperl/lib/WeBWorK/DB.pm

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

Revision 1540 Revision 1541
1290sub getMergedSet { 1290sub getMergedSet {
1291 my ($self, $userID, $setID) = @_; 1291 my ($self, $userID, $setID) = @_;
1292 1292
1293 #my $timer = WeBWorK::Timing->new("getMergedSet"); 1293 #my $timer = WeBWorK::Timing->new("getMergedSet");
1294 1294
1295 croak "getGlobalUserSet: requires 2 arguments" 1295 croak "getMergedSet: requires 2 arguments"
1296 unless @_ == 3; 1296 unless @_ == 3;
1297 croak "getGlobalUserSet: argument 1 must contain a user_id" 1297 croak "getMergedSet: argument 1 must contain a user_id"
1298 unless defined $userID; 1298 unless defined $userID;
1299 croak "getGlobalUserSet: argument 2 must contain a set_id" 1299 croak "getMergedSet: argument 2 must contain a set_id"
1300 unless defined $setID; 1300 unless defined $setID;
1301 1301
1302 #$timer->start; 1302 #$timer->start;
1303 my $UserSet = $self->getUserSet($userID, $setID); 1303 my $UserSet = $self->getUserSet($userID, $setID);
1304 #$timer->continue("got user set"); 1304 #$timer->continue("got user set");
1315 #$timer->continue("merged records"); 1315 #$timer->continue("merged records");
1316 #$timer->stop; 1316 #$timer->stop;
1317 return $UserSet; 1317 return $UserSet;
1318} 1318}
1319 1319
1320
1320=item geMegedSets(@userSetIDs) 1321=item geMegedSets(@userSetIDs)
1322
1321 1323
1322Return a list of merged set records associated with the user IDs given. If there 1324Return a list of merged set records associated with the user IDs given. If there
1323is no record associated with a given user ID, that element of the list will be 1325is no record associated with a given user ID, that element of the list will be
1324undefined. @userProblemIDs consists of references to arrays in which the first 1326undefined. @userSetIDs consists of references to arrays in which the first
1325element is the user_id and the second element is the set_id. 1327element is the user_id and the second element is the set_id.
1326 1328
1327=cut
1328 1329
1330=cut
1331
1332
1329sub geMegedSets { 1333sub getMergedSets {
1330 my ($self, @userSetIDs) = @_; 1334 my ($self, @userSetIDs) = @_;
1331 1335
1332 croak "geMegedSets: requires 1 or more argument" 1336 croak "getMergedSets: requires 1 or more argument"
1333 unless @_ >= 2; 1337 unless @_ >= 2;
1334 foreach my $i (0 .. $#userSetIDs) { 1338 foreach my $i (0 .. $#userSetIDs) {
1335 croak "geMegedSets: element $i of argument list must contain a <user_id, set_id> pair" 1339 croak "getMergedSets: element $i of argument list must contain a <user_id, set_id> pair"
1336 unless defined $userSetIDs[$i] 1340 unless defined $userSetIDs[$i]
1337 and ref $userSetIDs[$i] eq "ARRAY" 1341 and ref $userSetIDs[$i] eq "ARRAY"
1338 and @{$userSetIDs[$i]} == 2 1342 and @{$userSetIDs[$i]} == 2
1339 and defined $userSetIDs[$i]->[0] 1343 and defined $userSetIDs[$i]->[0]
1340 and defined $userSetIDs[$i]->[1]; 1344 and defined $userSetIDs[$i]->[1];
1341 } 1345 }
1342 1346
1343 return map { $self->getMergedSet(@{$_}) } @userSetIDs; 1347 return map { $self->getMergedSet(@{$_}) } @userSetIDs;
1348
1344} 1349}
1350
1351
1345 1352
1346################################################################################ 1353################################################################################
1347# problem+problem_user functions 1354# problem+problem_user functions
1348################################################################################ 1355################################################################################
1349 1356

Legend:
Removed from v.1540  
changed lines
  Added in v.1541

aubreyja at gmail dot com
ViewVC Help
Powered by ViewVC 1.0.9