Lines 1191-1197
subtest "filter_by_last_update" => sub {
Link Here
|
1191 |
subtest 'Parameters older_than, younger_than' => sub { |
1191 |
subtest 'Parameters older_than, younger_than' => sub { |
1192 |
my $now = dt_from_string(); |
1192 |
my $now = dt_from_string(); |
1193 |
my $rs = Koha::Patrons->search( { borrowernumber => { -in => \@borrowernumbers } } ); |
1193 |
my $rs = Koha::Patrons->search( { borrowernumber => { -in => \@borrowernumbers } } ); |
1194 |
$rs->update( { updated_on => $now->clone->subtract( hours => 25 ) } ); |
1194 |
$rs->update( { updated_on => $now->clone->subtract( hours => 24 ) } ); |
1195 |
is( |
1195 |
is( |
1196 |
$rs->filter_by_last_update( { timestamp_column_name => 'updated_on', from => $now } )->count, 0, |
1196 |
$rs->filter_by_last_update( { timestamp_column_name => 'updated_on', from => $now } )->count, 0, |
1197 |
'All updated yesterday' |
1197 |
'All updated yesterday' |
Lines 1208-1224
subtest "filter_by_last_update" => sub {
Link Here
|
1208 |
); |
1208 |
); |
1209 |
is( |
1209 |
is( |
1210 |
$rs->filter_by_last_update( |
1210 |
$rs->filter_by_last_update( |
1211 |
{ timestamp_column_name => 'updated_on', from => $now->clone->subtract( days => 1 ), } |
1211 |
{ timestamp_column_name => 'updated_on', from => $now->clone->subtract( minutes => 24 * 60 - 1 ), } |
1212 |
)->count, |
1212 |
)->count, |
1213 |
0, |
1213 |
0, |
1214 |
'Yesterday, not truncated, one hour too late' |
1214 |
'Yesterday + 1m, not truncated, no results' |
1215 |
); |
1215 |
); |
1216 |
is( |
1216 |
is( |
1217 |
$rs->filter_by_last_update( |
1217 |
$rs->filter_by_last_update( |
1218 |
{ timestamp_column_name => 'updated_on', from => $now->clone->subtract( hours => 25 ), } |
1218 |
{ timestamp_column_name => 'updated_on', from => $now->clone->subtract( hours => 24 ), } |
1219 |
)->count, |
1219 |
)->count, |
1220 |
6, |
1220 |
6, |
1221 |
'Yesterday - 1h, not truncated, within time frame' |
1221 |
'Yesterday, not truncated, results' |
1222 |
); |
1222 |
); |
1223 |
}; |
1223 |
}; |
1224 |
|
1224 |
|
1225 |
- |
|
|