original_string: public function get_predictions_contexts($skiphidden = true) {
          global $DB, $USER;
  
          $sql = "SELECT DISTINCT ap.contextid FROM {analytics_predictions} ap
                    JOIN {context} ctx ON ctx.id = ap.contextid
                   WHERE ap.modelid = :modelid";
          $params = array('modelid' => $this->model->id);
  
          if ($skiphidden) {
              $sql .= " AND NOT EXISTS (
                SELECT 1
                  FROM {analytics_prediction_actions} apa
                 WHERE apa.predictionid = ap.id AND apa.userid = :userid AND (apa.actionname = :fixed OR apa.actionname = :notuseful)
              )";
              $params['userid'] = $USER->id;
              $params['fixed'] = \core_analytics\prediction::ACTION_FIXED;
              $params['notuseful'] = \core_analytics\prediction::ACTION_NOT_USEFUL;
          }
  
          return $DB->get_records_sql($sql, $params);
      }
code: public function get_predictions_contexts($skiphidden = true) {
          global $DB, $USER;
  
          $sql = "SELECT DISTINCT ap.contextid FROM {analytics_predictions} ap
                    JOIN {context} ctx ON ctx.id = ap.contextid
                   WHERE ap.modelid = :modelid";
          $params = array('modelid' => $this->model->id);
  
          if ($skiphidden) {
              $sql .= " AND NOT EXISTS (
                SELECT 1
                  FROM {analytics_prediction_actions} apa
                 WHERE apa.predictionid = ap.id AND apa.userid = :userid AND (apa.actionname = :fixed OR apa.actionname = :notuseful)
              )";
              $params['userid'] = $USER->id;
              $params['fixed'] = \core_analytics\prediction::ACTION_FIXED;
              $params['notuseful'] = \core_analytics\prediction::ACTION_NOT_USEFUL;
          }
  
          return $DB->get_records_sql($sql, $params);
      }
code_tokens: public function get_predictions_contexts ( $ skiphidden = true ) { global $ DB , $ USER ; $ sql = "SELECT DISTINCT ap.contextid FROM {analytics_predictions} ap
                    JOIN {context} ctx ON ctx.id = ap.contextid
                   WHERE ap.modelid = :modelid" ; $ params = array ( 'modelid' => $ this -> model -> id ) ; if ( $ skiphidden ) { $ sql .= " AND NOT EXISTS (
                SELECT 1
                  FROM {analytics_prediction_actions} apa
                 WHERE apa.predictionid = ap.id AND apa.userid = :userid AND (apa.actionname = :fixed OR apa.actionname = :notuseful)
              )" ; $ params [ 'userid' ] = $ USER -> id ; $ params [ 'fixed' ] = \ core_analytics \ prediction :: ACTION_FIXED ; $ params [ 'notuseful' ] = \ core_analytics \ prediction :: ACTION_NOT_USEFUL ; } return $ DB -> get_records_sql ( $ sql , $ params ) ; }
docstring: Get the contexts with predictions.
  
  @param bool $skiphidden Skip hidden predictions
  @return \stdClass[]
docstring_tokens: Get the contexts with predictions .