Implement querying articles by hidden mark

This commit is contained in:
J. King 2020-12-15 19:28:51 -05:00
parent d5cd5b6a17
commit 8ae3740d5f
2 changed files with 19 additions and 13 deletions

View file

@ -1312,6 +1312,7 @@ class Database {
'folder' => "coalesce(arsse_subscriptions.folder,0)", 'folder' => "coalesce(arsse_subscriptions.folder,0)",
'subscription' => "arsse_subscriptions.id", 'subscription' => "arsse_subscriptions.id",
'feed' => "arsse_subscriptions.feed", 'feed' => "arsse_subscriptions.feed",
'hidden' => "coalesce(arsse_marks.hidden,0)",
'starred' => "coalesce(arsse_marks.starred,0)", 'starred' => "coalesce(arsse_marks.starred,0)",
'unread' => "abs(coalesce(arsse_marks.read,0) - 1)", 'unread' => "abs(coalesce(arsse_marks.read,0) - 1)",
'note' => "coalesce(arsse_marks.note,'')", 'note' => "coalesce(arsse_marks.note,'')",
@ -1417,6 +1418,7 @@ class Database {
"subscriptions" => ["subscription", "in", "int", ""], "subscriptions" => ["subscription", "in", "int", ""],
"unread" => ["unread", "=", "bool", ""], "unread" => ["unread", "=", "bool", ""],
"starred" => ["starred", "=", "bool", ""], "starred" => ["starred", "=", "bool", ""],
"hidden" => ["hidden", "=", "bool", ""],
]; ];
foreach ($options as $m => [$col, $op, $type, $pair]) { foreach ($options as $m => [$col, $op, $type, $pair]) {
if (!$context->$m()) { if (!$context->$m()) {

View file

@ -235,21 +235,23 @@ trait SeriesArticle {
'starred' => "bool", 'starred' => "bool",
'modified' => "datetime", 'modified' => "datetime",
'note' => "str", 'note' => "str",
'hidden' => "bool",
], ],
'rows' => [ 'rows' => [
[1, 1,1,1,'2000-01-01 00:00:00',''], [1, 1,1,1,'2000-01-01 00:00:00','',0],
[5, 19,1,0,'2016-01-01 00:00:00',''], [5, 19,1,0,'2016-01-01 00:00:00','',0],
[5, 20,0,1,'2005-01-01 00:00:00',''], [5, 20,0,1,'2005-01-01 00:00:00','',0],
[7, 20,1,0,'2010-01-01 00:00:00',''], [7, 20,1,0,'2010-01-01 00:00:00','',0],
[8, 102,1,0,'2000-01-02 02:00:00','Note 2'], [8, 102,1,0,'2000-01-02 02:00:00','Note 2',0],
[9, 103,0,1,'2000-01-03 03:00:00','Note 3'], [9, 103,0,1,'2000-01-03 03:00:00','Note 3',0],
[9, 104,1,1,'2000-01-04 04:00:00','Note 4'], [9, 104,1,1,'2000-01-04 04:00:00','Note 4',0],
[10,105,0,0,'2000-01-05 05:00:00',''], [10,105,0,0,'2000-01-05 05:00:00','',0],
[11, 19,0,0,'2017-01-01 00:00:00','ook'], [11, 19,0,0,'2017-01-01 00:00:00','ook',0],
[11, 20,1,0,'2017-01-01 00:00:00','eek'], [11, 20,1,0,'2017-01-01 00:00:00','eek',0],
[12, 3,0,1,'2017-01-01 00:00:00','ack'], [12, 3,0,1,'2017-01-01 00:00:00','ack',0],
[12, 4,1,1,'2017-01-01 00:00:00','ach'], [12, 4,1,1,'2017-01-01 00:00:00','ach',0],
[1, 2,0,0,'2010-01-01 00:00:00','Some Note'], [1, 2,0,0,'2010-01-01 00:00:00','Some Note',0],
[3, 5,0,0,'2000-01-01 00:00:00','',1],
], ],
], ],
'arsse_categories' => [ // author-supplied categories 'arsse_categories' => [ // author-supplied categories
@ -443,6 +445,8 @@ trait SeriesArticle {
'Starred and Read in subscription' => [(new Context)->starred(true)->unread(false)->subscription(5), []], 'Starred and Read in subscription' => [(new Context)->starred(true)->unread(false)->subscription(5), []],
'Annotated' => [(new Context)->annotated(true), [2]], 'Annotated' => [(new Context)->annotated(true), [2]],
'Not annotated' => [(new Context)->annotated(false), [1,3,4,5,6,7,8,19,20]], 'Not annotated' => [(new Context)->annotated(false), [1,3,4,5,6,7,8,19,20]],
'Hidden' => [(new Context)->hidden(true), [5]],
'Not hidden' => [(new Context)->hidden(false), [1,2,3,4,6,7,8,19,20]],
'Labelled' => [(new Context)->labelled(true), [1,5,8,19,20]], 'Labelled' => [(new Context)->labelled(true), [1,5,8,19,20]],
'Not labelled' => [(new Context)->labelled(false), [2,3,4,6,7]], 'Not labelled' => [(new Context)->labelled(false), [2,3,4,6,7]],
'Not after edition 999' => [(new Context)->subscription(5)->latestEdition(999), [19]], 'Not after edition 999' => [(new Context)->subscription(5)->latestEdition(999), [19]],