2021-07-20 13:04:47 +02:00
|
|
|
<?php
|
|
|
|
|
|
|
|
namespace App\Controller;
|
|
|
|
|
|
|
|
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
|
|
|
|
use Symfony\Component\HttpFoundation\Request;
|
2022-09-21 11:05:17 +02:00
|
|
|
use Symfony\Component\HttpFoundation\JsonResponse;
|
2024-02-20 11:12:38 +01:00
|
|
|
use Symfony\Component\Filesystem\Filesystem;
|
|
|
|
use Symfony\Component\HttpFoundation\BinaryFileResponse;
|
|
|
|
use Symfony\Component\HttpFoundation\ResponseHeaderBag;
|
2021-07-20 13:04:47 +02:00
|
|
|
|
|
|
|
use App\Entity\Scrum as Entity;
|
|
|
|
use App\Entity\Scrumissue as Scrumissue;
|
|
|
|
use App\Form\ScrumType as Form;
|
|
|
|
|
|
|
|
use App\Service\giteaService;
|
|
|
|
|
|
|
|
class ScrumController extends AbstractController
|
|
|
|
{
|
|
|
|
private $data = "scrum";
|
|
|
|
private $route = "app_scrum";
|
|
|
|
private $render = "Scrum/";
|
|
|
|
private $entity = "App:Scrum";
|
2024-02-15 18:59:09 +01:00
|
|
|
private $giteaservice;
|
2021-07-20 13:04:47 +02:00
|
|
|
|
|
|
|
public function __construct(giteaService $giteaservice) { $this->giteaservice = $giteaservice; }
|
|
|
|
|
|
|
|
public function list(Request $request)
|
|
|
|
{
|
|
|
|
$em = $this->getDoctrine()->getManager();
|
2022-06-29 11:50:27 +02:00
|
|
|
$scrums = $em->getRepository($this->entity)->findByUser($this->getUser());
|
2022-01-22 11:18:42 +01:00
|
|
|
|
2024-02-15 22:36:10 +01:00
|
|
|
$this->giteaservice->needrefresh();
|
|
|
|
|
2022-01-22 11:18:42 +01:00
|
|
|
$giteacategorys=[];
|
|
|
|
$gitearepos=[];
|
|
|
|
|
|
|
|
foreach($scrums as $key => $scrum) {
|
|
|
|
if(!in_array($scrum->getCategory(),$giteacategorys))
|
|
|
|
array_push($giteacategorys,$scrum->getCategory());
|
|
|
|
|
|
|
|
$gitearepo=$this->giteaservice->getRepo($scrum->getGiteajson()["id"]);
|
2022-02-03 17:26:35 +01:00
|
|
|
if($gitearepo) {
|
|
|
|
if($gitearepo->updated_at!=$scrum->getGiteajson()["updated_at"]||$gitearepo->open_issues_count!=$scrum->getGiteajson()["open_issues_count"]) {
|
|
|
|
$scrum->setGiteajson(json_decode(json_encode($gitearepo), true));
|
|
|
|
$em->persist($scrum);
|
|
|
|
$em->flush();
|
|
|
|
}
|
2022-01-22 11:18:42 +01:00
|
|
|
|
2022-02-03 17:26:35 +01:00
|
|
|
array_push($gitearepos,$gitearepo);
|
2022-01-22 11:18:42 +01:00
|
|
|
}
|
2022-01-13 20:24:04 +01:00
|
|
|
}
|
2022-01-22 11:18:42 +01:00
|
|
|
sort($giteacategorys);
|
|
|
|
|
|
|
|
$filtercategorys = $em->getRepository("App:User")->getUserpreference($this->getUser(),"filtercategorys",0);
|
|
|
|
$filterrepos = $em->getRepository("App:User")->getUserpreference($this->getUser(),"filterrepos",0);
|
2021-07-20 13:04:47 +02:00
|
|
|
|
|
|
|
return $this->render($this->render.'list.html.twig',[
|
2022-01-22 11:18:42 +01:00
|
|
|
$this->data."s" => $scrums,
|
|
|
|
"giteacategorys" => $giteacategorys,
|
|
|
|
"gitearepos" => $gitearepos,
|
|
|
|
"filtercategorys" => $filtercategorys,
|
|
|
|
"filterrepos" => $filterrepos,
|
|
|
|
"useheader" => true,
|
|
|
|
"usesidebar" => false,
|
2021-07-20 13:04:47 +02:00
|
|
|
]);
|
|
|
|
}
|
|
|
|
|
|
|
|
public function submit(Request $request)
|
|
|
|
{
|
|
|
|
// Initialisation de l'enregistrement
|
|
|
|
$em = $this->getDoctrine()->getManager();
|
|
|
|
$data = new Entity();
|
|
|
|
|
|
|
|
// Récupérer les repos de gitea
|
|
|
|
$gitearepos=$this->giteaservice->getRepos();
|
|
|
|
|
|
|
|
// Création du formulaire
|
|
|
|
$form = $this->createForm(Form::class,$data,array("mode"=>"submit","gitearepos"=>$gitearepos));
|
|
|
|
|
|
|
|
// Récupération des data du formulaire
|
|
|
|
$form->handleRequest($request);
|
|
|
|
|
|
|
|
// Sur erreur
|
|
|
|
$this->getErrorForm(null,$form,$request,$data,"submit");
|
|
|
|
|
|
|
|
// Sur validation
|
|
|
|
if ($form->get('submit')->isClicked() && $form->isValid()) {
|
|
|
|
$data = $form->getData();
|
|
|
|
$gitearepo=$this->giteaservice->getRepo($data->getGiteaid());
|
|
|
|
$data->setGiteaname($gitearepo->full_name);
|
|
|
|
$data->setGiteajson(json_decode(json_encode($gitearepo), true));
|
|
|
|
|
|
|
|
$em->persist($data);
|
|
|
|
$em->flush();
|
|
|
|
|
|
|
|
// Retour à la liste
|
|
|
|
return $this->redirectToRoute($this->route);
|
|
|
|
}
|
|
|
|
|
|
|
|
// Affichage du formulaire
|
|
|
|
return $this->render($this->render.'edit.html.twig', [
|
|
|
|
'useheader' => true,
|
|
|
|
'usesidebar' => false,
|
|
|
|
'maxwidth' => true,
|
|
|
|
$this->data => $data,
|
|
|
|
'mode' => 'submit',
|
|
|
|
'form' => $form->createView()
|
|
|
|
]);
|
|
|
|
}
|
|
|
|
|
|
|
|
public function update($id,Request $request)
|
|
|
|
{
|
|
|
|
// Initialisation de l'enregistrement
|
|
|
|
$em = $this->getDoctrine()->getManager();
|
|
|
|
$data=$em->getRepository($this->entity)->find($id);
|
|
|
|
|
|
|
|
// Récupérer les repos de gitea
|
|
|
|
$gitearepos=$this->giteaservice->getRepos();
|
|
|
|
|
|
|
|
// Création du formulaire
|
|
|
|
$form = $this->createForm(Form::class,$data,array("mode"=>"update","gitearepos"=>$gitearepos));
|
|
|
|
|
|
|
|
// Récupération des data du formulaire
|
|
|
|
$form->handleRequest($request);
|
|
|
|
|
|
|
|
// Sur erreur
|
|
|
|
$this->getErrorForm(null,$form,$request,$data,"update");
|
|
|
|
|
|
|
|
// Sur validation
|
|
|
|
if ($form->get('submit')->isClicked() && $form->isValid()) {
|
|
|
|
$data = $form->getData();
|
|
|
|
$gitearepo=$this->giteaservice->getRepo($data->getGiteaid());
|
|
|
|
$data->setGiteaname($gitearepo->full_name);
|
|
|
|
$data->setGiteajson(json_decode(json_encode($gitearepo), true));
|
|
|
|
|
|
|
|
$em->persist($data);
|
|
|
|
$em->flush();
|
|
|
|
|
|
|
|
// Retour à la liste
|
|
|
|
return $this->redirectToRoute($this->route);
|
|
|
|
}
|
|
|
|
|
|
|
|
// Affichage du formulaire
|
|
|
|
return $this->render($this->render.'edit.html.twig', [
|
|
|
|
'useheader' => true,
|
|
|
|
'usesidebar' => false,
|
|
|
|
'maxwidth' => true,
|
|
|
|
$this->data => $data,
|
|
|
|
'mode' => 'update',
|
|
|
|
'form' => $form->createView()
|
|
|
|
]);
|
|
|
|
}
|
|
|
|
|
|
|
|
public function delete($id,Request $request)
|
|
|
|
{
|
|
|
|
// Initialisation de l'enregistrement
|
|
|
|
$em = $this->getDoctrine()->getManager();
|
|
|
|
$data=$em->getRepository($this->entity)->find($id);
|
|
|
|
|
|
|
|
// Controle avant suppression
|
|
|
|
$error=false;
|
|
|
|
if($id<0) $error=true;
|
|
|
|
|
|
|
|
if($error)
|
|
|
|
return $this->redirectToRoute($this->route."_update",["id"=>$id]);
|
|
|
|
else {
|
|
|
|
$em->remove($data);
|
|
|
|
$em->flush();
|
|
|
|
|
|
|
|
// Retour à la liste
|
|
|
|
return $this->redirectToRoute($this->route);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
public function view($id,Request $request)
|
|
|
|
{
|
|
|
|
// Initialisation de l'enregistrement
|
|
|
|
$em = $this->getDoctrine()->getManager();
|
|
|
|
$data=$em->getRepository($this->entity)->find($id);
|
|
|
|
if(!$data) return $this->redirectToRoute($this->route);
|
2024-02-22 14:52:15 +01:00
|
|
|
$firstcolumn=$em->getRepository('App:Scrumcolumn')->findOneBy(["scrum"=>$data], ['rowid' => 'ASC']);
|
|
|
|
if(!$firstcolumn) return $this->redirectToRoute($this->route);
|
2022-01-13 21:13:38 +01:00
|
|
|
|
2023-11-07 17:03:54 +01:00
|
|
|
$forcereload=false;
|
|
|
|
if($request->get("forcereload")) $forcereload=$request->get("forcereload");
|
2024-02-15 18:59:09 +01:00
|
|
|
|
|
|
|
// Mise à jour des issues par rapport à gitea
|
2023-11-07 17:03:54 +01:00
|
|
|
$em->getRepository("App:Scrum")->getGitea($data,$giteaassignees,$giteacolumns,$giteamilestones,$giteateams,$giteaprioritys,$giteatypes,$gitealabels,$forcereload);
|
2024-04-12 20:27:25 +02:00
|
|
|
|
|
|
|
// default color priority
|
|
|
|
$prioritycolor="#70c24a";
|
|
|
|
if(is_array($giteaprioritys)) {
|
|
|
|
|
|
|
|
$priority=$em->getRepository("App:Scrumpriority")->findOneBy(["scrum"=>$data,"giteaid"=>$giteaprioritys[array_key_last($giteaprioritys)]]);
|
|
|
|
if($priority) {
|
|
|
|
$prioritycolor="#".$priority->getGiteajson()["color"];
|
|
|
|
}
|
|
|
|
}
|
2024-02-15 18:59:09 +01:00
|
|
|
|
|
|
|
// Création du tableau des issues
|
|
|
|
$issues=$data->getScrumissues();
|
|
|
|
$tbissues=[];
|
|
|
|
$tbcols=[];
|
|
|
|
$tbjals=[];
|
|
|
|
$tbsprs=[];
|
|
|
|
$tbestim=[];
|
|
|
|
|
|
|
|
$viewclosed = $this->get('session')->get("viewclosed");
|
|
|
|
foreach($issues as $issue) {
|
|
|
|
// bypass closed
|
2024-04-12 16:30:36 +02:00
|
|
|
if($viewclosed=="false"&&($issue->getGiteastate()=="closed"||($issue->getScrumsprint()&&$issue->getScrumsprint()->getClosed()))) continue;
|
2024-02-15 18:59:09 +01:00
|
|
|
|
|
|
|
// Ids
|
2024-02-22 14:52:15 +01:00
|
|
|
$idcol=($issue->getScrumcolumn()?$issue->getScrumcolumn()->getId():$firstcolumn->getId());
|
2024-02-15 18:59:09 +01:00
|
|
|
$idjal=($issue->getGiteamilestone()?$issue->getGiteamilestone():-100);
|
|
|
|
$idspr=($issue->getScrumsprint()?$issue->getScrumsprint()->getId():-100);
|
|
|
|
|
|
|
|
// Roworders
|
2024-02-22 17:03:25 +01:00
|
|
|
$rowcol=($issue->getScrumcolumn()?$issue->getScrumcolumn()->getRowid():$firstcolumn->getRowid());
|
2024-02-15 18:59:09 +01:00
|
|
|
$rowjal=($issue->getGiteaMilestonename()?$issue->getGiteaMilestonename():-100);
|
|
|
|
$rowspr=($issue->getScrumsprint()?$issue->getScrumsprint()->getRowid():-100);
|
|
|
|
|
|
|
|
// Names
|
2024-02-22 17:03:25 +01:00
|
|
|
$nmcol=($issue->getScrumcolumn()?$issue->getScrumcolumn()->getName():$firstcolumn->getName());
|
2024-02-15 18:59:09 +01:00
|
|
|
$nmjal=($issue->getGiteaMilestonename()?$issue->getGiteaMilestonename():"Aucun");
|
|
|
|
$nmspr=($issue->getScrumsprint()?$issue->getScrumsprint()->getName():"Aucun");
|
|
|
|
|
|
|
|
// Idgiteas
|
2024-02-22 17:03:25 +01:00
|
|
|
$gicol=($issue->getScrumcolumn()?$issue->getScrumcolumn()->getGiteaid():$firstcolumn->getGiteaid());
|
2024-02-21 20:58:38 +01:00
|
|
|
$gijal=($issue->getGiteaMilestone()?$issue->getGiteaMilestone():-100);
|
2024-02-15 18:59:09 +01:00
|
|
|
|
|
|
|
// Liste des colonnes/jalons/sprint avec des issues
|
|
|
|
if(!in_array($idcol,$tbcols)) array_push($tbcols,$idcol);
|
|
|
|
if(!in_array($idcol."|".$idjal,$tbjals)) array_push($tbjals,$idcol."|".$idjal);
|
|
|
|
if(!in_array($idcol."|".$idjal."|".$idspr,$tbsprs)) array_push($tbsprs,$idcol."|".$idjal."|".$idspr);
|
|
|
|
|
|
|
|
// Initialisation du tableau des estimations
|
|
|
|
if(!array_key_exists($idjal,$tbestim)) {
|
|
|
|
$tbestim[$idjal] = [
|
|
|
|
"rowjal" => $rowjal,
|
|
|
|
"idjal" => $idjal,
|
|
|
|
"nmjal" => $nmjal,
|
|
|
|
"gijal" => $gijal,
|
|
|
|
"nbjrs" => 0,
|
|
|
|
"sprints" => []
|
|
|
|
];
|
|
|
|
}
|
|
|
|
|
|
|
|
if(!array_key_exists($idspr,$tbestim[$idjal]["sprints"])) {
|
|
|
|
$tbestim[$idjal]["sprints"][$idspr] = [
|
|
|
|
"rowspr" => $rowspr,
|
|
|
|
"idspr" => $idspr,
|
|
|
|
"nmspr" => $nmspr,
|
|
|
|
"nbjrs" => 0,
|
|
|
|
];
|
|
|
|
}
|
|
|
|
|
|
|
|
// Initialisation du tableau des colonnes
|
|
|
|
if(!array_key_exists($idcol,$tbissues)) {
|
|
|
|
$tbissues[$idcol]=[
|
|
|
|
"rowcol" => $rowcol,
|
|
|
|
"idcol" => $idcol,
|
|
|
|
"nmcol" => $nmcol,
|
|
|
|
"gicol" => $gicol,
|
|
|
|
"nbjrs" => 0,
|
|
|
|
"jalons" => [],
|
|
|
|
];
|
|
|
|
}
|
|
|
|
|
|
|
|
// Initialisation du tableau des jalons de la colonne encours
|
|
|
|
if(!array_key_exists($idjal,$tbissues[$idcol]["jalons"])) {
|
|
|
|
$tbissues[$idcol]["jalons"][$idjal] = [
|
|
|
|
"rowjal" => $rowjal,
|
|
|
|
"idjal" => $idjal,
|
|
|
|
"nmjal" => $nmjal,
|
|
|
|
"gijal" => $gijal,
|
|
|
|
"nbjrs" => 0,
|
|
|
|
"sprints" => [],
|
|
|
|
];
|
|
|
|
}
|
|
|
|
|
|
|
|
// Initialisation du tableau des sprint de la colonne/jalon encours
|
|
|
|
if(!array_key_exists($idspr,$tbissues[$idcol]["jalons"][$idjal]["sprints"])) {
|
|
|
|
$tbissues[$idcol]["jalons"][$idjal]["sprints"][$idspr] = [
|
|
|
|
"rowspr" => $rowspr,
|
|
|
|
"idspr" => $idspr,
|
|
|
|
"nmspr" => $nmspr,
|
|
|
|
"nbjrs" => 0,
|
|
|
|
"issues" => [],
|
|
|
|
];
|
|
|
|
}
|
|
|
|
|
|
|
|
// On cumule les estimations
|
|
|
|
$tbissues[$idcol]["nbjrs"]+=$issue->getWeight();
|
|
|
|
$tbissues[$idcol]["jalons"][$idjal]["nbjrs"]+=$issue->getWeight();
|
|
|
|
$tbissues[$idcol]["jalons"][$idjal]["sprints"][$idspr]["nbjrs"]+=$issue->getWeight();
|
|
|
|
$tbestim[$idjal]["nbjrs"]+=$issue->getWeight();
|
|
|
|
$tbestim[$idjal]["sprints"][$idspr]["nbjrs"]+=$issue->getWeight();
|
|
|
|
|
|
|
|
// On sauvegarde l'issue
|
|
|
|
array_push($tbissues[$idcol]["jalons"][$idjal]["sprints"][$idspr]["issues"],$issue);
|
|
|
|
}
|
|
|
|
|
|
|
|
// On ajoute les colonnes sans issues
|
|
|
|
$columns=$data->getScrumcolumns();
|
|
|
|
foreach($columns as $column) {
|
|
|
|
if(!in_array($column->getId(),$tbcols)) {
|
|
|
|
$tbissues[$column->getId()] = [
|
|
|
|
"rowcol" => $column->getRowid(),
|
|
|
|
"idcol" => $column->getId(),
|
|
|
|
"nmcol" => $column->getName(),
|
|
|
|
"gicol" => $column->getGiteaid(),
|
|
|
|
"nbjrs" => 0,
|
|
|
|
"jalons" => [],
|
|
|
|
];
|
|
|
|
}
|
|
|
|
|
|
|
|
// On ajoute les jalons sans issues
|
|
|
|
foreach($giteamilestones as $milestone) {
|
|
|
|
if(!in_array($column->getId()."|".$milestone->id,$tbjals)) {
|
|
|
|
$tbissues[$column->getId()]["jalons"][$milestone->id] = [
|
|
|
|
"rowjal" => $milestone->title,
|
|
|
|
"idjal" => $milestone->id,
|
|
|
|
"nmjal" => $milestone->title,
|
|
|
|
"gijal" => $milestone->id,
|
|
|
|
"nbjrs" => 0,
|
|
|
|
"sprints" => [],
|
|
|
|
];
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// On ajoute le jalon aucun si sans issue
|
|
|
|
if(!in_array($column->getId()."|-100",$tbjals)) {
|
|
|
|
$tbissues[$column->getId()]["jalons"][-100] = [
|
|
|
|
"rowjal" => -100,
|
|
|
|
"idjal" => -100,
|
|
|
|
"nmjal" => "Aucun",
|
|
|
|
"gijal" => null,
|
|
|
|
"nbjrs" => 0,
|
|
|
|
"sprints" => [],
|
|
|
|
];
|
|
|
|
}
|
|
|
|
|
|
|
|
// On ajoutes les sprints sans issues
|
|
|
|
foreach($tbissues[$column->getId()]["jalons"] as $jalon) {
|
2024-04-12 16:30:36 +02:00
|
|
|
|
2024-02-15 18:59:09 +01:00
|
|
|
$sprints=$em->getRepository("App:Scrumsprint")->findBy(["scrum"=>$data,"giteamilestone"=>$jalon["idjal"]]);
|
|
|
|
foreach($sprints as $sprint) {
|
2024-04-12 16:30:36 +02:00
|
|
|
if($viewclosed=="false"&&$sprint->getClosed()) continue;
|
|
|
|
|
2024-02-15 18:59:09 +01:00
|
|
|
if(!in_array($column->getId()."|".$jalon["idjal"]."|".$sprint->getId(),$tbsprs)) {
|
|
|
|
$tbissues[$column->getId()]["jalons"][$jalon["idjal"]]["sprints"][$sprint->getId()] = [
|
|
|
|
"rowspr" => $sprint->getRowid(),
|
|
|
|
"idspr" => $sprint->getId(),
|
|
|
|
"nmspr" => $sprint->getName(),
|
|
|
|
"nbjrs" => 0,
|
|
|
|
"issues" => [],
|
|
|
|
];
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// On ajoute les sprint aucun sans issue
|
|
|
|
if(!in_array($column->getId()."|".$jalon["idjal"]."|-100",$tbsprs)) {
|
|
|
|
$tbissues[$column->getId()]["jalons"][$jalon["idjal"]]["sprints"][-100] = [
|
|
|
|
"rowspr" => -100,
|
|
|
|
"idspr" => -100,
|
|
|
|
"nmspr" => "Aucun",
|
|
|
|
"nbjrs" => 0,
|
|
|
|
"issues" => [],
|
|
|
|
];
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// Tri des issues par colonne/jalon/sprint/issue
|
|
|
|
$rowcol = array_column($tbissues, 'rowcol');
|
|
|
|
array_multisort($rowcol, SORT_ASC, $tbissues);
|
|
|
|
foreach($tbissues as $keycol=>$column) {
|
|
|
|
$rowjal = array_column($tbissues[$keycol]["jalons"], 'rowjal');
|
|
|
|
array_multisort($rowjal, SORT_DESC, $tbissues[$keycol]["jalons"]);
|
|
|
|
foreach($tbissues[$keycol]["jalons"] as $keyjal=>$jalon) {
|
|
|
|
$rowspr = array_column($tbissues[$keycol]["jalons"][$keyjal]["sprints"], 'rowspr');
|
|
|
|
array_multisort($rowspr, SORT_DESC, $tbissues[$keycol]["jalons"][$keyjal]["sprints"]);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2024-02-21 22:18:01 +01:00
|
|
|
$rowjal = array_column($tbestim, 'rowjal');
|
|
|
|
array_multisort($rowjal, SORT_DESC, $tbestim);
|
|
|
|
foreach($tbestim as $keyjal=>$jalon) {
|
|
|
|
$rowspr = array_column($tbestim[$keyjal]["sprints"], 'rowspr');
|
|
|
|
array_multisort($rowspr, SORT_DESC, $tbestim[$keyjal]["sprints"]);
|
|
|
|
}
|
|
|
|
|
2022-01-11 13:39:51 +01:00
|
|
|
// Préférences utilisateur
|
2024-02-16 16:40:41 +01:00
|
|
|
$viewcondensed = $em->getRepository("App:User")->getUserpreference($this->getUser(),"viewcondensed",$id);
|
2022-01-11 13:39:51 +01:00
|
|
|
$filtermilestones = $em->getRepository("App:User")->getUserpreference($this->getUser(),"filtermilestones",$id);
|
2024-02-15 18:59:09 +01:00
|
|
|
$filtersprints = $em->getRepository("App:User")->getUserpreference($this->getUser(),"filtersprints",$id);
|
2022-01-28 16:54:46 +01:00
|
|
|
$filterteams = $em->getRepository("App:User")->getUserpreference($this->getUser(),"filterteams",$id);
|
2022-02-03 17:26:35 +01:00
|
|
|
$filterprioritys = $em->getRepository("App:User")->getUserpreference($this->getUser(),"filterprioritys",$id);
|
2023-08-30 11:15:33 +02:00
|
|
|
$filtertypes = $em->getRepository("App:User")->getUserpreference($this->getUser(),"filtertypes",$id);
|
2022-01-11 13:39:51 +01:00
|
|
|
$filterlabels = $em->getRepository("App:User")->getUserpreference($this->getUser(),"filterlabels",$id);
|
|
|
|
$filterassignees = $em->getRepository("App:User")->getUserpreference($this->getUser(),"filterassignees",$id);
|
2022-06-29 11:50:27 +02:00
|
|
|
$filterexcludes = $em->getRepository("App:User")->getUserpreference($this->getUser(),"filterexcludes",$id);
|
2022-01-28 16:54:46 +01:00
|
|
|
$showfilters = $em->getRepository("App:User")->getUserpreference($this->getUser(),"showfilters",$id);
|
|
|
|
|
2021-07-20 13:04:47 +02:00
|
|
|
return $this->render($this->render.'view.html.twig', [
|
|
|
|
'useheader' => true,
|
2022-01-13 21:13:38 +01:00
|
|
|
'usesidebar' => false,
|
|
|
|
'usetitle' => $data->getName(),
|
2022-01-11 13:39:51 +01:00
|
|
|
'giteaassignees' => $giteaassignees,
|
|
|
|
'giteacolumns' => $giteacolumns,
|
2021-07-20 13:04:47 +02:00
|
|
|
'giteamilestones' => $giteamilestones,
|
2024-04-12 16:30:36 +02:00
|
|
|
'sprints' => $data->getScrumsprintstosee($viewclosed),
|
2022-01-28 16:54:46 +01:00
|
|
|
'giteateams' => $giteateams,
|
2022-02-03 17:26:35 +01:00
|
|
|
'giteaprioritys' => $giteaprioritys,
|
2024-04-12 20:27:25 +02:00
|
|
|
'prioritycolor' => $prioritycolor,
|
2023-08-30 11:15:33 +02:00
|
|
|
'giteatypes' => $giteatypes,
|
2022-01-11 13:39:51 +01:00
|
|
|
'gitealabels' => $gitealabels,
|
2024-02-16 16:40:41 +01:00
|
|
|
'viewcondensed' => $viewcondensed,
|
2022-01-11 13:39:51 +01:00
|
|
|
'filtermilestones' => $filtermilestones,
|
2024-02-15 18:59:09 +01:00
|
|
|
'filtersprints' => $filtersprints,
|
2022-01-28 16:54:46 +01:00
|
|
|
'filterteams' => $filterteams,
|
2022-02-03 17:26:35 +01:00
|
|
|
'filterprioritys' => $filterprioritys,
|
2023-08-30 11:15:33 +02:00
|
|
|
'filtertypes' => $filtertypes,
|
2022-01-11 13:39:51 +01:00
|
|
|
'filterlabels' => $filterlabels,
|
|
|
|
'filterassignees' => $filterassignees,
|
2022-06-29 11:50:27 +02:00
|
|
|
'filterexcludes' => $filterexcludes,
|
2022-02-03 17:26:35 +01:00
|
|
|
'showfilters' => $showfilters,
|
2024-02-15 18:59:09 +01:00
|
|
|
'tbissues' => $tbissues,
|
|
|
|
'tbestim' => $tbestim,
|
2022-01-28 16:54:46 +01:00
|
|
|
$this->data => $data,
|
|
|
|
]);
|
|
|
|
}
|
|
|
|
|
2024-02-15 18:59:09 +01:00
|
|
|
|
|
|
|
public function table($id, Request $request)
|
2022-01-28 16:54:46 +01:00
|
|
|
{
|
|
|
|
$em = $this->getDoctrine()->getManager();
|
2024-02-15 18:59:09 +01:00
|
|
|
$fgcsv = $request->get("fgcsv");
|
2024-03-15 15:44:29 +01:00
|
|
|
$fgpoker = $request->get("fgpoker");
|
2023-12-18 12:11:31 +01:00
|
|
|
|
2024-02-15 18:59:09 +01:00
|
|
|
// Récupérer les repos de gitea
|
|
|
|
$scrum=$em->getRepository("App:Scrum")->findOneBy(["id"=>$id]);
|
|
|
|
|
|
|
|
$gitearepos=[];
|
|
|
|
$giteamilestones=[];
|
|
|
|
$giteacolumns=[];
|
|
|
|
$giteateams=[];
|
|
|
|
$giteaprioritys=[];
|
|
|
|
$giteatypes=[];
|
|
|
|
$gitealabels=[];
|
|
|
|
$giteaassignees=$em->getRepository("App:User")->findBy([],["username"=>"ASC"]);
|
|
|
|
$viewclosed = $request->getSession()->get("viewclosed");
|
|
|
|
|
|
|
|
|
|
|
|
$gitearepo=$this->giteaservice->getRepo($scrum->getGiteajson()["id"]);
|
|
|
|
if($gitearepo->updated_at!=$scrum->getGiteajson()["updated_at"]||$gitearepo->open_issues_count!=$scrum->getGiteajson()["open_issues_count"]) {
|
|
|
|
$scrum->setGiteajson(json_decode(json_encode($gitearepo), true));
|
|
|
|
$em->persist($scrum);
|
|
|
|
$em->flush();
|
|
|
|
}
|
|
|
|
|
|
|
|
$giteamilestones=$this->giteaservice->getMilestones($scrum->getGiteajson()["owner"]["login"],$scrum->getGiteajson()["name"],"?state=".($viewclosed=="true"?"all":"open"));
|
|
|
|
|
|
|
|
$giteaissues=$this->giteaservice->getIssues($scrum->getGiteajson()["owner"]["login"],$scrum->getGiteajson()["name"],"?state=".($viewclosed=="true"?"all":"open"));
|
|
|
|
$json=$scrum->getGiteajson();
|
|
|
|
$json["issues"]=$giteaissues;
|
|
|
|
foreach($json["issues"] as $key => $giteaissue) {
|
|
|
|
$issue=$em->getRepository("App:Scrumissue")->findOneBy(["giteaid"=>$giteaissue->id]);
|
|
|
|
if($issue) {
|
|
|
|
$json["issues"][$key]->weight=$issue->getWeight();
|
|
|
|
$json["issues"][$key]->issueid=$issue->getId();
|
|
|
|
$json["issues"][$key]->scrumid=$issue->getScrum()->getId();
|
|
|
|
$json["issues"][$key]->sprintid=($issue->getScrumsprint()?$issue->getScrumsprint()->getId():-100);
|
|
|
|
$json["issues"][$key]->sprintname=($issue->getScrumsprint()?$issue->getScrumsprint()->getName():"Aucun");
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
$json["issues"][$key]->weight=0;
|
|
|
|
$json["issues"][$key]->issueid=0;
|
|
|
|
$json["issues"][$key]->scrumid=0;
|
|
|
|
$json["issues"][$key]->sprintid=-100;
|
|
|
|
$json["issues"][$key]->sprintname="Aucun";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
$tmp=[];
|
|
|
|
foreach($scrum->getScrumcolumns() as $column) {
|
|
|
|
array_push($tmp,$column->getGiteaid());
|
|
|
|
if(!in_array($column->getGiteajson()["name"],$giteacolumns))
|
|
|
|
array_push($giteacolumns,$column->getGiteajson()["name"]);
|
|
|
|
}
|
|
|
|
$json["columns"]=$tmp;
|
|
|
|
array_push($gitearepos,$json);
|
|
|
|
|
|
|
|
foreach($scrum->getScrumteams() as $team) {
|
|
|
|
if(!in_array($team->getGiteajson()["name"],$giteateams))
|
|
|
|
array_push($giteateams,$team->getGiteajson()["name"]);
|
|
|
|
}
|
|
|
|
|
|
|
|
foreach($scrum->getScrumprioritys() as $priority) {
|
|
|
|
if(!in_array($priority->getGiteajson()["name"],$giteaprioritys))
|
|
|
|
array_push($giteaprioritys,$priority->getGiteajson()["name"]);
|
|
|
|
}
|
|
|
|
|
|
|
|
foreach($scrum->getScrumtypes() as $type) {
|
|
|
|
if(!in_array($type->getGiteajson()["name"],$giteatypes))
|
|
|
|
array_push($giteatypes,$type->getGiteajson()["name"]);
|
|
|
|
}
|
|
|
|
|
|
|
|
foreach($giteaissues as $giteaissue) {
|
|
|
|
foreach($giteaissue->labels as $label) {
|
|
|
|
if(!in_array($label->name,$gitealabels))
|
|
|
|
array_push($gitealabels,$label->name);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
$keysort = array_column($giteamilestones, 'title');
|
|
|
|
array_multisort($keysort, SORT_DESC, $giteamilestones);
|
|
|
|
sort($giteacolumns);
|
|
|
|
sort($giteateams);
|
|
|
|
sort($giteaprioritys);
|
|
|
|
sort($giteatypes);
|
|
|
|
sort($gitealabels);
|
2022-02-03 17:26:35 +01:00
|
|
|
|
|
|
|
// Préférences utilisateur
|
2024-02-15 18:59:09 +01:00
|
|
|
$filtercategorys = $em->getRepository("App:User")->getUserpreference($this->getUser(),"filtercategorys",$id);
|
|
|
|
$filterrepos = $em->getRepository("App:User")->getUserpreference($this->getUser(),"filterrepos",$id);
|
2022-02-03 17:26:35 +01:00
|
|
|
$filtermilestones = $em->getRepository("App:User")->getUserpreference($this->getUser(),"filtermilestones",$id);
|
2024-02-15 18:59:09 +01:00
|
|
|
$filtersprints = $em->getRepository("App:User")->getUserpreference($this->getUser(),"filtersprints",$id);
|
|
|
|
$filtercolumns = $em->getRepository("App:User")->getUserpreference($this->getUser(),"filtercolumns",$id);
|
2022-02-03 17:26:35 +01:00
|
|
|
$filterteams = $em->getRepository("App:User")->getUserpreference($this->getUser(),"filterteams",$id);
|
2024-02-15 18:59:09 +01:00
|
|
|
$filterprioritys = $em->getRepository("App:User")->getUserpreference($this->getUser(),"filterprioritys",$id);
|
|
|
|
$filtertypes = $em->getRepository("App:User")->getUserpreference($this->getUser(),"filtertypes",$id);
|
|
|
|
$filterlabels = $em->getRepository("App:User")->getUserpreference($this->getUser(),"filterlabels",$id);
|
|
|
|
$filterassignees = $em->getRepository("App:User")->getUserpreference($this->getUser(),"filterassignees",$id);
|
|
|
|
$filterexcludes = $em->getRepository("App:User")->getUserpreference($this->getUser(),"filterexcludes",$id);
|
2022-02-03 17:26:35 +01:00
|
|
|
$showfilters = $em->getRepository("App:User")->getUserpreference($this->getUser(),"showfilters",$id);
|
2022-01-28 16:54:46 +01:00
|
|
|
|
2024-02-15 18:59:09 +01:00
|
|
|
if($fgcsv) {
|
2024-02-20 11:12:38 +01:00
|
|
|
$dir = $this->getParameter('kernel.project_dir') . '/public/uploads/issues/';
|
2024-02-15 18:59:09 +01:00
|
|
|
$file = "issues-".$id.".csv";
|
|
|
|
$fs = new Filesystem();
|
|
|
|
$fs->mkdir($dir);
|
|
|
|
$csvh = fopen($dir.$file, 'w');
|
|
|
|
$d = ';'; // this is the default but i like to be explicit
|
|
|
|
$e = '"'; // this is the default but i like to be explicit
|
|
|
|
|
2024-04-11 15:14:49 +02:00
|
|
|
$tmp=["Projet","Jalon","Sprint","Type","Id","Titre","Statut","Label","Poid"];
|
2024-02-15 18:59:09 +01:00
|
|
|
fputcsv($csvh, $tmp, $d, $e);
|
|
|
|
|
|
|
|
foreach($gitearepos as $gitearepo) {
|
|
|
|
foreach($gitearepo["issues"] as $giteaissue) {
|
|
|
|
$statut="";
|
2024-02-20 11:12:38 +01:00
|
|
|
$issue=$em->getRepository("App:Scrumissue")->findOneBy(["giteaid"=>$giteaissue->id]);
|
|
|
|
|
2024-02-15 18:59:09 +01:00
|
|
|
$type="";
|
|
|
|
$labels="";
|
|
|
|
foreach($giteaissue->labels as $label) {
|
|
|
|
if(in_array($label->id,$gitearepo["columns"]))
|
|
|
|
$statut=$label->name;
|
|
|
|
elseif(in_array($label->name,$giteatypes))
|
|
|
|
$type=$label->name;
|
|
|
|
else
|
|
|
|
$labels=$labels.($labels!=""?"\n":"").$label->name;
|
2022-01-28 16:54:46 +01:00
|
|
|
}
|
2024-02-15 18:59:09 +01:00
|
|
|
$tmp=[
|
|
|
|
$gitearepo["name"],
|
|
|
|
(isset($giteaissue->milestone->title)?$giteaissue->milestone->title:""),
|
2024-02-20 11:12:38 +01:00
|
|
|
($issue->getScrumsprint()?$issue->getScrumsprint()->getName():"Aucun"),
|
2024-02-15 18:59:09 +01:00
|
|
|
$type,
|
|
|
|
$giteaissue->number,
|
|
|
|
$giteaissue->title,
|
|
|
|
$statut,
|
2024-04-11 15:14:49 +02:00
|
|
|
$labels,
|
|
|
|
$issue->getWeight()
|
2024-02-15 18:59:09 +01:00
|
|
|
];
|
|
|
|
fputcsv($csvh, $tmp, $d, $e);
|
2022-01-28 16:54:46 +01:00
|
|
|
}
|
|
|
|
}
|
2024-02-15 18:59:09 +01:00
|
|
|
fclose($csvh);
|
2022-01-28 16:54:46 +01:00
|
|
|
|
2024-02-15 18:59:09 +01:00
|
|
|
$response = new BinaryFileResponse($dir.$file);
|
|
|
|
$response->setContentDisposition(ResponseHeaderBag::DISPOSITION_ATTACHMENT);
|
|
|
|
return $response;
|
|
|
|
}
|
|
|
|
|
|
|
|
return $this->render($this->render.'table.html.twig',[
|
|
|
|
"useheader" => true,
|
|
|
|
"usesidebar" => false,
|
|
|
|
"id" => $id,
|
|
|
|
"gitearepos" => $gitearepos,
|
|
|
|
"giteamilestones" => $giteamilestones,
|
|
|
|
"sprints" => $scrum->getScrumsprints(),
|
|
|
|
"giteacolumns" => $giteacolumns,
|
|
|
|
"giteateams" => $giteateams,
|
|
|
|
"giteaprioritys" => $giteaprioritys,
|
|
|
|
"giteatypes" => $giteatypes,
|
|
|
|
"gitealabels" => $gitealabels,
|
|
|
|
"giteaassignees" => $giteaassignees,
|
|
|
|
"filtercategorys" => $filtercategorys,
|
|
|
|
"filterrepos" => $filterrepos,
|
|
|
|
"filtermilestones" => $filtermilestones,
|
|
|
|
"filtersprints" => $filtersprints,
|
|
|
|
"filtercolumns" => $filtercolumns,
|
|
|
|
"filterteams" => $filterteams,
|
|
|
|
"filterprioritys" => $filterprioritys,
|
|
|
|
"filtertypes" => $filtertypes,
|
|
|
|
"filterlabels" => $filterlabels,
|
|
|
|
"filterexcludes" => $filterexcludes,
|
|
|
|
"filterassignees" => $filterassignees,
|
|
|
|
"showfilters" => $showfilters,
|
2024-03-15 15:44:29 +01:00
|
|
|
"fgpoker" => $fgpoker,
|
2024-02-15 18:59:09 +01:00
|
|
|
]);
|
|
|
|
}
|
2022-02-03 17:26:35 +01:00
|
|
|
|
2024-02-15 18:59:09 +01:00
|
|
|
public function stat($id,Request $request)
|
|
|
|
{
|
|
|
|
$em = $this->getDoctrine()->getManager();
|
2024-02-23 12:35:29 +01:00
|
|
|
$scrum=$em->getRepository($this->entity)->find($id);
|
|
|
|
if(!$scrum) return $this->redirectToRoute($this->route);
|
|
|
|
$em->getRepository("App:Scrum")->getGitea($scrum,$giteaassignees,$giteacolumns,$giteamilestones,$giteateams,$giteaprioritys,$giteatypes,$gitealabels);
|
2022-01-28 16:54:46 +01:00
|
|
|
|
2024-02-15 18:59:09 +01:00
|
|
|
// Préférences utilisateur
|
|
|
|
$filtermilestones = $em->getRepository("App:User")->getUserpreference($this->getUser(),"filtermilestones",$id);
|
|
|
|
$filtersprints = $em->getRepository("App:User")->getUserpreference($this->getUser(),"filtersprints",$id);
|
2024-02-22 17:03:25 +01:00
|
|
|
$filterbynumber = $em->getRepository("App:User")->getUserpreference($this->getUser(),"filterbynumber",$id);
|
2024-02-15 18:59:09 +01:00
|
|
|
$showfilters = $em->getRepository("App:User")->getUserpreference($this->getUser(),"showfilters",$id);
|
2024-02-23 12:35:29 +01:00
|
|
|
|
|
|
|
$tbestim=$this->getEstim($scrum);
|
|
|
|
|
|
|
|
return $this->render($this->render.'stat.html.twig', [
|
|
|
|
'useheader' => true,
|
|
|
|
'usesidebar' => false,
|
|
|
|
'usetitle' => $scrum->getName(),
|
|
|
|
'giteamilestones' => $giteamilestones,
|
|
|
|
'sprints' => $scrum->getScrumsprints(),
|
|
|
|
'filtermilestones' => $filtermilestones,
|
|
|
|
'filtersprints' => $filtersprints,
|
|
|
|
'filterbynumber' => $filterbynumber,
|
|
|
|
'showfilters' => $showfilters,
|
|
|
|
$this->data => $scrum,
|
|
|
|
'tbestim' => $tbestim,
|
|
|
|
]);
|
|
|
|
}
|
|
|
|
|
2024-04-15 13:25:09 +02:00
|
|
|
public function link($id,Request $request)
|
|
|
|
{
|
|
|
|
// Initialisation de l'enregistrement
|
|
|
|
$em = $this->getDoctrine()->getManager();
|
|
|
|
$data=$em->getRepository($this->entity)->find($id);
|
|
|
|
if(!$data) return $this->redirectToRoute($this->route);
|
|
|
|
|
|
|
|
return $this->render($this->render.'link.html.twig',[
|
|
|
|
"useheader" => true,
|
|
|
|
"usesidebar" => false,
|
|
|
|
"maxwidth" => 1000,
|
|
|
|
"scrum" => $data,
|
|
|
|
]);
|
|
|
|
}
|
|
|
|
|
2024-02-23 12:35:29 +01:00
|
|
|
public function info($id,Request $request)
|
|
|
|
{
|
|
|
|
$em = $this->getDoctrine()->getManager();
|
|
|
|
$scrum=$em->getRepository($this->entity)->find($id);
|
|
|
|
if(!$scrum) return $this->redirectToRoute($this->route);
|
|
|
|
$em->getRepository("App:Scrum")->getGitea($scrum,$giteaassignees,$giteacolumns,$giteamilestones,$giteateams,$giteaprioritys,$giteatypes,$gitealabels);
|
|
|
|
|
|
|
|
$tbestim=$this->getEstim($scrum);
|
|
|
|
|
|
|
|
$output=[];
|
|
|
|
$output["tbestim"]=$tbestim;
|
|
|
|
return new JsonResponse($output);
|
|
|
|
}
|
|
|
|
|
|
|
|
private function getEstim($scrum) {
|
|
|
|
// Initialisation de l'enregistrement
|
|
|
|
$em = $this->getDoctrine()->getManager();
|
|
|
|
$firstcolumn=$em->getRepository('App:Scrumcolumn')->findOneBy(["scrum"=>$scrum], ['rowid' => 'ASC']);
|
|
|
|
if(!$firstcolumn) return $this->redirectToRoute($this->route);
|
|
|
|
|
2023-08-24 13:22:38 +02:00
|
|
|
|
2024-02-15 18:59:09 +01:00
|
|
|
// Création du tableau des issues
|
2024-02-23 12:35:29 +01:00
|
|
|
$issues=$scrum->getScrumissues();
|
2024-02-15 18:59:09 +01:00
|
|
|
$tbissues=[];
|
|
|
|
$tbcols=[];
|
|
|
|
$tbjals=[];
|
|
|
|
$tbsprs=[];
|
|
|
|
$tbestim=[];
|
|
|
|
|
|
|
|
$viewclosed = $this->get('session')->get("viewclosed");
|
|
|
|
foreach($issues as $issue) {
|
|
|
|
// bypass closed
|
2024-04-12 16:30:36 +02:00
|
|
|
if($viewclosed=="false"&&($issue->getGiteastate()=="closed"||($issue->getScrumsprint()&&$issue->getScrumsprint()->getClosed()))) continue;
|
2024-02-15 18:59:09 +01:00
|
|
|
|
|
|
|
// Ids
|
2024-02-22 14:52:15 +01:00
|
|
|
$idcol=($issue->getScrumcolumn()?$issue->getScrumcolumn()->getId():$firstcolumn->getId());
|
2024-02-15 18:59:09 +01:00
|
|
|
$idjal=($issue->getGiteamilestone()?$issue->getGiteamilestone():-100);
|
|
|
|
$idspr=($issue->getScrumsprint()?$issue->getScrumsprint()->getId():-100);
|
|
|
|
|
|
|
|
// Roworders
|
2024-02-22 17:03:25 +01:00
|
|
|
$rowcol=($issue->getScrumcolumn()?$issue->getScrumcolumn()->getRowid():$firstcolumn->getRowid());
|
2024-02-15 18:59:09 +01:00
|
|
|
$rowjal=($issue->getGiteaMilestonename()?$issue->getGiteaMilestonename():-100);
|
|
|
|
$rowspr=($issue->getScrumsprint()?$issue->getScrumsprint()->getRowid():-100);
|
|
|
|
|
|
|
|
// Names
|
2024-02-22 17:03:25 +01:00
|
|
|
$nmcol=($issue->getScrumcolumn()?$issue->getScrumcolumn()->getName():$firstcolumn->getName());
|
2024-02-15 18:59:09 +01:00
|
|
|
$nmjal=($issue->getGiteaMilestonename()?$issue->getGiteaMilestonename():"Aucun");
|
|
|
|
$nmspr=($issue->getScrumsprint()?$issue->getScrumsprint()->getName():"Aucun");
|
|
|
|
|
2024-02-23 12:35:29 +01:00
|
|
|
// Idgiteas
|
|
|
|
$gicol=($issue->getScrumcolumn()?$issue->getScrumcolumn()->getGiteaid():$firstcolumn->getGiteaid());
|
|
|
|
$gijal=($issue->getGiteaMilestone()?$issue->getGiteaMilestone():-100);
|
|
|
|
|
2024-02-15 18:59:09 +01:00
|
|
|
if(!array_key_exists($idjal,$tbestim)) {
|
|
|
|
$tbestim[$idjal] = [
|
|
|
|
"rowjal" => $rowjal,
|
|
|
|
"idjal" => $idjal,
|
2024-02-23 12:35:29 +01:00
|
|
|
"gijal" => $gijal,
|
2024-02-15 18:59:09 +01:00
|
|
|
"nmjal" => $nmjal,
|
|
|
|
"nbjrs" => 0,
|
2024-02-22 17:03:25 +01:00
|
|
|
"nbiss" => 0,
|
2024-02-15 18:59:09 +01:00
|
|
|
"columns" => [],
|
|
|
|
"sprints" => [],
|
|
|
|
];
|
2022-01-28 16:54:46 +01:00
|
|
|
}
|
2023-08-24 13:22:38 +02:00
|
|
|
|
2024-02-15 18:59:09 +01:00
|
|
|
if(!array_key_exists($idspr,$tbestim[$idjal]["sprints"])) {
|
|
|
|
$tbestim[$idjal]["sprints"][$idspr] = [
|
|
|
|
"rowspr" => $rowspr,
|
|
|
|
"idspr" => $idspr,
|
|
|
|
"nmspr" => $nmspr,
|
|
|
|
"nbjrs" => 0,
|
2024-02-22 17:03:25 +01:00
|
|
|
"nbiss" => 0,
|
2024-02-15 18:59:09 +01:00
|
|
|
"columns" => [],
|
|
|
|
];
|
|
|
|
}
|
|
|
|
|
|
|
|
if(!array_key_exists($idcol,$tbestim[$idjal]["columns"])) {
|
|
|
|
$tbestim[$idjal]["columns"][$idcol] = [
|
|
|
|
"rowcol" => $rowcol,
|
|
|
|
"idcol" => $idcol,
|
2024-02-23 12:35:29 +01:00
|
|
|
"gicol" => $gicol,
|
2024-02-15 18:59:09 +01:00
|
|
|
"nmcol" => $nmcol,
|
2024-02-22 14:54:09 +01:00
|
|
|
"color" => ($issue->getScrumcolumn()?$issue->getScrumcolumn()->getGiteajson()["color"]:$firstcolumn->getGiteajson()["color"]),
|
2024-02-15 18:59:09 +01:00
|
|
|
"nbjrs" => 0,
|
2024-02-22 17:03:25 +01:00
|
|
|
"nbiss" => 0,
|
2024-02-15 18:59:09 +01:00
|
|
|
];
|
|
|
|
}
|
|
|
|
|
|
|
|
if(!array_key_exists($idcol,$tbestim[$idjal]["sprints"][$idspr]["columns"])) {
|
|
|
|
$tbestim[$idjal]["sprints"][$idspr]["columns"][$idcol] = [
|
|
|
|
"rowcol" => $rowcol,
|
|
|
|
"idcol" => $idcol,
|
2024-02-23 12:35:29 +01:00
|
|
|
"gicol" => $gicol,
|
2024-02-15 18:59:09 +01:00
|
|
|
"nmcol" => $nmcol,
|
2024-02-22 14:54:09 +01:00
|
|
|
"color" => ($issue->getScrumcolumn()?$issue->getScrumcolumn()->getGiteajson()["color"]:$firstcolumn->getGiteajson()["color"]),
|
2024-02-15 18:59:09 +01:00
|
|
|
"nbjrs" => 0,
|
2024-02-22 17:03:25 +01:00
|
|
|
"nbiss" => 0,
|
2024-02-15 18:59:09 +01:00
|
|
|
];
|
|
|
|
}
|
|
|
|
|
|
|
|
// On cumule les estimations
|
|
|
|
$tbestim[$idjal]["nbjrs"]+=$issue->getWeight();
|
|
|
|
$tbestim[$idjal]["columns"][$idcol]["nbjrs"]+=$issue->getWeight();
|
|
|
|
$tbestim[$idjal]["sprints"][$idspr]["nbjrs"]+=$issue->getWeight();
|
|
|
|
$tbestim[$idjal]["sprints"][$idspr]["columns"][$idcol]["nbjrs"]+=$issue->getWeight();
|
2024-02-22 17:03:25 +01:00
|
|
|
|
|
|
|
$tbestim[$idjal]["nbiss"]++;
|
|
|
|
$tbestim[$idjal]["columns"][$idcol]["nbiss"]++;
|
|
|
|
$tbestim[$idjal]["sprints"][$idspr]["nbiss"]++;
|
|
|
|
$tbestim[$idjal]["sprints"][$idspr]["columns"][$idcol]["nbiss"]++;
|
|
|
|
|
2024-02-23 12:35:29 +01:00
|
|
|
$this->formatDec($tbestim[$idjal]["nbjrs"]);
|
|
|
|
$this->formatDec($tbestim[$idjal]["columns"][$idcol]["nbjrs"]);
|
|
|
|
$this->formatDec($tbestim[$idjal]["sprints"][$idspr]["nbjrs"]);
|
|
|
|
$this->formatDec($tbestim[$idjal]["sprints"][$idspr]["columns"][$idcol]["nbjrs"]);
|
2024-02-21 22:18:01 +01:00
|
|
|
|
|
|
|
|
2022-09-21 11:05:17 +02:00
|
|
|
}
|
2024-02-23 12:35:29 +01:00
|
|
|
|
|
|
|
return $tbestim;
|
|
|
|
}
|
|
|
|
|
|
|
|
private function formatDec(&$number) {
|
|
|
|
if(strpos(strval($number), '.') !== false) $number=number_format($number,1);
|
|
|
|
else $number=intval($number);
|
2022-09-21 11:05:17 +02:00
|
|
|
}
|
|
|
|
|
2021-07-20 13:04:47 +02:00
|
|
|
protected function getErrorForm($id,$form,$request,$data,$mode) {
|
|
|
|
if ($form->get('submit')->isClicked()&&$mode=="delete") {
|
|
|
|
}
|
|
|
|
|
|
|
|
if ($form->get('submit')->isClicked() && $mode=="submit") {
|
|
|
|
}
|
|
|
|
|
|
|
|
if ($form->get('submit')->isClicked() && ($mode=="submit" || $mode=="update")) {
|
|
|
|
}
|
|
|
|
|
|
|
|
if ($form->get('submit')->isClicked() && !$form->isValid()) {
|
|
|
|
$this->get('session')->getFlashBag()->clear();
|
|
|
|
|
|
|
|
$errors = $form->getErrors();
|
|
|
|
foreach( $errors as $error ) {
|
|
|
|
$request->getSession()->getFlashBag()->add("error", $error->getMessage());
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|