Browse Source

Implement querying articles by hidden mark

rpm
J. King 3 years ago
parent
commit
8ae3740d5f
  1. 2
      lib/Database.php
  2. 30
      tests/cases/Database/SeriesArticle.php

2
lib/Database.php

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

30
tests/cases/Database/SeriesArticle.php

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

Loading…
Cancel
Save