This commit is contained in:
2025-07-06 22:56:43 +02:00
parent b1df69696f
commit 6fa2fb4cf1
5 changed files with 69 additions and 6 deletions

View File

@ -26,6 +26,30 @@ class HomeController extends AbstractController
return $this->noproject();
}
$redmine = $this->redmineService->getProject($project->getId(), $this->getParameter('redmineApikey'));
$project->setRedmine($redmine);
$this->redmineService->majProjectIssues($project, $this->getParameter('redmineApikey'), false);
$predmine = $project->getRedmine();
foreach ($project->getIssues() as $issue) {
foreach ($predmine['sprints'] as $key => $sprint) {
if ($sprint['id'] === $issue->getRedmine()['sprint']['agile_sprint_id']) {
if (!array_key_exists('story_points', $predmine['sprints'][$key])) {
$predmine['sprints'][$key]['story_points']['total'] = 0;
}
$predmine['sprints'][$key]['story_points']['total'] += $issue->getRedmine()['sprint']['story_points'];
if (!array_key_exists($issue->getRedmine()['status']['id'], $predmine['sprints'][$key]['story_points'])) {
$predmine['sprints'][$key]['story_points'][$issue->getRedmine()['status']['id']] = 0;
}
$predmine['sprints'][$key]['story_points'][$issue->getRedmine()['status']['id']] += $issue->getRedmine()['sprint']['story_points'];
}
}
}
$project->setRedmine($predmine);
return $this->render('home/home.html.twig', [
'usemenu' => true,
'usesidebar' => false,

View File

@ -83,7 +83,7 @@ class ProjectController extends AbstractController
$redmine = $this->redmineService->getProject($project->getId(), $this->getParameter('redmineApikey'));
$project->setRedmine($redmine);
$em->flush();
$this->redmineService->majProjectIssues($project, $this->getParameter('redmineApikey'), false);
$this->redmineService->majProjectIssues($project, $this->getParameter('redmineApikey'), true);
return $this->redirectToRoute('app_admin_project');
}

View File

@ -203,9 +203,11 @@ class RedmineService
// Calcul de la position sprint
$issueSprintId = $rissue['sprint']['agile_sprint_id'];
$sprintPosition = '';
foreach ($project->getRedmine()['sprints'] as $sprint) {
$sprintIndex = null;
foreach ($project->getRedmine()['sprints'] as $key => $sprint) {
if ($sprint['id'] === $issueSprintId) {
$sprintPosition = $sprint['id']; // ou $index + 1 si tu veux position humaine
$sprintPosition = $sprint['id'];
$sprintIndex = $key;
break;
}
}

View File

@ -2,6 +2,14 @@
{% block localstyle %}
<style>
small {
font-size:70%;
}
verysmall {
font-size:60%;
}
.navbar {
width: 100%;
position: fixed;
@ -53,6 +61,10 @@
margin-bottom:5px;
}
.sprintCardHeader {
display: flex;
}
.versionCard {
background-color: var(--bs-gray-100);
padding: 5px 5px 0px 5px;
@ -85,6 +97,9 @@
.issueAction{
align-self: baseline;
padding: 0px 2px 0px 5px;
text-align:center;
display: flex;
flex-direction: column;
}
.fa-eye {
@ -146,8 +161,11 @@
{% for sprint in project.redmine.sprints|reverse %}
{% if sprint.id not in project.hiddensprints %}
<div class='sprintCard sprintCard{{sprint.id}} card' style='margin-bottom:20px'>
<div class='card-header'>
Sprint = {{ sprint.name }}
<div class='sprintCardHeader card-header'>
<div style='flex-grow:1'>Sprint = {{ sprint.name }}</div>
{% if sprint.story_points[status.id] is defined %}
<div>{{ sprint.story_points[status.id] }}</div>
{% endif %}
</div>
{% for version in project.redmine.versions|reverse %}
@ -199,6 +217,7 @@
<div class='issueSubject'>{{issue.redmine.subject}}</div>
<div class='issueAction'>
<i class='fas fa-eye' onClick='fetchAndRenderIssue({{issue.id}})'></i>
<verysmall>{{issue.redmine.sprint.story_points}}</verysmall>
</div>
</div>
<div class='issueBody'>
@ -216,6 +235,14 @@
<script>
let showIssuebody = false;
function adjustHeight() {
console.log("here");
let ele = $(".issueDescription");
if (ele.length) {
ele.css("height", window.innerHeight - ele.offset().top + "px");
}
}
function showhide() {
// Statut
selected = $('#statusFilter').val();
@ -266,6 +293,7 @@
}
$(document).ready(function () {
// Ranger les issues
$('.issueCard').each(function () {
const id = $(this).data('status')+'-'+$(this).data('sprint')+'-'+$(this).data('version');
const $column = $(`[data-id='${id}']`);
@ -277,6 +305,8 @@
$(this).hide();
}
});
// Afficher le scrum après rangement
$('.scrumContainer').css('display', 'flex');
// Filtre
@ -288,6 +318,10 @@
// issueBody
$('#toggleIssueBody').on('click',toogleIssueBody);
toogleIssueBody();
// Ajuste height
adjustHeight();
window.addEventListener("resize", adjustHeight);
});
function fetchAndRenderIssue(issueId) {
@ -303,6 +337,8 @@
$('.issueContainer').html(html);
$('.issueContainer').show();
$('.scrumContainer').css('padding-left','750px');
$('.issueDescription').animate({scrollTop: 0}, 0);
adjustHeight();
},
error: function (xhr, status, error) {
console.error('Erreur lors du chargement de lissue :', error);

View File

@ -9,7 +9,7 @@
<small class="text-muted">Projet : {{ issue.redmine.project.name }} • Tracker : {{ issue.redmine.tracker.name }}</small>
</div>
<div class="card-body" style="height:500px;overflow-y:auto">
<div class="issueDescription card-body" style="height:500px;overflow-y:auto">
<div class="d-flex">
<div class="mb-3" style="flex-grow:0.5">
<strong>Statut :</strong> {{ issue.redmine.status.name }}<br>
@ -70,6 +70,7 @@
</div>
{% endif %}
{{dump(issue.project.redmine)}}
{{dump(issue.redmine)}}
</div>