Skip to content

Commit

Permalink
Merge pull request #71 from katmastt/main
Browse files Browse the repository at this point in the history
Fixed bug with jupyter date for auto accepted requests
  • Loading branch information
eleni-adamidi authored Dec 14, 2023
2 parents aa06fc9 + 63edc1b commit 9dbe3a0
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 13 deletions.
12 changes: 0 additions & 12 deletions controllers/ProjectController.php
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
12 changes: 11 additions & 1 deletion models/JupyterRequestNew.php
Original file line number Diff line number Diff line change
Expand Up @@ -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.";

Expand Down

0 comments on commit 9dbe3a0

Please sign in to comment.