original_string: public function get_insights_users(\context $context) {
          if ($context->contextlevel === CONTEXT_USER) {
              $users = [$context->instanceid => \core_user::get_user($context->instanceid)];
          } else if ($context->contextlevel >= CONTEXT_COURSE) {
              // At course level or below only enrolled users although this is not ideal for
              // teachers assigned at category level.
              $users = get_enrolled_users($context, 'moodle/analytics:listinsights');
          } else {
              $users = get_users_by_capability($context, 'moodle/analytics:listinsights');
          }
          return $users;
      }
code: public function get_insights_users(\context $context) {
          if ($context->contextlevel === CONTEXT_USER) {
              $users = [$context->instanceid => \core_user::get_user($context->instanceid)];
          } else if ($context->contextlevel >= CONTEXT_COURSE) {
              // At course level or below only enrolled users although this is not ideal for
              // teachers assigned at category level.
              $users = get_enrolled_users($context, 'moodle/analytics:listinsights');
          } else {
              $users = get_users_by_capability($context, 'moodle/analytics:listinsights');
          }
          return $users;
      }
code_tokens: public function get_insights_users ( \ context $ context ) { if ( $ context -> contextlevel === CONTEXT_USER ) { $ users = [ $ context -> instanceid => \ core_user :: get_user ( $ context -> instanceid ) ] ; } else if ( $ context -> contextlevel >= CONTEXT_COURSE ) { // At course level or below only enrolled users although this is not ideal for // teachers assigned at category level. $ users = get_enrolled_users ( $ context , 'moodle/analytics:listinsights' ) ; } else { $ users = get_users_by_capability ( $ context , 'moodle/analytics:listinsights' ) ; } return $ users ; }
docstring: Returns the list of users that will receive insights notifications.
  
  Feel free to overwrite if you need to but keep in mind that moodle/analytics:listinsights
  or moodle/analytics:listowninsights capability is required to access the list of insights.
  
  @param \context $context
  @return array
docstring_tokens: Returns the list of users that will receive insights notifications .