diff --git a/controllers/ProjectController.php b/controllers/ProjectController.php index 9b3bd8c..b950853 100644 --- a/controllers/ProjectController.php +++ b/controllers/ProjectController.php @@ -2618,18 +2618,6 @@ public function actionEditProject($id) } - //if the expiration date changed, update all active servers of the project - if (strtotime($pold['end_date'])!=strtotime($prequest['end_date'])){ - $all_servers=JupyterServer::find()->where(['active'=>true,'project'=>$pold['name']])->all(); - if(!empty($all_servers)){ - foreach ($all_servers as $server){ - $server->expires_on = $prequest['end_date']; - $server->save(false); - } - } - - } - //if the cpu or ram changed, delete all active servers of the project if (($dold['ram']!=$drequest['ram']) || ($dold['cores']!=$drequest['cores'])){ $all_servers=JupyterServer::find()->where(['active'=>true,'project'=>$pold['name']])->all(); diff --git a/models/JupyterRequestNew.php b/models/JupyterRequestNew.php index ee7fc33..253a272 100644 --- a/models/JupyterRequestNew.php +++ b/models/JupyterRequestNew.php @@ -291,7 +291,17 @@ public function uploadNewEdit($requestId,$uchanged) if (((($this->cores<=$row['cores']) && ($this->ram <=$row['ram']) && ( $autoaccept_allowed)) || $uchanged)) { - + //when autoapproved change the active servers end date + + $all_servers=JupyterServer::find()->where(['active'=>true,'project'=>$request->name])->all(); + if(!empty($all_servers)){ + foreach ($all_servers as $server){ + $server->expires_on = $request->end_date; + $server->save(false); + } + } + + $message="Updates to project '$request->name' have been automatically approved.";