mise en place de sprint dans les jalons
This commit is contained in:
@ -39,6 +39,60 @@ class ScrumRepository extends ServiceEntityRepository
|
||||
public function getGitea($scrum,&$giteaassignees,&$giteacolumns,&$giteamilestones,&$giteateams,&$giteaprioritys,&$giteatypes,&$gitealabels, $forcereload=false) {
|
||||
$viewclosed = $this->session->get("viewclosed");
|
||||
|
||||
// Récupérer les labels de gitea
|
||||
$gitealabels=$this->giteaservice->getLabels($scrum->getGiteajson()["owner"]["login"],$scrum->getGiteajson()["name"]);
|
||||
if(!is_array($gitealabels)) die("Probleme de connexion avec gitea veuillez vous <a href='/ninegitea/logout'>reconnecter</a>");
|
||||
|
||||
// S'assurer que nos colonnes existes toujours
|
||||
$scrumcolumns=$scrum->getScrumcolumns();
|
||||
foreach($scrumcolumns as $scrumcolumn) {
|
||||
$gitealabel=$this->giteaservice->getLabel($scrum->getGiteajson()["owner"]["login"],$scrum->getGiteajson()["name"],$scrumcolumn->getGiteaid());
|
||||
if(!$gitealabel) {
|
||||
$this->_em->remove($scrumcolumn);
|
||||
$this->_em->flush();
|
||||
}
|
||||
}
|
||||
|
||||
// S'assurer que nos teams existes toujours
|
||||
$scrumteams=$scrum->getScrumteams();
|
||||
foreach($scrumteams as $scrumteam) {
|
||||
$gitealabel=$this->giteaservice->getLabel($scrum->getGiteajson()["owner"]["login"],$scrum->getGiteajson()["name"],$scrumteam->getGiteaid());
|
||||
if(!$gitealabel) {
|
||||
$this->_em->remove($scrumteam);
|
||||
$this->_em->flush();
|
||||
}
|
||||
}
|
||||
|
||||
// S'assurer que nos prioritys existes toujours
|
||||
$scrumprioritys=$scrum->getScrumprioritys();
|
||||
foreach($scrumprioritys as $scrumpriority) {
|
||||
$gitealabel=$this->giteaservice->getLabel($scrum->getGiteajson()["owner"]["login"],$scrum->getGiteajson()["name"],$scrumpriority->getGiteaid());
|
||||
if(!$gitealabel) {
|
||||
$this->_em->remove($scrumpriority);
|
||||
$this->_em->flush();
|
||||
}
|
||||
}
|
||||
|
||||
// S'assurer que nos types existes toujours
|
||||
$scrumtypes=$scrum->getScrumtypes();
|
||||
foreach($scrumtypes as $scrumtype) {
|
||||
$gitealabel=$this->giteaservice->getLabel($scrum->getGiteajson()["owner"]["login"],$scrum->getGiteajson()["name"],$scrumtype->getGiteaid());
|
||||
if(!$gitealabel) {
|
||||
$this->_em->remove($scrumtype);
|
||||
$this->_em->flush();
|
||||
}
|
||||
}
|
||||
|
||||
// S'assurer que nos sprint sont toujours lié à un jalon existant
|
||||
$scrumsprints=$scrum->getScrumsprints();
|
||||
foreach($scrumsprints as $scrumsprint) {
|
||||
$giteamilestone=$this->giteaservice->getMilestone($scrum->getGiteajson()["owner"]["login"],$scrum->getGiteajson()["name"],$scrumsprint->getGiteamilestone());
|
||||
if(!$giteamilestone) {
|
||||
$this->_em->remove($scrumsprint);
|
||||
$this->_em->flush();
|
||||
}
|
||||
}
|
||||
|
||||
// Récupérer le dernier order
|
||||
$last = $this->_em->getRepository('App:Scrumissue')->findOneBy(["scrum"=>$scrum], ['rowid' => 'DESC']);
|
||||
if(!$last) $lastrowid=-1;
|
||||
@ -110,7 +164,7 @@ class ScrumRepository extends ServiceEntityRepository
|
||||
// Récupérer les labels de gitea
|
||||
$gitealabels=$this->giteaservice->getLabels($scrum->getGiteajson()["owner"]["login"],$scrum->getGiteajson()["name"]);
|
||||
|
||||
if(!is_array($gitealabels)) die("Probleme de connexion avec gitea veuillez vous <a href='/ninegitea/logout'>reconnecter</a>");
|
||||
// Formatter les labels non colomn/team/priority/type
|
||||
foreach($gitealabels as $key => $gitealabel) {
|
||||
if(in_array($gitealabel->id,$giteacolumns)||in_array($gitealabel->id,$giteateams)||in_array($gitealabel->id,$giteaprioritys)||in_array($gitealabel->id,$giteatypes))
|
||||
unset($gitealabels[$key]);
|
||||
@ -126,10 +180,6 @@ class ScrumRepository extends ServiceEntityRepository
|
||||
$this->datescrumupdate=new \DateTime();
|
||||
|
||||
foreach($giteaissues as $giteaissue) {
|
||||
// On ne prend pas les pull request
|
||||
if(!is_null($giteaissue->pull_request)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$scrumissue=$this->_em->getRepository("App:Scrumissue")->findOneBy(["scrum"=>$scrum,"giteaid"=>$giteaissue->id]);
|
||||
|
||||
@ -139,42 +189,51 @@ class ScrumRepository extends ServiceEntityRepository
|
||||
$scrumissue->setScrum($scrum);
|
||||
$scrumissue->setRowid($lastrowid);
|
||||
$scrumissue->setGiteaid($giteaissue->id);
|
||||
$this->majissue($scrumissue,$giteaissue,true);
|
||||
}
|
||||
else {
|
||||
$fgissueupdated=false;
|
||||
if($scrumissue->getGiteajson()["updated_at"]!=json_decode(json_encode($giteaissue), true)["updated_at"])
|
||||
$fgissueupdated=true;
|
||||
if($scrumissue->getGiteajson()["closed_at"]!=json_decode(json_encode($giteaissue), true)["closed_at"])
|
||||
$fgissueupdated=true;
|
||||
if($giteaissue->milestone&&$scrumissue->getGiteamilestonename()!=$giteaissue->milestone->title)
|
||||
$fgissueupdated=true;
|
||||
if(!$giteaissue->milestone&&!is_null($scrumissue->getGiteamilestone()))
|
||||
$fgissueupdated=true;
|
||||
|
||||
$fgissueupdated=false;
|
||||
if($scrumissue->getGiteajson()["updated_at"]!=json_decode(json_encode($giteaissue), true)["updated_at"])
|
||||
$fgissueupdated=true;
|
||||
if($scrumissue->getGiteajson()["closed_at"]!=json_decode(json_encode($giteaissue), true)["closed_at"])
|
||||
$fgissueupdated=true;
|
||||
if($giteaissue->milestone&&$scrumissue->getGiteamilestonename()!=$giteaissue->milestone->title)
|
||||
$fgissueupdated=true;
|
||||
if(!$giteaissue->milestone&&!is_null($scrumissue->getGiteamilestone()))
|
||||
$fgissueupdated=true;
|
||||
if($forcereload) {
|
||||
$fgissueupdated=true;
|
||||
}
|
||||
|
||||
if($forcereload) {
|
||||
$fgissueupdated=true;
|
||||
}
|
||||
|
||||
if($fgissueupdated) {
|
||||
$fgscrumupdate=true;
|
||||
$this->majissue($scrumissue,$giteaissue);
|
||||
if($fgissueupdated) {
|
||||
$fgscrumupdate=true;
|
||||
$this->majissue($scrumissue,$giteaissue,false);
|
||||
}
|
||||
}
|
||||
array_push($tbgiteaissues,$giteaissue->number);
|
||||
}
|
||||
|
||||
// Bug faudrait placer à closed l'ensemble des issues vu comme open mais qui ne le sont plus
|
||||
// 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);
|
||||
|
||||
// S'il ne trouve pas d'issue c'est qu'elle n'existe plus
|
||||
if(!$giteaissue) {
|
||||
// Faudrait supprimer mais pour l'instant pas touche
|
||||
//dump("netrouvepasissue alors");
|
||||
//dump($scrumissue->getGiteanumber());
|
||||
}
|
||||
// Sinon mise
|
||||
else $this->majissue($scrumissue,$giteaissue,false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if($fgscrumupdate) {
|
||||
$scrum->setUpdatedate($this->datescrumupdate);
|
||||
$this->_em->persist($scrum);
|
||||
@ -182,13 +241,11 @@ class ScrumRepository extends ServiceEntityRepository
|
||||
}
|
||||
}
|
||||
|
||||
function majissue($scrumissue,$giteaissue) {
|
||||
if($scrumissue->getGiteajson()["updated_at"]>$this->datescrumupdate)
|
||||
$this->datescrumupdate=$scrumissue->getGiteajson()["updated_at"];
|
||||
|
||||
function majissue($scrumissue,$giteaissue,$issubmit) {
|
||||
$scrumissue->setGiteanumber($giteaissue->number);
|
||||
$scrumissue->setGiteastate($giteaissue->state);
|
||||
$scrumissue->setGiteatitle($giteaissue->title);
|
||||
|
||||
if($giteaissue->milestone) {
|
||||
$scrumissue->setGiteamilestone($giteaissue->milestone->id);
|
||||
$scrumissue->setGiteamilestonename($giteaissue->milestone->title);
|
||||
|
Reference in New Issue
Block a user