This commit is contained in:
afornerot 2022-01-13 21:13:38 +01:00
parent 59f16701a6
commit dd5c13027f
3 changed files with 40 additions and 34 deletions

View File

@ -238,6 +238,7 @@ class ScrumController extends AbstractController
} }
// Récupérer les issues de gitea // Récupérer les issues de gitea
$giteaissues=$this->giteaservice->getIssues($data->getGiteajson()["owner"]["login"],$data->getGiteajson()["name"]); $giteaissues=$this->giteaservice->getIssues($data->getGiteajson()["owner"]["login"],$data->getGiteajson()["name"]);
if(!is_array($giteaissues)) die("Probleme de connexion avec gitea veuillez vous <a href='/ninegitea/logout'>reconnecter</a>"); if(!is_array($giteaissues)) die("Probleme de connexion avec gitea veuillez vous <a href='/ninegitea/logout'>reconnecter</a>");
@ -259,37 +260,39 @@ class ScrumController extends AbstractController
$scrumissue->setGiteaid($giteaissue->id); $scrumissue->setGiteaid($giteaissue->id);
} }
$scrumissue->setGiteanumber($giteaissue->number); if($scrumissue->getGiteajson()["updated_at"]!=json_decode(json_encode($giteaissue), true)["updated_at"]) {
$scrumissue->setGiteastate($giteaissue->state); $scrumissue->setGiteanumber($giteaissue->number);
$scrumissue->setGiteatitle($giteaissue->title); $scrumissue->setGiteastate($giteaissue->state);
if($giteaissue->milestone) { $scrumissue->setGiteatitle($giteaissue->title);
$scrumissue->setGiteamilestone($giteaissue->milestone->id); if($giteaissue->milestone) {
$scrumissue->setGiteamilestonename($giteaissue->milestone->title); $scrumissue->setGiteamilestone($giteaissue->milestone->id);
} $scrumissue->setGiteamilestonename($giteaissue->milestone->title);
else {
$scrumissue->setGiteamilestone(null);
$scrumissue->setGiteamilestonename(null);
}
$scrumissue->setGiteajson(json_decode(json_encode($giteaissue), true));
$em->persist($scrumissue);
$em->flush();
array_push($tbgiteaissues,$giteaissue->number);
$havecolumn=false;
foreach($giteaissue->labels as $gitealabel) {
$scrumcolumn=$em->getRepository('App:Scrumcolumn')->findOneBy(["giteaid"=>$gitealabel->id]);
if($scrumcolumn) {
$havecolumn=true;
$scrumissue->setScrumcolumn($scrumcolumn);
break;
} }
} else {
if(!$havecolumn) $scrumissue->setScrumcolumn($firstcolumn); $scrumissue->setGiteamilestone(null);
$scrumissue->setGiteamilestonename(null);
}
$scrumissue->setGiteajson(json_decode(json_encode($giteaissue), true));
// Sauvegarde de l'issue $em->persist($scrumissue);
$em->persist($scrumissue); $em->flush();
$em->flush();
$havecolumn=false;
foreach($giteaissue->labels as $gitealabel) {
$scrumcolumn=$em->getRepository('App:Scrumcolumn')->findOneBy(["giteaid"=>$gitealabel->id]);
if($scrumcolumn) {
$havecolumn=true;
$scrumissue->setScrumcolumn($scrumcolumn);
break;
}
}
if(!$havecolumn) $scrumissue->setScrumcolumn($firstcolumn);
// Sauvegarde de l'issue
$em->persist($scrumissue);
$em->flush();
}
array_push($tbgiteaissues,$giteaissue->number);
} }
$scrumissues=$data->getScrumissues(); $scrumissues=$data->getScrumissues();
@ -299,7 +302,8 @@ class ScrumController extends AbstractController
$em->flush(); $em->flush();
} }
} }
// Préférences utilisateur // Préférences utilisateur
$filtermilestones = $em->getRepository("App:User")->getUserpreference($this->getUser(),"filtermilestones",$id); $filtermilestones = $em->getRepository("App:User")->getUserpreference($this->getUser(),"filtermilestones",$id);
$filterlabels = $em->getRepository("App:User")->getUserpreference($this->getUser(),"filterlabels",$id); $filterlabels = $em->getRepository("App:User")->getUserpreference($this->getUser(),"filterlabels",$id);
@ -310,7 +314,8 @@ class ScrumController extends AbstractController
return $this->render($this->render.'view.html.twig', [ return $this->render($this->render.'view.html.twig', [
'useheader' => true, 'useheader' => true,
'usesidebar' => false, 'usesidebar' => false,
'usetitle' => $data->getName(),
'giteaassignees' => $giteaassignees, 'giteaassignees' => $giteaassignees,
'giteacolumns' => $giteacolumns, 'giteacolumns' => $giteacolumns,
'giteamilestones' => $giteamilestones, 'giteamilestones' => $giteamilestones,

View File

@ -114,10 +114,10 @@
</div> </div>
<div class="card-body p-1" style="line-height:10px;"> <div class="card-body p-1" style="line-height:10px;">
<div class="d-inline-block"> <div>
<small> <small>
{{issue.giteanumber}} - {{ issue.giteatitle }}<br><br> {{issue.giteanumber}} - {{ issue.giteatitle }}<br><br>
<small>Crée le {{issue.giteajson.created_at|date("d/m/y")}}</small><small style ="float:right">Modifié le {{issue.giteajson.updated_at|date("d/m/y")}}</small><br><br>
{% for label in issue.giteajson.labels %} {% for label in issue.giteajson.labels %}
{% if label.id not in giteacolumns %} {% if label.id not in giteacolumns %}
<span class="btn-link tag" style="background-color:#{{label.color}}"> <span class="btn-link tag" style="background-color:#{{label.color}}">

View File

@ -2,7 +2,7 @@
<html> <html>
<head> <head>
<meta http-equiv="Content-Type" content="text/html"; charset="utf-8" /> <meta http-equiv="Content-Type" content="text/html"; charset="utf-8" />
<title>{% block title %}{{app.session.get("appname")}}{% endblock %}</title> <title>{% block title %}{{app.session.get("appname")}}{%if usetitle is defined %} = {{usetitle}} {%endif%}{% endblock %}</title>
<!--[if lt IE 9]> <!--[if lt IE 9]>
<script src="http://html5shim.googlecode.com/svn/trunk/html5.js"></script> <script src="http://html5shim.googlecode.com/svn/trunk/html5.js"></script>
<![endif]--> <![endif]-->
@ -55,6 +55,7 @@
<a class="navbar-brand" href="{{ path('app_home')}}"> <a class="navbar-brand" href="{{ path('app_home')}}">
<img src="/{{ appAlias }}/uploads/logo/{{app.session.get("logodark")}}" style="height:30px;margin-top:-3px;"> <img src="/{{ appAlias }}/uploads/logo/{{app.session.get("logodark")}}" style="height:30px;margin-top:-3px;">
{{app.session.get("appname")}} {{app.session.get("appname")}}
{%if usetitle is defined %} = {{usetitle}} {%endif%}
</a> </a>
{% if usesidebar is defined and usesidebar %} {% if usesidebar is defined and usesidebar %}