/** * Modify a treatment/id combo as being a completed goal * * @deprecated Use FinishExperiment instead. * @param Scenario_Treatment $treatment * @param Scenario_Identity $id * @return bool Success */ public function FinishTreatment(Scenario_Treatment $treatment, Scenario_Identity $id) { if (!$treatment->isValid()) { require_once 'Scenario/Data/Exception.php'; throw new Scenario_Data_Exception('Treatment provided to FinishTreatment must be valid.'); } // make sure we actually have this treatment stored in the DB already $storedTreatment = $this->GetTreatmentByName($treatment->getExperiment(), $treatment->getName()); if ($storedTreatment === null) { require_once 'Scenario/Data/Exception.php'; throw new Scenario_Data_Exception('Treatment to be finished does not exist.'); } // update the user-treatment record $result = $this->getDbAdapter()->update($this->usersTreatmentsTable, array('completed' => 1), array($this->quote('identity = ?', $id->getDbIdent()), $this->quote('treatment_id = ?', $storedTreatment->getRowId()))); return $result > 0; }
/** * Modify a treatment/id combo as being a completed goal * * @deprecated Use FinishExperiment instead * @param Scenario_Treatment $treatment * @param Scenario_Identity $id * @return bool Success */ public function FinishTreatment(Scenario_Treatment $treatment, Scenario_Identity $id) { if (!$treatment->isValid()) { /** * @see Scenario_Data_Exception */ require_once 'Scenario/Data/Exception.php'; throw new Scenario_Data_Exception('Treatment provided to FinishTreatment must be valid.'); } // make sure we actually have this treatment stored in the DB already $storedTreatment = $this->GetTreatmentByName($treatment->getExperiment(), $treatment->getName()); if ($storedTreatment === null) { /** * @see Scenario_Data_Exception */ require_once 'Scenario/Data/Exception.php'; throw new Scenario_Data_Exception('Treatment to be finished does not exist.'); } // update the user-treatment record $sql = 'UPDATE ' . $this->usersTreatmentsTable . ' SET completed = ? WHERE ' . 'identity = ? AND treatment_id = ?'; $result = $this->prepare($sql, array(1, $id->getDbIdent(), $storedTreatment->getRowId())); return $result->rowCount() > 0; }