original_string: private static function analytics_prediction_actions_context_sql($contextid, $modelids, $usersql = false) {
          global $DB;
  
          list($insql, $params) = $DB->get_in_or_equal($modelids, SQL_PARAMS_NAMED);
          $sql = " FROM {analytics_predictions} ap
                    JOIN {analytics_prediction_actions} apa ON apa.predictionid = ap.id
                   WHERE ap.contextid = :contextid
                     AND ap.modelid {$insql}";
          $params['contextid'] = $contextid;
  
          if ($usersql) {
              $sql .= " AND apa.userid {$usersql}";
          }
  
          return [$sql, $params];
      }
code: private static function analytics_prediction_actions_context_sql($contextid, $modelids, $usersql = false) {
          global $DB;
  
          list($insql, $params) = $DB->get_in_or_equal($modelids, SQL_PARAMS_NAMED);
          $sql = " FROM {analytics_predictions} ap
                    JOIN {analytics_prediction_actions} apa ON apa.predictionid = ap.id
                   WHERE ap.contextid = :contextid
                     AND ap.modelid {$insql}";
          $params['contextid'] = $contextid;
  
          if ($usersql) {
              $sql .= " AND apa.userid {$usersql}";
          }
  
          return [$sql, $params];
      }
code_tokens: private static function analytics_prediction_actions_context_sql ( $ contextid , $ modelids , $ usersql = false ) { global $ DB ; list ( $ insql , $ params ) = $ DB -> get_in_or_equal ( $ modelids , SQL_PARAMS_NAMED ) ; $ sql = " FROM {analytics_predictions} ap
                    JOIN {analytics_prediction_actions} apa ON apa.predictionid = ap.id
                   WHERE ap.contextid = :contextid
                     AND ap.modelid {$insql}" ; $ params [ 'contextid' ] = $ contextid ; if ( $ usersql ) { $ sql .= " AND apa.userid {$usersql}" ; } return [ $ sql , $ params ] ; }
docstring: Returns the sql query to query analytics_prediction_actions table by context ID.
  
  @param int $contextid The context ID of the analytics prediction.
  @param int[] $modelids Model IDs to include in the SQL.
  @param string $usersql Optional "in or equal" SQL to also query by user ID(s).
  @return array sql string in [0] and params in [1].
docstring_tokens: Returns the sql query to query analytics_prediction_actions table by context ID .