fix ctrlchange
This commit is contained in:
parent
b155036347
commit
9171ecbf6c
@ -404,6 +404,11 @@ class ScrumController extends AbstractController
|
||||
$filterexcludes = $em->getRepository("App:User")->getUserpreference($this->getUser(),"filterexcludes",$id);
|
||||
$showfilters = $em->getRepository("App:User")->getUserpreference($this->getUser(),"showfilters",$id);
|
||||
|
||||
// Me demandez pas pourquoi mais j'ai un décallage de 30mn
|
||||
$updatedate=$data->getUpdatedate();
|
||||
$updatedate->setTimezone(new \DateTimeZone("UTC"));
|
||||
$updatedate->add(new \DateInterval("PT30M"));
|
||||
|
||||
return $this->render($this->render.'view.html.twig', [
|
||||
'useheader' => true,
|
||||
'usesidebar' => false,
|
||||
@ -429,6 +434,7 @@ class ScrumController extends AbstractController
|
||||
'showfilters' => $showfilters,
|
||||
'tbissues' => $tbissues,
|
||||
'tbestim' => $tbestim,
|
||||
'updatedate' => $updatedate,
|
||||
$this->data => $data,
|
||||
]);
|
||||
}
|
||||
|
@ -319,42 +319,16 @@ class ScrumissueController extends AbstractController
|
||||
|
||||
$id=$request->get('id');
|
||||
$lastupdate=new \DateTime($request->get('lastupdate'));
|
||||
$lastupdate->setTimezone(new \DateTimeZone("UTC"));
|
||||
$lastupdate->add(new \DateInterval("PT1M"));
|
||||
//var_dump($lastupdate->format(\DateTime::RFC3339_EXTENDED));
|
||||
|
||||
$scrum=$em->getRepository("App:Scrum")->find($id);
|
||||
if(!$scrum) return new JsonResponse(['message' => 'No Scrum'], 403);
|
||||
|
||||
/*
|
||||
$lastupdate=$scrum->getUpdatedate();
|
||||
$lastupdate->setTimezone(new \DateTimeZone("UTC"));
|
||||
*/
|
||||
$giteaissues=$this->giteaservice->getIssues($scrum->getGiteajson()["owner"]["login"],$scrum->getGiteajson()["name"],"?since=".urlencode($lastupdate->format(\DateTime::RFC3339_EXTENDED)));
|
||||
|
||||
$giteaissues=$this->giteaservice->getIssues($scrum->getGiteajson()["owner"]["login"],$scrum->getGiteajson()["name"]);
|
||||
if(!is_array($giteaissues)) die("Probleme de connexion avec gitea veuillez vous <a href='/logout'>reconnecter</a>");
|
||||
|
||||
foreach($giteaissues as $giteaissue) {
|
||||
// On ne prend pas les pull request
|
||||
if(!is_null($giteaissue->pull_request))
|
||||
continue;
|
||||
|
||||
$scrumissue=$em->getRepository("App:Scrumissue")->findOneBy(["scrum"=>$scrum,"giteaid"=>$giteaissue->id]);
|
||||
|
||||
if(!$scrumissue) {
|
||||
return new JsonResponse(true);
|
||||
}
|
||||
|
||||
$fgissueupdated=false;
|
||||
$updateissue=new \DateTime(json_decode(json_encode($giteaissue), true)["updated_at"]);
|
||||
$updateissue->setTimezone(new \DateTimeZone("UTC"));
|
||||
|
||||
if($updateissue>$lastupdate) {
|
||||
$fgissueupdated=true;
|
||||
}
|
||||
|
||||
if($fgissueupdated)
|
||||
return new JsonResponse(true);
|
||||
}
|
||||
|
||||
return new JsonResponse(false);
|
||||
return new Response((!empty($giteaissues)?"1":"0"));
|
||||
}
|
||||
|
||||
public function getpoker($userid,$issueid,Request $request) {
|
||||
|
@ -236,6 +236,7 @@ class ScrumRepository extends ServiceEntityRepository
|
||||
}
|
||||
|
||||
if($fgissueupdated) {
|
||||
dump(json_decode(json_encode($giteaissue), true)["updated_at"]);
|
||||
$updateissue=new \DateTime(json_decode(json_encode($giteaissue), true)["updated_at"]);
|
||||
$updateissue->setTimezone(new \DateTimeZone("UTC"));
|
||||
array_push($updatedates,$updateissue);
|
||||
@ -257,6 +258,7 @@ class ScrumRepository extends ServiceEntityRepository
|
||||
$this->showtime(false,"Traiter les issues");
|
||||
|
||||
if($fgscrumupdate) {
|
||||
dump($updatedates);
|
||||
// Convertir les objets DateTime en timestamps
|
||||
$timestamps = array_map(function($date) {
|
||||
return $date->getTimestamp();
|
||||
@ -269,6 +271,8 @@ class ScrumRepository extends ServiceEntityRepository
|
||||
$mostRecentDate = (new \DateTime())->setTimestamp($mostRecentTimestamp);
|
||||
|
||||
// Mettre à jour la date update du scrum
|
||||
dump($mostRecentDate);
|
||||
dump("pouet");
|
||||
$scrum->setUpdatedate($mostRecentDate);
|
||||
$this->_em->flush();
|
||||
|
||||
|
@ -3,6 +3,7 @@ namespace App\Twig;
|
||||
|
||||
use Twig\Extension\AbstractExtension;
|
||||
use Twig\TwigFilter;
|
||||
use Twig\TwigFunction;
|
||||
|
||||
class AppExtension extends AbstractExtension
|
||||
{
|
||||
@ -15,6 +16,13 @@ class AppExtension extends AbstractExtension
|
||||
];
|
||||
}
|
||||
|
||||
public function getFunctions()
|
||||
{
|
||||
return [
|
||||
new TwigFunction('microtime', [$this, 'getMicrotime']),
|
||||
];
|
||||
}
|
||||
|
||||
public function urlAvatar($avatar)
|
||||
{
|
||||
if(stripos($avatar,"http")===0)
|
||||
@ -23,6 +31,11 @@ class AppExtension extends AbstractExtension
|
||||
return $this->container->getParameter("appAlias")."uploads/avatar/".$avatar;
|
||||
}
|
||||
|
||||
public function getMicrotime($asFloat = true)
|
||||
{
|
||||
return microtime($asFloat);
|
||||
}
|
||||
|
||||
public function setContainer($container)
|
||||
{
|
||||
$this->container = $container;
|
||||
|
@ -54,7 +54,10 @@
|
||||
{% endblock %}
|
||||
|
||||
{% block body %}
|
||||
{% set start = microtime(true) %}
|
||||
|
||||
<div class="d-flex">
|
||||
|
||||
<div id="filters" class="d-flex flex-column pl-2 pr-2 " style="width:350px; background-color:var(--colorbgbodydark);min-height:1500px;">
|
||||
<div style="width:100%" class="mt-3">
|
||||
<label class="control-label" style="color:var(--colorftbodydark)">Filtre JALONS</label>
|
||||
@ -453,7 +456,6 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<div id="mymodalassignees" class="modal" role="dialog">
|
||||
<div class="modal-dialog modal-lg" role="document">
|
||||
<div class="modal-content">
|
||||
@ -481,7 +483,11 @@
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{% set end = microtime(true) %}
|
||||
{% set duration = end - start %}
|
||||
<p>render time: {{ duration }} seconds</p>
|
||||
{% endblock %}
|
||||
|
||||
{% block localjavascript %}
|
||||
@ -507,7 +513,7 @@
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
$(document).ready(function() {
|
||||
// Apply Filter
|
||||
function showhide() {
|
||||
@ -1084,7 +1090,7 @@
|
||||
refreshinfo();
|
||||
$("#mycontent").show();
|
||||
|
||||
lastupdate="{{scrum.updatedate|date("Ymd H:i:s")}}";
|
||||
lastupdate="{{updatedate|date("Ymd H:i")}}";
|
||||
console.log(lastupdate);
|
||||
|
||||
|
||||
@ -1153,7 +1159,6 @@
|
||||
});
|
||||
|
||||
var intervalId = window.setInterval(function(){
|
||||
console.log(lastupdate);
|
||||
$.ajax({
|
||||
method: "POST",
|
||||
url: "{{path("app_scrumissue_ctrlchange")}}",
|
||||
@ -1162,7 +1167,7 @@
|
||||
lastupdate:lastupdate
|
||||
},
|
||||
success: function(fgupdated) {
|
||||
if(fgupdated) {
|
||||
if(fgupdated=="1") {
|
||||
$("#haveupdate").show();
|
||||
}
|
||||
}
|
||||
@ -1171,6 +1176,7 @@
|
||||
|
||||
});
|
||||
|
||||
|
||||
function refreshinfo() {
|
||||
$.ajax({
|
||||
method: "POST",
|
||||
|
Loading…
Reference in New Issue
Block a user