public function OpignoModuleManualEvaluation::query in Opigno module 8
Same name and namespace in other branches
- 3.x src/Plugin/views/filter/OpignoModuleManualEvaluation.php \Drupal\opigno_module\Plugin\views\filter\OpignoModuleManualEvaluation::query()
Add this filter to the query.
Due to the nature of fapi, the value and the operator have an unintended level of indirection. You will find them in $this->operator and $this->value respectively.
Overrides FilterPluginBase::query
File
- src/Plugin/ views/ filter/ OpignoModuleManualEvaluation.php, line 20 
Class
- OpignoModuleManualEvaluation
- Filter handler to show modules required manual evaluation filter.
Namespace
Drupal\opigno_module\Plugin\views\filterCode
public function query() {
  $this
    ->ensureMyTable();
  $query = Database::getConnection()
    ->select('opigno_answer_field_data', 'anf');
  $query
    ->join('opigno_activity__opigno_evaluation_method', 'em', 'em.entity_id = anf.activity');
  $query
    ->join('user_module_status', 'ums', 'ums.module = anf.module AND ums.user_id = anf.user_id AND ums.id = anf.user_module_status');
  $query
    ->fields('ums', [
    'id',
  ]);
  $query
    ->condition('anf.type', [
    'opigno_file_upload',
    'opigno_long_answer',
  ], 'IN');
  $query
    ->condition('em.opigno_evaluation_method_value', '1', '=');
  $query
    ->condition('ums.evaluated', '0', '=');
  $query
    ->distinct();
  $group_and = $this->query
    ->setWhereGroup('AND');
  $this->query
    ->addWhere($group_and, 'user_module_status.id', $query, 'IN');
}