Skip to content

Commit

Permalink
Increase the script exec time on export action
Browse files Browse the repository at this point in the history
Some export will take long time to run. It will timeout on default
execution time (30s)
  • Loading branch information
xcompass committed Oct 17, 2014
1 parent 41fe043 commit 77fd1bd
Showing 1 changed file with 12 additions and 9 deletions.
21 changes: 12 additions & 9 deletions app/controllers/evaluations_controller.php
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,7 @@ function view($eventId = null)

// Set up the basic static ajax list variables
$this->setUpAjaxList($eventId);

// set status whether instructors can view un/release comments & grades
$viewReleaseBtns = time() >= strtotime($event['Event']['release_date_end']);

Expand Down Expand Up @@ -239,6 +239,9 @@ function index ()
*/
function export($type, $id)
{
// increase the execution time
ini_set('max_execution_time', 600);

// $type must be course or event
if ('course' != $type && 'event' != $type) {
$this->Session->setFlash('Error: Invalid export type', true);
Expand Down Expand Up @@ -1572,31 +1575,31 @@ function markGradeRelease($grpEventId, $releaseStatus, $evaluatee = null)
$model = 'EvaluationMixeval';
break;
}

$evalIds = $this->$model->find('list', array('conditions' => $conditions));
$this->$model->updateAll(
array($model.'.grade_release' => $releaseStatus),
array($model.'.id' => $evalIds)
);

$this->GroupEvent->id = $grpEventId;
$evals = $this->$model->find('list', array(
'conditions' => array($model.'.grp_event_id' => $grpEventId),
'fields' => $model.'.grade_release'
));
$all = array_product($evals);
$some = array_sum($evals);

if ($all) {
$grpEvent['GroupEvent']['grade_release_status'] = 'All';
} else if ($some) {
$grpEvent['GroupEvent']['grade_release_status'] = 'Some';
} else {
$grpEvent['GroupEvent']['grade_release_status'] = 'None';
}

$this->GroupEvent->save($grpEvent);

$this->redirect('viewEvaluationResults/'.$eventId.'/'.$grpEvent['GroupEvent']['group_id'].$url);

}
Expand Down Expand Up @@ -1799,7 +1802,7 @@ function changeAllGradeRelease ($param=null)
default:
break;
}

$grpEventList = $this->GroupEvent->getGroupListByEventId($eventId);
foreach ($grpEventList as $grpEvent) {
$this->GroupEvent->id = $grpEvent['GroupEvent']['id'];
Expand All @@ -1809,15 +1812,15 @@ function changeAllGradeRelease ($param=null)
));
$all = array_product($evals);
$some = array_sum($evals);

if ($all) {
$grpEvent['GroupEvent']['grade_release_status'] = 'All';
} else if ($some) {
$grpEvent['GroupEvent']['grade_release_status'] = 'Some';
} else {
$grpEvent['GroupEvent']['grade_release_status'] = 'None';
}

$this->GroupEvent->save($grpEvent);
}

Expand Down

0 comments on commit 77fd1bd

Please sign in to comment.