diff --git a/lib/Database.php b/lib/Database.php index 3608e21..d201875 100644 --- a/lib/Database.php +++ b/lib/Database.php @@ -1725,7 +1725,7 @@ class Database { $w[] = "{$colDefs[$col]} <= ?"; $t[] = $type; $v[] = $r[1]; - } elseif ($context->$m[1] === null) { + } elseif ($r[1] === null) { // range is open at the high end $w[] = "{$colDefs[$col]} >= ?"; $t[] = $type; diff --git a/tests/cases/Database/SeriesArticle.php b/tests/cases/Database/SeriesArticle.php index b7d1eb0..a28ea59 100644 --- a/tests/cases/Database/SeriesArticle.php +++ b/tests/cases/Database/SeriesArticle.php @@ -530,6 +530,14 @@ trait SeriesArticle { 'Excluding multiple folder trees including root' => [(new Context)->not->folders([0,1,5]), []], 'Before article 3' => [(new Context)->not->articleRange(3, null), [1,2]], 'Before article 19' => [(new Context)->not->articleRange(null, 19), [20]], + 'Marked or labelled in 2010 or 2015' => [(new Context)->markedRanges([["2010-01-01T00:00:00Z", "2010-12-31T23:59:59Z"], ["2015-01-01T00:00:00Z", "2015-12-31T23:59:59Z"]]), [2,4,6,8,20]], + 'Not marked or labelled in 2010 or 2015' => [(new Context)->not->markedRanges([["2010-01-01T00:00:00Z", "2010-12-31T23:59:59Z"], ["2015-01-01T00:00:00Z", "2015-12-31T23:59:59Z"]]), [1,3,5,7,19]], + 'Marked or labelled prior to 2010 or since 2015' => [(new Context)->markedRanges([[null, "2009-12-31T23:59:59Z"], ["2015-01-01T00:00:00Z", null]]), [1,3,5,7,8,19]], + 'Not marked or labelled prior to 2010 or since 2015' => [(new Context)->not->markedRanges([[null, "2009-12-31T23:59:59Z"], ["2015-01-01T00:00:00Z", null]]), [2,4,6,20]], + 'Modified in 2010 or 2015' => [(new Context)->modifiedRanges([["2010-01-01T00:00:00Z", "2010-12-31T23:59:59Z"], ["2015-01-01T00:00:00Z", "2015-12-31T23:59:59Z"]]), [2,4,6,8,20]], + 'Not modified in 2010 or 2015' => [(new Context)->not->modifiedRanges([["2010-01-01T00:00:00Z", "2010-12-31T23:59:59Z"], ["2015-01-01T00:00:00Z", "2015-12-31T23:59:59Z"]]), [1,3,5,7,19]], + 'Modified prior to 2010 or since 2015' => [(new Context)->modifiedRanges([[null, "2009-12-31T23:59:59Z"], ["2015-01-01T00:00:00Z", null]]), [1,3,5,7,19]], + 'Not modified prior to 2010 or since 2015' => [(new Context)->not->modifiedRanges([[null, "2009-12-31T23:59:59Z"], ["2015-01-01T00:00:00Z", null]]), [2,4,6,8,20]], ]; } @@ -1039,9 +1047,10 @@ trait SeriesArticle { public function provideArrayContextOptions(): iterable { foreach ([ "articles", "editions", - "subscriptions", "foldersShallow", //"folders", + "subscriptions", "foldersShallow", "folders", "tags", "tagNames", "labels", "labelNames", "searchTerms", "authorTerms", "annotationTerms", + "modifiedRanges", "markedRanges", ] as $method) { yield [$method]; }