From e6f70527cf0c6d1f939244ff1b1cd7cdf33f937d Mon Sep 17 00:00:00 2001 From: "J. King" Date: Thu, 7 Mar 2019 08:20:09 -0500 Subject: [PATCH] Simplify tag summary --- lib/Database.php | 9 +++------ tests/cases/Database/SeriesTag.php | 10 +++++----- 2 files changed, 8 insertions(+), 11 deletions(-) diff --git a/lib/Database.php b/lib/Database.php index 043b993..f5409d1 100644 --- a/lib/Database.php +++ b/lib/Database.php @@ -2002,14 +2002,11 @@ class Database { } return $this->db->prepare( "SELECT - arsse_tags.id as tag_id, - arsse_tags.name as tag_name, - arsse_subscriptions.id as subscription_id, - coalesce(arsse_subscriptions.title, arsse_feeds.title) as subscription_name + arsse_tags.id as id, + arsse_tags.name as name, + arsse_tag_members.subscription as subscription FROM arsse_tag_members join arsse_tags on arsse_tags.id = arsse_tag_members.tag - join arsse_subscriptions on arsse_subscriptions.id = arsse_tag_members.subscription - join arsse_feeds on arsse_feeds.id = arsse_subscriptions.feed WHERE arsse_tags.owner = ? and assigned = 1", "str" )->run($user); diff --git a/tests/cases/Database/SeriesTag.php b/tests/cases/Database/SeriesTag.php index ea40d41..7c5aa1c 100644 --- a/tests/cases/Database/SeriesTag.php +++ b/tests/cases/Database/SeriesTag.php @@ -378,11 +378,11 @@ trait SeriesTag { public function testSummarizeTags() { $exp = [ - ['tag_id' => 1, 'tag_name' => "Interesting", 'subscription_id' => 1, 'subscription_name' => "Lord of Carrots"], - ['tag_id' => 1, 'tag_name' => "Interesting", 'subscription_id' => 5, 'subscription_name' => "Feed Title"], - ['tag_id' => 2, 'tag_name' => "Fascinating", 'subscription_id' => 1, 'subscription_name' => "Lord of Carrots"], - ['tag_id' => 2, 'tag_name' => "Fascinating", 'subscription_id' => 3, 'subscription_name' => "Subscription Title"], - ['tag_id' => 2, 'tag_name' => "Fascinating", 'subscription_id' => 5, 'subscription_name' => "Feed Title"], + ['id' => 1, 'name' => "Interesting", 'subscription' => 1], + ['id' => 1, 'name' => "Interesting", 'subscription' => 5], + ['id' => 2, 'name' => "Fascinating", 'subscription' => 1], + ['id' => 2, 'name' => "Fascinating", 'subscription' => 3], + ['id' => 2, 'name' => "Fascinating", 'subscription' => 5], ]; $this->assertResult($exp, Arsse::$db->tagSummarize("john.doe@example.com")); }