stat by number of issue

This commit is contained in:
afornerot 2024-02-22 17:03:25 +01:00
parent 37968a3728
commit c61312bc3d
2 changed files with 125 additions and 15 deletions

View File

@ -207,17 +207,17 @@ class ScrumController extends AbstractController
$idspr=($issue->getScrumsprint()?$issue->getScrumsprint()->getId():-100);
// Roworders
$rowcol=($issue->getScrumcolumn()?$issue->getScrumcolumn()->getRowid():$firstcolumn->getId());
$rowcol=($issue->getScrumcolumn()?$issue->getScrumcolumn()->getRowid():$firstcolumn->getRowid());
$rowjal=($issue->getGiteaMilestonename()?$issue->getGiteaMilestonename():-100);
$rowspr=($issue->getScrumsprint()?$issue->getScrumsprint()->getRowid():-100);
// Names
$nmcol=($issue->getScrumcolumn()?$issue->getScrumcolumn()->getName():$firstcolumn->getId());
$nmcol=($issue->getScrumcolumn()?$issue->getScrumcolumn()->getName():$firstcolumn->getName());
$nmjal=($issue->getGiteaMilestonename()?$issue->getGiteaMilestonename():"Aucun");
$nmspr=($issue->getScrumsprint()?$issue->getScrumsprint()->getName():"Aucun");
// Idgiteas
$gicol=($issue->getScrumcolumn()?$issue->getScrumcolumn()->getGiteaid():$firstcolumn->getId());
$gicol=($issue->getScrumcolumn()?$issue->getScrumcolumn()->getGiteaid():$firstcolumn->getGiteaid());
$gijal=($issue->getGiteaMilestone()?$issue->getGiteaMilestone():-100);
// Liste des colonnes/jalons/sprint avec des issues
@ -611,6 +611,7 @@ class ScrumController extends AbstractController
// 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);
// Création du tableau des issues
@ -632,12 +633,12 @@ class ScrumController extends AbstractController
$idspr=($issue->getScrumsprint()?$issue->getScrumsprint()->getId():-100);
// Roworders
$rowcol=($issue->getScrumcolumn()?$issue->getScrumcolumn()->getRowid():$firstcolumn->getId());
$rowcol=($issue->getScrumcolumn()?$issue->getScrumcolumn()->getRowid():$firstcolumn->getRowid());
$rowjal=($issue->getGiteaMilestonename()?$issue->getGiteaMilestonename():-100);
$rowspr=($issue->getScrumsprint()?$issue->getScrumsprint()->getRowid():-100);
// Names
$nmcol=($issue->getScrumcolumn()?$issue->getScrumcolumn()->getName():$firstcolumn->getId());
$nmcol=($issue->getScrumcolumn()?$issue->getScrumcolumn()->getName():$firstcolumn->getName());
$nmjal=($issue->getGiteaMilestonename()?$issue->getGiteaMilestonename():"Aucun");
$nmspr=($issue->getScrumsprint()?$issue->getScrumsprint()->getName():"Aucun");
@ -647,6 +648,7 @@ class ScrumController extends AbstractController
"idjal" => $idjal,
"nmjal" => $nmjal,
"nbjrs" => 0,
"nbiss" => 0,
"columns" => [],
"sprints" => [],
];
@ -658,6 +660,7 @@ class ScrumController extends AbstractController
"idspr" => $idspr,
"nmspr" => $nmspr,
"nbjrs" => 0,
"nbiss" => 0,
"columns" => [],
];
}
@ -669,6 +672,7 @@ class ScrumController extends AbstractController
"nmcol" => $nmcol,
"color" => ($issue->getScrumcolumn()?$issue->getScrumcolumn()->getGiteajson()["color"]:$firstcolumn->getGiteajson()["color"]),
"nbjrs" => 0,
"nbiss" => 0,
];
}
@ -679,6 +683,7 @@ class ScrumController extends AbstractController
"nmcol" => $nmcol,
"color" => ($issue->getScrumcolumn()?$issue->getScrumcolumn()->getGiteajson()["color"]:$firstcolumn->getGiteajson()["color"]),
"nbjrs" => 0,
"nbiss" => 0,
];
}
@ -687,6 +692,12 @@ class ScrumController extends AbstractController
$tbestim[$idjal]["columns"][$idcol]["nbjrs"]+=$issue->getWeight();
$tbestim[$idjal]["sprints"][$idspr]["nbjrs"]+=$issue->getWeight();
$tbestim[$idjal]["sprints"][$idspr]["columns"][$idcol]["nbjrs"]+=$issue->getWeight();
$tbestim[$idjal]["nbiss"]++;
$tbestim[$idjal]["columns"][$idcol]["nbiss"]++;
$tbestim[$idjal]["sprints"][$idspr]["nbiss"]++;
$tbestim[$idjal]["sprints"][$idspr]["columns"][$idcol]["nbiss"]++;
}
return $this->render($this->render.'stat.html.twig', [
@ -694,7 +705,10 @@ class ScrumController extends AbstractController
'usesidebar' => false,
'usetitle' => $data->getName(),
'giteamilestones' => $giteamilestones,
'sprints' => $data->getScrumsprints(),
'filtermilestones' => $filtermilestones,
'filtersprints' => $filtersprints,
'filterbynumber' => $filterbynumber,
'showfilters' => $showfilters,
$this->data => $data,
'tbestim' => $tbestim,

View File

@ -35,7 +35,27 @@
{% endfor %}
<option value="-100">Aucun</option>
</select>
</div>
</div>
<div style="width:100%" class="mt-3">
<label class="control-label" style="color:var(--colorftbodydark)">Filtre SPRINT</label>
<select id="filtersprints" multiple="multiple" class="form-control">
{% for sprint in sprints %}
<option value="{{sprint.giteamilestone~"-"~sprint.id}}">{{sprint.giteamilestonename}}-{{sprint.name}}</option>
{% endfor %}
{% for giteamilestone in giteamilestones %}
<option value="{{giteamilestone.id~"--100"}}">{{giteamilestone.title}}-Aucun</option>
{% endfor %}
</select>
</div>
<div style="width:100%" class="mt-3">
<div class="custom-control custom-switch">
<input type="checkbox" class="custom-control-input" id="filterbynumber">
<label class="custom-control-label" for="filterbynumber" style="color:var(--colorfttitledark);">Vue par {{ (filterbynumber=="true"?"nombre":"poids") }} de tickets</label>
</div>
</div>
</div>
<div class="pl-3" style="width:100%;">
@ -56,13 +76,13 @@
<div class="card-header">{{jalon.nmjal}}</div>
<div class="card-body d-flex justify-content-center">
<div class="d-flex flex-column">
<div class="d-flex justify-content-center">
<div class="ustify-content-center" style="display:flex" data-graphmilestone="{{ jalon.idjal }}">
<div id="floatdonut{{ jalon.idjal }}" class="flot-chart-content"></div>
<div style="min-width:250px; color: #ffffff; padding: 3px;">
{% for column in jalon.columns %}
<div style="padding: 3px; background-color:#{{column.color}}">{{column.nmcol}}<span class="float-right">{{column.nbjrs}}</<span></div>
<div style="padding: 3px; background-color:#{{column.color}}">{{column.nmcol}}<span class="float-right">{{(filterbynumber?column.nbiss:column.nbjrs)}} = {{((filterbynumber?column.nbiss:column.nbjrs) * 100 / (filterbynumber?jalon.nbiss:jalon.nbjrs))|number_format}}%</<span></div>
{% endfor %}
<div style="padding: 3px;color: #000">TOTAL<span class="float-right">{{jalon.nbjrs}}</<span></div>
<div style="padding: 3px;color: #000">TOTAL<span class="float-right">{{(filterbynumber?jalon.nbiss:jalon.nbjrs)}} = 100%</<span></div>
</div>
</div>
<div class="d-flex flex-wrap justify-content-center">
@ -74,9 +94,9 @@
<div id="floatdonut{{ jalon.idjal~"-"~sprint.idspr }}" class="flot-chart-subcontent" style="float:left"></div>
<div class="mt-3" style="color: #ffffff;">
{% for column in sprint.columns %}
<div style="padding: 3px; background-color:#{{column.color}}">{{column.nmcol}}<span class="float-right">{{column.nbjrs}}</<span></div>
<div style="padding: 3px; background-color:#{{column.color}}">{{column.nmcol}}<span class="float-right">{{(filterbynumber?column.nbiss:column.nbjrs)}} = {{((filterbynumber?column.nbiss:column.nbjrs) * 100 / (filterbynumber?sprint.nbiss:sprint.nbjrs))|number_format}}%</<span></div>
{% endfor %}
<div style="padding: 3px;color: #000">TOTAL<span class="float-right">{{sprint.nbjrs}}</<span></div>
<div style="padding: 3px;color: #000">TOTAL<span class="float-right">{{(filterbynumber?sprint.nbiss:sprint.nbjrs)}} = 100%</<span></div>
</div>
</div>
</div>
@ -93,10 +113,29 @@
</div>
</div>
</div>
{% endblock %}
{% block localjavascript %}
// View par nombre de tickets
{% if filterbynumber %}
$("#filterbynumber").prop( "checked", {{ filterbynumber }} )
{% endif %}
$('#filterbynumber').change(function() {
$.ajax({
method: "POST",
url: "{{ path('app_user_preference') }}",
data: {
key:'filterbynumber',
id:{{scrum.id}},
value: this.checked
}
}).done(function( data ) {
location.reload();
});
});
function showFilters() {
if($("#filters").hasClass("d-flex")) {
toshow=0;
@ -123,13 +162,28 @@
$(document).ready(function() {
// Apply Filter
function showhide() {
// Afficher masquer les jalons
if($("#filtermilestones").val().length !== 0) {
$("[data-milestone]").hide();
$.each($("#filtermilestones").val(), function( index, value ) {
$("[data-milestone="+value+"]").show();
$("[data-graphmilestone="+value+"]").show();
});
}
else $("[data-milestone]").show();
else {
$("[data-milestone]").show();
$("[data-graphmilestone]").show();
}
// Afficher masquer les sprints
if($("#filtersprints").val().length !== 0) {
$("[data-sprint]").hide();
$("[data-graphmilestone]").hide();
$.each($("#filtersprints").val(), function( index, value ) {
$("[data-sprint="+value+"]").show();
});
}
else if($("#filtermilestones").val().length === 0)$("[data-sprint]").show();
textfilters="";
if($("#filtermilestones").val().length!==0) {
@ -141,6 +195,15 @@
});
}
if($("#filtersprints").val().length!==0) {
data = $("#filtersprints").select2('data');
textfilters=textfilters+"&nbsp;&nbsp;&nbsp;&nbsp;<b>SPRINT</b> =";
$.each($("#filtersprints").val(), function( index, value ) {
if(index>0)textfilters=textfilters+" &";
textfilters=textfilters+" "+data[index].text;
});
}
$("#textfilters").html(textfilters);
}
@ -173,12 +236,41 @@
filtermilestones();
});
// Filter Sprints
function filtersprints() {
$.ajax({
method: "POST",
url: "{{ path('app_user_preference') }}",
data: {
key:'filtersprints',
id:{{scrum.id}},
value: $("#filtersprints").val()
}
});
showhide();
}
$('#filtersprints').select2();
{% if filtersprints %}
{% for sprint in filtersprints %}
$("#filtersprints").val($("#filtersprints").val().concat("{{sprint}}"));
{%endfor%}
$('#filtersprints').trigger('change');
{% endif %}
$('#filtersprints').on("select2:select", function(e) {
filtersprints();
});
$('#filtersprints').on("select2:unselect", function(e) {
filtersprints();
});
{% for jalon in tbestim %}
var data = [
{% for column in jalon.columns %}
{
label: "{{ column.nmcol}}",
data: {{ column.nbjrs }},
data: {{ column.nbiss }},
color: "#{{ column.color }}",
},
{% endfor %}
@ -208,12 +300,16 @@
},
});
console.log({{filterbynumber}});
{% for sprint in jalon.sprints %}
{% for column in sprint.columns %}
console.log({{ (filterbynumber ? column.nbiss:column.nbjrs) }});
{% endfor %}
var data = [
{% for column in sprint.columns %}
{
label: "{{ column.nmcol}}",
data: {{ column.nbjrs }},
data: {{ (filterbynumber ? column.nbiss:column.nbjrs) }},
color: "#{{ column.color }}",
},
{% endfor %}