From 88ffe47f6e83a03e5c1b55709fb494fe96753878 Mon Sep 17 00:00:00 2001 From: afornerot Date: Sat, 15 Jun 2024 12:25:58 +0200 Subject: [PATCH] fix stat --- src/Controller/ScrumController.php | 35 +++++++++++++++++++++++++----- templates/Scrum/stat.html.twig | 16 ++++++++------ 2 files changed, 39 insertions(+), 12 deletions(-) diff --git a/src/Controller/ScrumController.php b/src/Controller/ScrumController.php index 981caa5..472162c 100755 --- a/src/Controller/ScrumController.php +++ b/src/Controller/ScrumController.php @@ -679,6 +679,8 @@ class ScrumController extends AbstractController } private function getEstim($scrum) { + + // Initialisation de l'enregistrement $em = $this->getDoctrine()->getManager(); $firstcolumn=$em->getRepository('App:Scrumcolumn')->findOneBy(["scrum"=>$scrum], ['rowid' => 'ASC']); @@ -694,10 +696,25 @@ class ScrumController extends AbstractController $tbestim=[]; $viewclosed = $this->get('session')->get("viewclosed"); + if($viewclosed=="false") { + $giteamilestones=$this->giteaservice->getMilestones($scrum->getGiteajson()["owner"]["login"],$scrum->getGiteajson()["name"],"?state=open"); + $giteamilestones=array_column($giteamilestones,"id"); + } + foreach($issues as $issue) { + // bypass jalon closed + if($viewclosed=="false") { + + /* + if(array_key_exists("milestone",$issue->getGiteajson()) && !empty($issue->getGiteajson()["milestone"]) && $issue->getGiteajson()["milestone"]) + dump($issue->getGiteajson()["milestone"]["title"]); + */ + if(array_key_exists("milestone",$issue->getGiteajson()) && !empty($issue->getGiteajson()["milestone"]) && !in_array($issue->getGiteajson()["milestone"]["id"],$giteamilestones)) + continue; + } - // bypass closed - if($viewclosed=="false"&&($issue->getGiteastate()=="closed"||($issue->getScrumsprint()&&$issue->getScrumsprint()->getClosed()))) continue; + + //if($viewclosed=="false"&&($issue->getGiteastate()=="closed"||($issue->getScrumsprint()&&$issue->getScrumsprint()->getClosed()))) continue; // Ids $idcol=($issue->getScrumcolumn()?$issue->getScrumcolumn()->getId():$firstcolumn->getId()); @@ -777,14 +794,22 @@ 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"]); - - + } - + // dd("stop"); + + $keysort = array_column($tbestim, 'nmjal'); + array_multisort($keysort, SORT_DESC, $tbestim); + foreach($tbestim as $keyj => $jalon) { + $keysort = array_column($jalon["sprints"],"nmspr"); + array_multisort($keysort, SORT_DESC, $tbestim[$keyj]["sprints"]); + } return $tbestim; } diff --git a/templates/Scrum/stat.html.twig b/templates/Scrum/stat.html.twig index ea7affc..03b84ad 100644 --- a/templates/Scrum/stat.html.twig +++ b/templates/Scrum/stat.html.twig @@ -80,9 +80,9 @@
{% for column in jalon.columns %} -
{{column.nmcol}}{{(filterbynumber?column.nbiss:column.nbjrs)}} = {{((filterbynumber?column.nbiss:column.nbjrs) * 100 / (filterbynumber?jalon.nbiss:jalon.nbjrs))|number_format}}%
+
{{column.nmcol}}{{(filterbynumber=="true"?column.nbiss:column.nbjrs)}} = {{((filterbynumber=="true"?column.nbiss:column.nbjrs) * 100 / (filterbynumber=="true"?jalon.nbiss:jalon.nbjrs))|number_format}}%
{% endfor %} -
TOTAL{{(filterbynumber?jalon.nbiss:jalon.nbjrs)}} = 100%
+
TOTAL{{(filterbynumber=="true"?jalon.nbiss:jalon.nbjrs)}} = 100%
@@ -94,9 +94,9 @@
{% for column in sprint.columns %} -
{{column.nmcol}}{{(filterbynumber?column.nbiss:column.nbjrs)}} = {{((filterbynumber?column.nbiss:column.nbjrs) * 100 / (filterbynumber?sprint.nbiss:sprint.nbjrs))|number_format}}%
+
{{column.nmcol}}{{(filterbynumber=="true"?column.nbiss:column.nbjrs)}} = {{((filterbynumber=="true"?column.nbiss:column.nbjrs) * 100 / (filterbynumber=="true"?sprint.nbiss:sprint.nbjrs))|number_format}}%
{% endfor %} -
TOTAL{{(filterbynumber?sprint.nbiss:sprint.nbjrs)}} = 100%
+
TOTAL{{(filterbynumber=="true"?sprint.nbiss:sprint.nbjrs)}} = 100%
@@ -300,16 +300,18 @@ }, }); - console.log({{filterbynumber}}); + console.log("BY number = {{ (filterbynumber=="true" ? 'filtre par nbticket':'filtre par poids') }}"); {% for sprint in jalon.sprints %} + console.log("Sprint = {{sprint.nmspr}}"); + {% for column in sprint.columns %} - console.log({{ (filterbynumber ? column.nbiss:column.nbjrs) }}); + console.log({{ (filterbynumber=="true" ? column.nbiss:column.nbjrs) }}); {% endfor %} var data = [ {% for column in sprint.columns %} { label: "{{ column.nmcol}}", - data: {{ (filterbynumber ? column.nbiss:column.nbjrs) }}, + data: {{ (filterbynumber=="true" ? column.nbiss:column.nbjrs) }}, color: "#{{ column.color }}", }, {% endfor %}