Evidence::getDiagGroup PHP Method

getDiagGroup() public method

public getDiagGroup ( $this_evidence_id, $active_project )
    public function getDiagGroup($this_evidence_id, $active_project)
    {
        // Get the diagnosticity. Both variables are objects.
        $total_diag = 0;
        $all_users = implode(",", $active_project->users);
        $all_hypotheses = implode(",", $active_project->hypotheses);
        $results = mysql_fast("SELECT * FROM ratings WHERE evidence_id='{$this_evidence_id}' AND hypothesis_id IN ( {$all_hypotheses} ) AND user_id IN ( {$all_users} )");
        for ($k = 0; $k < count($results); $k++) {
            $total_diag += getHypoRatingScore($results[$k]['rating']);
        }
        return $total_diag * -1;
        //multiple by -1 so that most diagnostic evidence appears at top upon sort
    }

Usage Example

 public function getDiagsGroup()
 {
     // Load up diags for the evidence array.
     for ($i = 0; $i < count($this->evidence); $i++) {
         $this_evidence = new Evidence();
         $this_evidence->populateFromId($this->evidence[$i]);
         $this_evidence->diag = Evidence::getDiagGroup($this_evidence->id, $this);
         //$this_evidence->update();
     }
 }
All Usage Examples Of Evidence::getDiagGroup