Skip to content

Commit

Permalink
Issue #13: Fixed CI/CD unit test failure
Browse files Browse the repository at this point in the history
  • Loading branch information
niko-hoogeveen committed Nov 28, 2024
1 parent d156c97 commit a387ba4
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 4 deletions.
27 changes: 24 additions & 3 deletions classes/privacy/provider.php
Original file line number Diff line number Diff line change
Expand Up @@ -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');
Expand Down Expand Up @@ -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";

Expand All @@ -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
Expand Down
9 changes: 9 additions & 0 deletions lang/en/pcast.php
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down
2 changes: 1 addition & 1 deletion tests/privacy/provider_test.php
Original file line number Diff line number Diff line change
Expand Up @@ -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());
Expand Down

0 comments on commit a387ba4

Please sign in to comment.