Evidence::getDiagCompare PHP Method

getDiagCompare() public method

public getDiagCompare ( $this_evidence_id, $active_project, $user_1, $user_2 )
    public function getDiagCompare($this_evidence_id, $active_project, $user_1, $user_2)
    {
        // Get the diagnosticity. Both variables are objects.
        $total_diag = 0;
        $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 (" . $user_1->id . ", " . $user_2->id . ")");
        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 getDiagsCompare($user_1, $user_2)
 {
     // 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::getDiagCompare($this_evidence->id, $this, $user_1, $user_2);
         //$this_evidence->update();
     }
 }