Skip to content
Snippets Groups Projects
Commit 4c1ac3e5 authored by Bertrand Gauthier's avatar Bertrand Gauthier
Browse files

Extraction CSV : virgule plutôt que point dans la durée de la thèse.

parent 190f76c2
No related branches found
No related tags found
No related merge requests found
...@@ -11,6 +11,7 @@ use Application\Service\FichierThese\FichierTheseServiceAwareTrait; ...@@ -11,6 +11,7 @@ use Application\Service\FichierThese\FichierTheseServiceAwareTrait;
use Application\Service\These\TheseRechercheServiceAwareTrait; use Application\Service\These\TheseRechercheServiceAwareTrait;
use Application\Service\These\TheseServiceAwareTrait; use Application\Service\These\TheseServiceAwareTrait;
use Application\SourceCodeStringHelperAwareTrait; use Application\SourceCodeStringHelperAwareTrait;
use UnicaenApp\Exception\LogicException;
use UnicaenApp\View\Model\CsvModel; use UnicaenApp\View\Model\CsvModel;
class ExportController extends AbstractController class ExportController extends AbstractController
...@@ -92,10 +93,7 @@ class ExportController extends AbstractController ...@@ -92,10 +93,7 @@ class ExportController extends AbstractController
'Date de fin de confientialité' => function (These $these) { return $these->getDateFinConfidentialite(); }, 'Date de fin de confientialité' => function (These $these) { return $these->getDateFinConfidentialite(); },
'Date de dépôt version initiale' => function (These $these) { $file = $these->hasVersionInitiale(); if ($file) return $file->getFichier()->getHistoCreation()->format('d/m/Y'); return "";}, 'Date de dépôt version initiale' => function (These $these) { $file = $these->hasVersionInitiale(); if ($file) return $file->getFichier()->getHistoCreation()->format('d/m/Y'); return "";},
'Date de dépôt version corigée' => function (These $these) { $file = $these->hasVersionCorrigee(); if ($file) return $file->getFichier()->getHistoCreation()->format('d/m/Y'); return "";}, 'Date de dépôt version corigée' => function (These $these) { $file = $these->hasVersionCorrigee(); if ($file) return $file->getFichier()->getHistoCreation()->format('d/m/Y'); return "";},
'Durée en mois de la thèse' => function (These $these) { if ($these->getDatePremiereInscription() !== null AND $these->getDateSoutenance() !== null) 'Durée en mois de la thèse' => function (These $these) { try { return number_format($these->getDureeThese(), 2, ',', ''); } catch (LogicException $e) { return ""; } },
return number_format(($these->getDateSoutenance())->diff($these->getDatePremiereInscription())->format('%a')/30.5, 2);
else return "";
},
//Flags //Flags
'Etat de la thèse' => function (These $these) { return $these->getEtatTheseToString();}, 'Etat de la thèse' => function (These $these) { return $these->getEtatTheseToString();},
......
...@@ -9,6 +9,7 @@ use Doctrine\Common\Collections\ArrayCollection; ...@@ -9,6 +9,7 @@ use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection; use Doctrine\Common\Collections\Collection;
use UnicaenApp\Entity\HistoriqueAwareInterface; use UnicaenApp\Entity\HistoriqueAwareInterface;
use UnicaenApp\Entity\HistoriqueAwareTrait; use UnicaenApp\Entity\HistoriqueAwareTrait;
use UnicaenApp\Exception\LogicException;
use UnicaenApp\Exception\RuntimeException; use UnicaenApp\Exception\RuntimeException;
use UnicaenApp\Util; use UnicaenApp\Util;
use UnicaenImport\Entity\Db\Traits\SourceAwareTrait; use UnicaenImport\Entity\Db\Traits\SourceAwareTrait;
...@@ -1193,6 +1194,23 @@ class These implements HistoriqueAwareInterface, ResourceInterface ...@@ -1193,6 +1194,23 @@ class These implements HistoriqueAwareInterface, ResourceInterface
return $this->datePremiereInscription; return $this->datePremiereInscription;
} }
/**
* Calcule la durée de la thèse en mois.
*
* @return float
*/
public function getDureeThese()
{
if (! $this->getDateSoutenance()) {
throw new LogicException("Aucune date de soutenance renseignée");
}
if (! $this->getDatePremiereInscription()) {
throw new LogicException("Aucune date de première inscription renseignée");
}
return $this->getDateSoutenance()->diff($this->getDatePremiereInscription())->format('%a') / 30.5;
}
/** /**
* @return string * @return string
*/ */
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment