Vous avez reçu un message "Your GitLab account has been locked ..." ? Pas d'inquiétude : lisez cet article https://docs.gricad-pages.univ-grenoble-alpes.fr/help/unlock/

Commit 573622c4 authored by Arnaud Bey's avatar Arnaud Bey
Browse files

add some infos on debug page

parent 5eb225a3
...@@ -19,6 +19,18 @@ class RootRepository extends \Doctrine\ORM\EntityRepository ...@@ -19,6 +19,18 @@ class RootRepository extends \Doctrine\ORM\EntityRepository
; ;
} }
public function countAllByLanguage(Language $language)
{
$em = $this->_em;
$dql = "SELECT count(r.id) FROM LexiconBundle\Entity\Root r
WHERE r.language = :language";
$query = $em->createQuery($dql);
$query->setParameter('language', $language);
return $query->getSingleScalarResult();
}
public function getByContentAndLanguage($findWord) public function getByContentAndLanguage($findWord)
{ {
$em = $this->_em; $em = $this->_em;
......
...@@ -51,4 +51,16 @@ class WordRepository extends \Doctrine\ORM\EntityRepository ...@@ -51,4 +51,16 @@ class WordRepository extends \Doctrine\ORM\EntityRepository
return $query->getOneOrNullResult(); return $query->getOneOrNullResult();
} }
public function countAllByLanguage(Language $language)
{
$em = $this->_em;
$dql = "SELECT count(w.id) FROM LexiconBundle\Entity\Word w
WHERE w.language = :language";
$query = $em->createQuery($dql);
$query->setParameter('language', $language);
return $query->getSingleScalarResult();
}
} }
...@@ -3,6 +3,7 @@ ...@@ -3,6 +3,7 @@
namespace LexiconBundle\Repository; namespace LexiconBundle\Repository;
use LexiconBundle\Entity\WordStart; use LexiconBundle\Entity\WordStart;
use LexiconBundle\Entity\Language;
use Doctrine\Bundle\DoctrineBundle\Repository\ServiceEntityRepository; use Doctrine\Bundle\DoctrineBundle\Repository\ServiceEntityRepository;
use Symfony\Bridge\Doctrine\RegistryInterface; use Symfony\Bridge\Doctrine\RegistryInterface;
...@@ -32,4 +33,16 @@ class WordStartRepository extends \Doctrine\ORM\EntityRepository ...@@ -32,4 +33,16 @@ class WordStartRepository extends \Doctrine\ORM\EntityRepository
->getResult() ->getResult()
; ;
} }
public function countAllByLanguage(Language $language)
{
$em = $this->_em;
$dql = "SELECT count(w.id) FROM LexiconBundle\Entity\WordStart w
WHERE w.language = :language";
$query = $em->createQuery($dql);
$query->setParameter('language', $language);
return $query->getSingleScalarResult();
}
} }
...@@ -4,6 +4,9 @@ namespace MagicWordBundle\Controller; ...@@ -4,6 +4,9 @@ namespace MagicWordBundle\Controller;
use LexiconBundle\Entity\Language; use LexiconBundle\Entity\Language;
use LexiconBundle\Entity\Letter; use LexiconBundle\Entity\Letter;
use LexiconBundle\Entity\Root;
use LexiconBundle\Entity\Word;
use LexiconBundle\Entity\WordStart;
use MagicWordBundle\Entity\Grid; use MagicWordBundle\Entity\Grid;
use MagicWordBundle\Entity\Rules\ComboPoints; use MagicWordBundle\Entity\Rules\ComboPoints;
use MagicWordBundle\Entity\Rules\WordLength; use MagicWordBundle\Entity\Rules\WordLength;
...@@ -50,12 +53,20 @@ class AdministrationController extends Controller ...@@ -50,12 +53,20 @@ class AdministrationController extends Controller
$bestGrids = $this->getDoctrine()->getRepository(Grid::class)->getBestByLanguage($language); $bestGrids = $this->getDoctrine()->getRepository(Grid::class)->getBestByLanguage($language);
$worstGrids = $this->getDoctrine()->getRepository(Grid::class)->getWorstByLanguage($language); $worstGrids = $this->getDoctrine()->getRepository(Grid::class)->getWorstByLanguage($language);
$countGrids = $this->getDoctrine()->getRepository(Grid::class)->countAllByLanguage($language); $countGrids = $this->getDoctrine()->getRepository(Grid::class)->countAllByLanguage($language);
$countWords = $this->getDoctrine()->getRepository(Word::class)->countAllByLanguage($language);
$countRoots = $this->getDoctrine()->getRepository(Root::class)->countAllByLanguage($language);
$countWordStarts = $this->getDoctrine()->getRepository(WordStart::class)->countAllByLanguage($language);
$letters = $this->getDoctrine()->getRepository(Letter::class)->findBy(["language" => $language], ["value" => "ASC"]);
return $this->render('MagicWordBundle:Administration:language-debug.html.twig', [ return $this->render('MagicWordBundle:Administration:language-debug.html.twig', [
'language' => $language, 'language' => $language,
'bestGrids' => $bestGrids, 'bestGrids' => $bestGrids,
'worstGrids' => $worstGrids, 'worstGrids' => $worstGrids,
'countGrids' => $countGrids 'countGrids' => $countGrids,
'countWords' => $countWords,
'countWordStarts' => $countWordStarts,
'countRoots' => $countRoots,
'letters' => $letters
]); ]);
} }
......
...@@ -77,7 +77,7 @@ ...@@ -77,7 +77,7 @@
<p> <p>
Blabla labla Blab laBlabla BlablaBlabla Blabla Blabla Blabla labla Blab laBlabla BlablaBlabla Blabla Blabla
</p> </p>
<a class="btn btn-primary"href="{{ path('language_debug', {'id': language.id}) }}">Editer</a> <a class="btn btn-primary"href="{{ path('language_debug', {'id': language.id}) }}">Voir</a>
</div> </div>
</div> </div>
</div> </div>
......
...@@ -16,13 +16,19 @@ ...@@ -16,13 +16,19 @@
<div class="card"> <div class="card">
<div class="card-body"> <div class="card-body">
<ul class="list-group mb-2"> <ul class="list-group mb-2">
<li class="list-group-item list-group-item-secondary">Stats</li> <li class="list-group-item list-group-item-secondary">Stats</li>
<li class="list-group-item">{{letters|length}} lettres (
{% for letter in letters %}
<strong>{{letter.value}}</strong> -
{% endfor %}
)</li>
<li class="list-group-item">{{countGrids}} grilles</li> <li class="list-group-item">{{countGrids}} grilles</li>
<li class="list-group-item">{{countWords}} words</li>
<li class="list-group-item">{{countRoots}} roots</li>
<li class="list-group-item">{{countWordStarts}} wordstarts</li>
</ul> </ul>
<ul class="list-group mb-2"> <ul class="list-group mb-2">
<li class="list-group-item list-group-item-secondary">Meilleures grilles</li> <li class="list-group-item list-group-item-secondary">Meilleures grilles</li>
{% for grid in bestGrids %} {% for grid in bestGrids %}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment