diff --git a/src/Controller/ScrumController.php b/src/Controller/ScrumController.php
index 2e7619b..66e0cf0 100755
--- a/src/Controller/ScrumController.php
+++ b/src/Controller/ScrumController.php
@@ -599,23 +599,57 @@ class ScrumController extends AbstractController
public function stat($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);
- $firstcolumn=$em->getRepository('App:Scrumcolumn')->findOneBy(["scrum"=>$data], ['rowid' => 'ASC']);
- if(!$firstcolumn) return $this->redirectToRoute($this->route);
-
- $em->getRepository("App:Scrum")->getGitea($data,$giteaassignees,$giteacolumns,$giteamilestones,$giteateams,$giteaprioritys,$giteatypes,$gitealabels);
+ $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);
// Préférences utilisateur
$filtermilestones = $em->getRepository("App:User")->getUserpreference($this->getUser(),"filtermilestones",$id);
$filtersprints = $em->getRepository("App:User")->getUserpreference($this->getUser(),"filtersprints",$id);
$filterbynumber = $em->getRepository("App:User")->getUserpreference($this->getUser(),"filterbynumber",$id);
$showfilters = $em->getRepository("App:User")->getUserpreference($this->getUser(),"showfilters",$id);
+
+ $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,
+ ]);
+ }
+
+ 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);
+
// Création du tableau des issues
- $issues=$data->getScrumissues();
+ $issues=$scrum->getScrumissues();
$tbissues=[];
$tbcols=[];
$tbjals=[];
@@ -642,10 +676,15 @@ class ScrumController extends AbstractController
$nmjal=($issue->getGiteaMilestonename()?$issue->getGiteaMilestonename():"Aucun");
$nmspr=($issue->getScrumsprint()?$issue->getScrumsprint()->getName():"Aucun");
+ // Idgiteas
+ $gicol=($issue->getScrumcolumn()?$issue->getScrumcolumn()->getGiteaid():$firstcolumn->getGiteaid());
+ $gijal=($issue->getGiteaMilestone()?$issue->getGiteaMilestone():-100);
+
if(!array_key_exists($idjal,$tbestim)) {
$tbestim[$idjal] = [
"rowjal" => $rowjal,
"idjal" => $idjal,
+ "gijal" => $gijal,
"nmjal" => $nmjal,
"nbjrs" => 0,
"nbiss" => 0,
@@ -669,6 +708,7 @@ class ScrumController extends AbstractController
$tbestim[$idjal]["columns"][$idcol] = [
"rowcol" => $rowcol,
"idcol" => $idcol,
+ "gicol" => $gicol,
"nmcol" => $nmcol,
"color" => ($issue->getScrumcolumn()?$issue->getScrumcolumn()->getGiteajson()["color"]:$firstcolumn->getGiteajson()["color"]),
"nbjrs" => 0,
@@ -680,6 +720,7 @@ class ScrumController extends AbstractController
$tbestim[$idjal]["sprints"][$idspr]["columns"][$idcol] = [
"rowcol" => $rowcol,
"idcol" => $idcol,
+ "gicol" => $gicol,
"nmcol" => $nmcol,
"color" => ($issue->getScrumcolumn()?$issue->getScrumcolumn()->getGiteajson()["color"]:$firstcolumn->getGiteajson()["color"]),
"nbjrs" => 0,
@@ -698,69 +739,20 @@ class ScrumController extends AbstractController
$tbestim[$idjal]["sprints"][$idspr]["nbiss"]++;
$tbestim[$idjal]["sprints"][$idspr]["columns"][$idcol]["nbiss"]++;
+ $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"]);
+
+
}
- return $this->render($this->render.'stat.html.twig', [
- 'useheader' => true,
- 'usesidebar' => false,
- 'usetitle' => $data->getName(),
- 'giteamilestones' => $giteamilestones,
- 'sprints' => $data->getScrumsprints(),
- 'filtermilestones' => $filtermilestones,
- 'filtersprints' => $filtersprints,
- 'filterbynumber' => $filterbynumber,
- 'showfilters' => $showfilters,
- $this->data => $data,
- 'tbestim' => $tbestim,
- ]);
- }
+ return $tbestim;
+ }
- public function info($id,Request $request)
- {
- $em = $this->getDoctrine()->getManager();
- $viewclosed = $request->getSession()->get("viewclosed");
-
- // Rechercher du scrum en cours
- $scrum=$em->getRepository("App:Scrum")->find($id);
- if(!$scrum) return new JsonResponse(['message' => 'No Issue'], 403);
-
- $giteaissues=$this->giteaservice->getIssues($scrum->getGiteajson()["owner"]["login"],$scrum->getGiteajson()["name"],"?state=".($viewclosed=="true"?"all":"open"));
-
- $weights=[];
- foreach($giteaissues as $giteaissue) {
- $scrumissue=$em->getRepository("App:Scrumissue")->findOneBy(["scrum"=>$scrum,"giteaid"=>$giteaissue->id]);
- if($scrumissue) {
- if($giteaissue->milestone) $milestoneid=$giteaissue->milestone->id;
- else $milestoneid=-100;
-
- if($scrumissue->getScrumsprint()) $sprintid=$milestoneid."-".$scrumissue->getScrumsprint()->getId();
- else $sprintid=$milestoneid."-".-100;
-
-
- if(!array_key_exists($milestoneid,$weights)) {
- $weights[$milestoneid]=[
- "id" => $milestoneid,
- "weight"=>0,
- "sprints"=>[],
- ];
- }
-
- if(!array_key_exists($sprintid,$weights[$milestoneid]["sprints"])) {
- $weights[$milestoneid]["sprints"][$sprintid]=[
- "id" => $sprintid,
- "weight"=>0
- ];
- }
-
- $weights[$milestoneid]["weight"]+=$scrumissue->getWeight();
- $weights[$milestoneid]["sprints"][$sprintid]["weight"]+=$scrumissue->getWeight();
- //dump($weights[$milestoneid]["sprints"][$sprintid]["weight"]);
- }
- }
-
- $output=[];
- $output["weights"]=$weights;
- return new JsonResponse($output);
+ private function formatDec(&$number) {
+ if(strpos(strval($number), '.') !== false) $number=number_format($number,1);
+ else $number=intval($number);
}
protected function getErrorForm($id,$form,$request,$data,$mode) {
diff --git a/src/Controller/ScrumissueController.php b/src/Controller/ScrumissueController.php
index 25da7db..b4077ca 100755
--- a/src/Controller/ScrumissueController.php
+++ b/src/Controller/ScrumissueController.php
@@ -158,6 +158,9 @@ class ScrumissueController extends AbstractController
$giteaissue->comments=$this->giteaservice->getIssueComments($repoowner,$reponame,$giteaissue->number);
$giteaissue->statuslife=$issue->getScrumcolumn()->getName();
+ $giteaissue->weight=$issue->getWeight();
+ $giteaissue->nineid=$issue->getId();
+
$giteaissue->sprint=($issue->getScrumsprint()?$issue->getScrumsprint()->getName():null);
foreach($giteaissue->comments as $keycomment => $comment) {
$giteaissue->comments[$keycomment]->body=$this->giteaservice->markdown("/".$scrum->getGiteajson()["full_name"],"comment",$giteaissue->comments[$keycomment]->body);
diff --git a/templates/Scrum/issue.html.twig b/templates/Scrum/issue.html.twig
index 8677f47..1694eb9 100644
--- a/templates/Scrum/issue.html.twig
+++ b/templates/Scrum/issue.html.twig
@@ -37,6 +37,7 @@