/** * Updata a test run to reprooved. * * @param integer $id * the ID of the model to be updated */ public function actionFailTestRun($id) { $model = TestRun::model()->findByPk($id); // Uncomment the following line if AJAX validation is needed // $this->performAjaxValidation($model); $model->setAttribute('status', 2); if ($model->save()) { $this->redirect(array('view', 'id' => $model->id_runs)); } $dataProvider = new CActiveDataProvider('Runs'); $this->render('index', array('dataProvider' => $dataProvider)); }
public function QuantidadeTotal($id) { $testRuns = TestRun::model()->findAllByAttributes(array('id_runs' => $id)); $quantidadeTotal = count($testRuns); $quanti = Runs::QuantidadePass($id); $quantifail = Runs::QuantidadeFail($id); //$result = $quanti + $quantifail; $porcentagem = floor(($quanti + $quantifail) / ($quantidadeTotal == 0 ? 1 : $quantidadeTotal) * 100); return $porcentagem; }