refresh issue if closed
This commit is contained in:
parent
b58487e075
commit
e15d25236a
|
@ -12,6 +12,8 @@ use Symfony\Component\HttpFoundation\Session\SessionInterface;
|
|||
class ScrumRepository extends ServiceEntityRepository
|
||||
{
|
||||
private $session;
|
||||
private $firstcolumn;
|
||||
private $datescrumupdate;
|
||||
|
||||
public function __construct(ManagerRegistry $registry,giteaService $giteaservice,SessionInterface $session)
|
||||
{
|
||||
|
@ -43,8 +45,8 @@ class ScrumRepository extends ServiceEntityRepository
|
|||
else $lastrowid=$last->getRowid();
|
||||
|
||||
// Récupérer la premier column scrum
|
||||
$firstcolumn=$this->_em->getRepository('App:Scrumcolumn')->findOneBy(["scrum"=>$scrum], ['rowid' => 'ASC']);
|
||||
if(!$firstcolumn) return $this->redirectToRoute($this->route."_update",["id"=>$scrum->getId()]);
|
||||
$this->firstcolumn=$this->_em->getRepository('App:Scrumcolumn')->findOneBy(["scrum"=>$scrum], ['rowid' => 'ASC']);
|
||||
if(!$this->firstcolumn) return $this->redirectToRoute($this->route."_update",["id"=>$scrum->getId()]);
|
||||
|
||||
// Récupérer la premier column scrum
|
||||
$columns=$this->_em->getRepository('App:Scrumcolumn')->findBy(["scrum"=>$scrum], ['rowid' => 'ASC']);
|
||||
|
@ -114,7 +116,7 @@ class ScrumRepository extends ServiceEntityRepository
|
|||
// Génération des issues
|
||||
$tbgiteaissues=[];
|
||||
$fgscrumupdate=false;
|
||||
$datescrumupdate=new \DateTime();
|
||||
$this->datescrumupdate=new \DateTime();
|
||||
|
||||
foreach($giteaissues as $giteaissue) {
|
||||
// On ne prend pas les pull request
|
||||
|
@ -142,11 +144,37 @@ class ScrumRepository extends ServiceEntityRepository
|
|||
if(!$giteaissue->milestone&&!is_null($scrumissue->getGiteamilestone()))
|
||||
$fgissueupdated=true;
|
||||
|
||||
//$fgissueupdated=true;
|
||||
$fgissueupdated=true;
|
||||
if($fgissueupdated) {
|
||||
$fgscrumupdate=true;
|
||||
if($scrumissue->getGiteajson()["updated_at"]>$datescrumupdate)
|
||||
$datescrumupdate=$scrumissue->getGiteajson()["updated_at"];
|
||||
$this->majissue($scrumissue,$giteaissue);
|
||||
}
|
||||
array_push($tbgiteaissues,$giteaissue->number);
|
||||
}
|
||||
|
||||
// Bug faudrait placer à closed l'ensemble des issues vu comme open mais qui ne le sont plus
|
||||
if($viewclosed=="false") {
|
||||
$scrumissues=$scrum->getScrumissues();
|
||||
foreach($scrumissues as $scrumissue) {
|
||||
if($scrumissue->getGiteastate()=="open"&&!in_array($scrumissue->getGiteanumber(),$tbgiteaissues)) {
|
||||
$giteaissue=$this->giteaservice->getIssue($scrum->getGiteajson()["owner"]["login"],$scrum->getGiteajson()["name"],$scrumissue->getGiteanumber());
|
||||
$fgscrumupdate=true;
|
||||
$this->majissue($scrumissue,$giteaissue);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if($fgscrumupdate) {
|
||||
$scrum->setUpdatedate($this->datescrumupdate);
|
||||
$this->_em->persist($scrum);
|
||||
$this->_em->flush();
|
||||
}
|
||||
}
|
||||
|
||||
function majissue($scrumissue,$giteaissue) {
|
||||
if($scrumissue->getGiteajson()["updated_at"]>$this->datescrumupdate)
|
||||
$this->datescrumupdate=$scrumissue->getGiteajson()["updated_at"];
|
||||
|
||||
$scrumissue->setGiteanumber($giteaissue->number);
|
||||
$scrumissue->setGiteastate($giteaissue->state);
|
||||
|
@ -174,10 +202,10 @@ class ScrumRepository extends ServiceEntityRepository
|
|||
}
|
||||
}
|
||||
if(!$havecolumn) {
|
||||
$scrumissue->setScrumcolumn($firstcolumn);
|
||||
$scrumissue->setScrumcolumn($this->firstcolumn);
|
||||
|
||||
// Affecter le label backlog en tant que gitealabel
|
||||
$backlog=array($firstcolumn->getGiteaid());
|
||||
$backlog=array($this->firstcolumn->getGiteaid());
|
||||
$this->giteaservice->putIssuelabels($scrumissue->getScrum()->getGiteajson()["owner"]["login"],$scrumissue->getScrum()->getGiteajson()["name"],$scrumissue->getGiteanumber(),$backlog);
|
||||
}
|
||||
|
||||
|
@ -185,24 +213,4 @@ class ScrumRepository extends ServiceEntityRepository
|
|||
$this->_em->persist($scrumissue);
|
||||
$this->_em->flush();
|
||||
}
|
||||
array_push($tbgiteaissues,$giteaissue->number);
|
||||
}
|
||||
|
||||
/*
|
||||
on garde les issues closed
|
||||
$scrumissues=$scrum->getScrumissues();
|
||||
foreach($scrumissues as $scrumissue) {
|
||||
if(!in_array($scrumissue->getGiteanumber(),$tbgiteaissues)) {
|
||||
$this->_em->remove($scrumissue);
|
||||
$this->_em->flush();
|
||||
}
|
||||
}
|
||||
*/
|
||||
|
||||
if($fgscrumupdate) {
|
||||
$scrum->setUpdatedate($datescrumupdate);
|
||||
$this->_em->persist($scrum);
|
||||
$this->_em->flush();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue