Lines 978-984
subtest "Test Local Holds Priority - Bib level" => sub {
Link Here
|
978 |
is( $queue_rs->count(), 1, |
978 |
is( $queue_rs->count(), 1, |
979 |
"Hold queue contains one hold" ); |
979 |
"Hold queue contains one hold" ); |
980 |
is( |
980 |
is( |
981 |
$queue_rs->next->borrowernumber, |
981 |
$queue_rs->next->borrowernumber->borrowernumber, |
982 |
$local_patron->borrowernumber, |
982 |
$local_patron->borrowernumber, |
983 |
"We should pick the local hold over the next available" |
983 |
"We should pick the local hold over the next available" |
984 |
); |
984 |
); |
Lines 1048-1054
subtest "Test Local Holds Priority - Item level" => sub {
Link Here
|
1048 |
is( $queue_rs->count(), 1, |
1048 |
is( $queue_rs->count(), 1, |
1049 |
"Hold queue contains one hold" ); |
1049 |
"Hold queue contains one hold" ); |
1050 |
is( |
1050 |
is( |
1051 |
$q->borrowernumber, |
1051 |
$q->borrowernumber->borrowernumber, |
1052 |
$local_patron->borrowernumber, |
1052 |
$local_patron->borrowernumber, |
1053 |
"We should pick the local hold over the next available" |
1053 |
"We should pick the local hold over the next available" |
1054 |
); |
1054 |
); |
Lines 1116-1122
subtest "Test Local Holds Priority - Item level hold over Record level hold (Bug
Link Here
|
1116 |
is( $queue_rs->count(), 1, |
1116 |
is( $queue_rs->count(), 1, |
1117 |
"Hold queue contains one hold" ); |
1117 |
"Hold queue contains one hold" ); |
1118 |
is( |
1118 |
is( |
1119 |
$q->borrowernumber, |
1119 |
$q->borrowernumber->borrowernumber, |
1120 |
$local_patron->borrowernumber, |
1120 |
$local_patron->borrowernumber, |
1121 |
"We should pick the local hold over the next available" |
1121 |
"We should pick the local hold over the next available" |
1122 |
); |
1122 |
); |
Lines 1193-1199
subtest "Test Local Holds Priority - Get correct item for item level hold" => su
Link Here
|
1193 |
is( $queue_rs->count(), 1, |
1193 |
is( $queue_rs->count(), 1, |
1194 |
"Hold queue contains one hold" ); |
1194 |
"Hold queue contains one hold" ); |
1195 |
is( |
1195 |
is( |
1196 |
$q->borrowernumber, |
1196 |
$q->borrowernumber->borrowernumber, |
1197 |
$local_patron->borrowernumber, |
1197 |
$local_patron->borrowernumber, |
1198 |
"We should pick the local hold over the next available" |
1198 |
"We should pick the local hold over the next available" |
1199 |
); |
1199 |
); |
Lines 1444-1450
subtest 'Excludes from local holds priority' => sub {
Link Here
|
1444 |
my $queue_rs = $schema->resultset('TmpHoldsqueue'); |
1444 |
my $queue_rs = $schema->resultset('TmpHoldsqueue'); |
1445 |
my $next = $queue_rs->next; |
1445 |
my $next = $queue_rs->next; |
1446 |
is($queue_rs->count, 1, 'Only 1 patron queueud' ); |
1446 |
is($queue_rs->count, 1, 'Only 1 patron queueud' ); |
1447 |
is($next->borrowernumber, $local_patron_not_excluded->borrowernumber, 'Not excluded local patron is queued'); |
1447 |
is($next->borrowernumber->borrowernumber, $local_patron_not_excluded->borrowernumber, 'Not excluded local patron is queued'); |
1448 |
|
1448 |
|
1449 |
my $item2 = $builder->build_sample_item( |
1449 |
my $item2 = $builder->build_sample_item( |
1450 |
{ |
1450 |
{ |
Lines 1458-1466
subtest 'Excludes from local holds priority' => sub {
Link Here
|
1458 |
$queue_rs = $schema->resultset('TmpHoldsqueue'); |
1458 |
$queue_rs = $schema->resultset('TmpHoldsqueue'); |
1459 |
is( $queue_rs->count, 2, '2 patrons queued' ); |
1459 |
is( $queue_rs->count, 2, '2 patrons queued' ); |
1460 |
$next = $queue_rs->next; |
1460 |
$next = $queue_rs->next; |
1461 |
is($next->borrowernumber, $local_patron_not_excluded->borrowernumber, 'Not excluded local patron is queued'); |
1461 |
is($next->borrowernumber->borrowernumber, $local_patron_not_excluded->borrowernumber, 'Not excluded local patron is queued'); |
1462 |
$next = $queue_rs->next; |
1462 |
$next = $queue_rs->next; |
1463 |
is($next->borrowernumber, $other_patron->borrowernumber, 'Other patron is queued'); |
1463 |
is($next->borrowernumber->borrowernumber, $other_patron->borrowernumber, 'Other patron is queued'); |
1464 |
|
1464 |
|
1465 |
$item1->exclude_from_local_holds_priority(1)->store; |
1465 |
$item1->exclude_from_local_holds_priority(1)->store; |
1466 |
|
1466 |
|
Lines 1469-1477
subtest 'Excludes from local holds priority' => sub {
Link Here
|
1469 |
$queue_rs = $schema->resultset('TmpHoldsqueue'); |
1469 |
$queue_rs = $schema->resultset('TmpHoldsqueue'); |
1470 |
is( $queue_rs->count, 2, '2 patrons queued' ); |
1470 |
is( $queue_rs->count, 2, '2 patrons queued' ); |
1471 |
$next = $queue_rs->next; |
1471 |
$next = $queue_rs->next; |
1472 |
is($next->borrowernumber, $other_patron->borrowernumber, 'Other patron is queued'); |
1472 |
is($next->borrowernumber->borrowernumber, $other_patron->borrowernumber, 'Other patron is queued'); |
1473 |
$next = $queue_rs->next; |
1473 |
$next = $queue_rs->next; |
1474 |
is($next->borrowernumber, $local_patron_excluded->borrowernumber, 'Excluded local patron is queued'); |
1474 |
is($next->borrowernumber->borrowernumber, $local_patron_excluded->borrowernumber, 'Excluded local patron is queued'); |
1475 |
}; |
1475 |
}; |
1476 |
# Cleanup |
1476 |
# Cleanup |
1477 |
$schema->storage->txn_rollback; |
1477 |
$schema->storage->txn_rollback; |