Skip to content

Commit

Permalink
GH-604 update provider
Browse files Browse the repository at this point in the history
  • Loading branch information
eynimeni committed Oct 10, 2024
1 parent d3a947b commit 2370428
Showing 1 changed file with 5 additions and 24 deletions.
29 changes: 5 additions & 24 deletions classes/privacy/provider.php
Original file line number Diff line number Diff line change
Expand Up @@ -189,9 +189,11 @@ public static function export_user_data(approved_contextlist $contextlist) {
$progressdata[] = $progress->json;
}
$progress = (object) $progressdata;
$created = userdate($attempt->timecreated, get_string('strftimedatetime', 'core_langconfig'));
$modified = userdate($attempt->timemodified, get_string('strftimedatetime', 'core_langconfig'));
$data = [
'timecreated' => $attempt->timecreated,
'timemodified' => $attempt->timemodified,
'timecreated' => $created,
'timemodified' => $modified,
'data' => $attempt->json,
'progress' => $progress,
];
Expand Down Expand Up @@ -272,29 +274,8 @@ public static function delete_data_for_all_users_in_context(\context $context) {
// System context, delete all data.
$DB->delete_records('local_catquiz_subscriptions');
break;
case CONTEXT_COURSE:
// Course context, delete data for all users in the course.
$users = get_enrolled_users($context);
$userids = array_map(function($u) {
return $u->id;
}, $users);
$DB->delete_records_list('local_catquiz_subscriptions', 'userid', $userids);
break;
case CONTEXT_MODULE:
// Module context, delete data for all users in the module.
$users = get_enrolled_users($context);
break;
default:
try {
$users = get_enrolled_users($context);
$userids = array_map(function($u) {
return $u->id;
}, $users);
$DB->delete_records_list('local_catquiz_subscriptions', 'userid', $userids);
} catch (Exception $e) {
// Do nothing.
$error = $e;
}
// Other contexts, don't delete data related to that context.
break;
}

Expand Down

0 comments on commit 2370428

Please sign in to comment.