ano lastupdate

This commit is contained in:
afornerot 2024-02-20 10:59:26 +01:00
parent 86fcff316f
commit 88a518ec1c
3 changed files with 15 additions and 2 deletions

View File

@ -180,6 +180,7 @@ class ScrumissueController extends AbstractController
$scrum=$em->getRepository("App:Scrum")->find($id); $scrum=$em->getRepository("App:Scrum")->find($id);
if(!$scrum) return new JsonResponse(['message' => 'No Scrum'], 403); if(!$scrum) return new JsonResponse(['message' => 'No Scrum'], 403);
$lastupdate=$scrum->getUpdatedate(); $lastupdate=$scrum->getUpdatedate();
$lastupdate->setTimezone(new \DateTimeZone("UTC"));
$giteaissues=$this->giteaservice->getIssues($scrum->getGiteajson()["owner"]["login"],$scrum->getGiteajson()["name"]); $giteaissues=$this->giteaservice->getIssues($scrum->getGiteajson()["owner"]["login"],$scrum->getGiteajson()["name"]);
if(!is_array($giteaissues)) die("Probleme de connexion avec gitea veuillez vous <a href='/logout'>reconnecter</a>"); if(!is_array($giteaissues)) die("Probleme de connexion avec gitea veuillez vous <a href='/logout'>reconnecter</a>");
@ -200,6 +201,9 @@ class ScrumissueController extends AbstractController
$updateissue->setTimezone(new \DateTimeZone("UTC")); $updateissue->setTimezone(new \DateTimeZone("UTC"));
if($updateissue>$lastupdate) { if($updateissue>$lastupdate) {
//var_dump($updateissue);
//var_dump($lastupdate);
$fgissueupdated=true; $fgissueupdated=true;
} }

View File

@ -177,7 +177,8 @@ class ScrumRepository extends ServiceEntityRepository
// Génération des issues // Génération des issues
$tbgiteaissues=[]; $tbgiteaissues=[];
$fgscrumupdate=false; $fgscrumupdate=false;
$this->datescrumupdate=new \DateTime(); $this->datescrumupdate=new \DateTime("01/01/1900");
$this->datescrumupdate->setTimezone(new \DateTimeZone("UTC"));
foreach($giteaissues as $giteaissue) { foreach($giteaissues as $giteaissue) {
@ -207,6 +208,14 @@ class ScrumRepository extends ServiceEntityRepository
} }
if($fgissueupdated) { if($fgissueupdated) {
$updateissue=new \DateTime(json_decode(json_encode($giteaissue), true)["updated_at"]);
$updateissue->setTimezone(new \DateTimeZone("UTC"));
$closeissue=new \DateTime(json_decode(json_encode($giteaissue), true)["closed_at"]);
$closeissue->setTimezone(new \DateTimeZone("UTC"));
$this->datescrumupdate=max($this->datescrumupdate,$updateissue,$closeissue);
$fgscrumupdate=true; $fgscrumupdate=true;
$this->majissue($scrumissue,$giteaissue,false); $this->majissue($scrumissue,$giteaissue,false);
} }

View File

@ -934,7 +934,7 @@
} }
} }
}); });
}, 60000); }, 6000);
}); });