You are here

protected function OpignoGroupManagerController::getMaxScore in Opigno group manager 8

Same name and namespace in other branches
  1. 3.x src/Controller/OpignoGroupManagerController.php \Drupal\opigno_group_manager\Controller\OpignoGroupManagerController::getMaxScore()

Duplicate training.

Parameters

\Drupal\group\Entity\Group $group: Group object.

1 call to OpignoGroupManagerController::getMaxScore()
OpignoGroupManagerController::trainingExport in src/Controller/OpignoGroupManagerController.php
Export training.

File

src/Controller/OpignoGroupManagerController.php, line 1712

Class

OpignoGroupManagerController
Controller for all the actions of the Opigno group manager app.

Namespace

Drupal\opigno_group_manager\Controller

Code

protected function getMaxScore($module, $activity) {
  $query = \Drupal::service('database')
    ->select('opigno_module_relationship', 'omr')
    ->fields('omr', [])
    ->condition('omr.parent_id', $module
    ->id())
    ->condition('omr.parent_vid', $module
    ->getRevisionId())
    ->condition('omr.child_id', $activity->id)
    ->condition('omr.child_vid', $activity->vid)
    ->condition('omr.activity_status', 1);
  $results = $query
    ->execute()
    ->fetchAll();
  $omr = !empty($results[0]) ? $results[0] : [];
  return (array) $omr;
}