From a387ba4355f2814bc37b35c62a60631ad3304e61 Mon Sep 17 00:00:00 2001 From: Niko Hoogeveen Date: Thu, 28 Nov 2024 16:42:51 -0500 Subject: [PATCH] Issue #13: Fixed CI/CD unit test failure --- classes/privacy/provider.php | 27 ++++++++++++++++++++++++--- lang/en/pcast.php | 9 +++++++++ tests/privacy/provider_test.php | 2 +- 3 files changed, 34 insertions(+), 4 deletions(-) diff --git a/classes/privacy/provider.php b/classes/privacy/provider.php index 5a561da..293e278 100644 --- a/classes/privacy/provider.php +++ b/classes/privacy/provider.php @@ -72,6 +72,27 @@ public static function get_metadata(collection $items) : collection { 'privacy:metadata:pcast_episodes' ); + $items->add_database_table( + 'pcast', + [ + 'userid' => 'privacy:metadata:pcast:userid', + 'name' => 'privacy:metadata:pcast:name', + 'subtitle' => 'privacy:metadata:pcast:subtitle', + 'keywords' => 'privacy:metadata:pcast:keywords', + 'timemodified' => 'privacy:metadata:pcast:timemodified', + ], + 'privacy:metadata:pcast' + ); + + $items->add_database_table( + 'pcast_views', + [ + 'userid' => 'privacy:metadata:pcast_views:userid', + 'episodeid' => 'privacy:metadata:pcast_views:episodeid', + ], + 'privacy:metadata:pcast_views' + ); + $items->add_subsystem_link('core_files', [], 'privacy:metadata:core_files'); $items->add_subsystem_link('core_comment', [], 'privacy:metadata:core_comments'); $items->add_subsystem_link('core_tag', [], 'privacy:metadata:core_tag'); @@ -125,11 +146,11 @@ public static function get_users_in_context(userlist $userlist) { } // Find users with pcast pisodes. - $sql = "SELECT ge.userid + $sql = "SELECT pe.userid FROM {context} c JOIN {course_modules} cm ON cm.id = c.instanceid AND c.contextlevel = :contextlevel JOIN {modules} m ON m.id = cm.module AND m.name = :modname - JOIN {pcast} p ON g.id = cm.instance + JOIN {pcast} p ON p.id = cm.instance JOIN {pcast_episodes} pe ON pe.pcastid = p.id WHERE c.id = :contextid"; @@ -146,7 +167,7 @@ public static function get_users_in_context(userlist $userlist) { $context->id); // Find users with pcast ratings. - $sql = "SELECT ge.id + $sql = "SELECT pe.id FROM {context} c JOIN {course_modules} cm ON cm.id = c.instanceid AND c.contextlevel = :contextlevel JOIN {modules} m ON m.id = cm.module AND m.name = :modname diff --git a/lang/en/pcast.php b/lang/en/pcast.php index 64f12e3..3d98786 100644 --- a/lang/en/pcast.php +++ b/lang/en/pcast.php @@ -186,6 +186,15 @@ $string['privacy:metadata:pcast_episodes:summary'] = 'The summary of the episode the user added'; $string['privacy:metadata:pcast_episodes:timemodified'] = 'The timestamp indicating when the pcast episode was modified by the user'; $string['privacy:metadata:pcast_episodes:userid'] = 'The ID of the user that is adding this pcast episode'; +$string['privacy:metadata:pcast'] = 'Information about the user\'s pcast'; +$string['privacy:metadata:pcast:keywords'] = 'The keywords for the pcast the user added'; +$string['privacy:metadata:pcast:name'] = 'The name of the episode the user added'; +$string['privacy:metadata:pcast:subtitle'] = 'The subtitle of the pcast the user added'; +$string['privacy:metadata:pcast:timemodified'] = 'The timestamp indicating when the pcast was modified by the user'; +$string['privacy:metadata:pcast:userid'] = 'The ID of the user that is adding this pcast'; +$string['privacy:metadata:pcast_views'] = 'Information about the views of pcasts'; +$string['privacy:metadata:pcast_views:episodeid'] = 'The ID of the pcast episode'; +$string['privacy:metadata:pcast_views:userid'] = 'The userid of the pcast owner'; $string['podcastepisodes'] = 'Podcast episodes'; $string['requireapproval_help'] = 'Require episodes to be approved before posting'; $string['requireapproval'] = 'Require approval for episodes'; diff --git a/tests/privacy/provider_test.php b/tests/privacy/provider_test.php index b56117e..d307c25 100644 --- a/tests/privacy/provider_test.php +++ b/tests/privacy/provider_test.php @@ -103,7 +103,7 @@ public function test_get_metadata() { $collection = new collection('mod_pcast'); $newcollection = provider::get_metadata($collection); $itemcollection = $newcollection->get_collection(); - $this->assertCount(5, $itemcollection); + $this->assertCount(7, $itemcollection); $table = reset($itemcollection); $this->assertEquals('pcast_episodes', $table->get_name());