Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Mathieu Loiseau
MagicWord
Commits
573622c4
Commit
573622c4
authored
May 28, 2019
by
Arnaud Bey
Browse files
add some infos on debug page
parent
5eb225a3
Changes
6
Hide whitespace changes
Inline
Side-by-side
application/src/LexiconBundle/Repository/RootRepository.php
View file @
573622c4
...
...
@@ -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
)
{
$em
=
$this
->
_em
;
...
...
application/src/LexiconBundle/Repository/WordRepository.php
View file @
573622c4
...
...
@@ -51,4 +51,16 @@ class WordRepository extends \Doctrine\ORM\EntityRepository
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
();
}
}
application/src/LexiconBundle/Repository/WordStartRepository.php
View file @
573622c4
...
...
@@ -3,6 +3,7 @@
namespace
LexiconBundle\Repository
;
use
LexiconBundle\Entity\WordStart
;
use
LexiconBundle\Entity\Language
;
use
Doctrine\Bundle\DoctrineBundle\Repository\ServiceEntityRepository
;
use
Symfony\Bridge\Doctrine\RegistryInterface
;
...
...
@@ -32,4 +33,16 @@ class WordStartRepository extends \Doctrine\ORM\EntityRepository
->
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
();
}
}
application/src/MagicWordBundle/Controller/AdministrationController.php
View file @
573622c4
...
...
@@ -4,6 +4,9 @@ namespace MagicWordBundle\Controller;
use
LexiconBundle\Entity\Language
;
use
LexiconBundle\Entity\Letter
;
use
LexiconBundle\Entity\Root
;
use
LexiconBundle\Entity\Word
;
use
LexiconBundle\Entity\WordStart
;
use
MagicWordBundle\Entity\Grid
;
use
MagicWordBundle\Entity\Rules\ComboPoints
;
use
MagicWordBundle\Entity\Rules\WordLength
;
...
...
@@ -50,12 +53,20 @@ class AdministrationController extends Controller
$bestGrids
=
$this
->
getDoctrine
()
->
getRepository
(
Grid
::
class
)
->
getBestByLanguage
(
$language
);
$worstGrids
=
$this
->
getDoctrine
()
->
getRepository
(
Grid
::
class
)
->
getWorstByLanguage
(
$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'
,
[
'language'
=>
$language
,
'bestGrids'
=>
$bestGrids
,
'worstGrids'
=>
$worstGrids
,
'countGrids'
=>
$countGrids
'countGrids'
=>
$countGrids
,
'countWords'
=>
$countWords
,
'countWordStarts'
=>
$countWordStarts
,
'countRoots'
=>
$countRoots
,
'letters'
=>
$letters
]);
}
...
...
application/src/MagicWordBundle/Resources/views/Administration/index-language.html.twig
View file @
573622c4
...
...
@@ -77,7 +77,7 @@
<p>
Blabla labla Blab laBlabla BlablaBlabla Blabla Blabla
</p>
<a
class=
"btn btn-primary"
href=
"
{{
path
(
'language_debug'
,
{
'id'
:
language.id
}
)
}}
"
>
Edite
r
</a>
<a
class=
"btn btn-primary"
href=
"
{{
path
(
'language_debug'
,
{
'id'
:
language.id
}
)
}}
"
>
Voi
r
</a>
</div>
</div>
</div>
...
...
application/src/MagicWordBundle/Resources/views/Administration/language-debug.html.twig
View file @
573622c4
...
...
@@ -16,13 +16,19 @@
<div
class=
"card"
>
<div
class=
"card-body"
>
<ul
class=
"list-group mb-2"
>
<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"
>
{{
countWords
}}
words
</li>
<li
class=
"list-group-item"
>
{{
countRoots
}}
roots
</li>
<li
class=
"list-group-item"
>
{{
countWordStarts
}}
wordstarts
</li>
</ul>
<ul
class=
"list-group mb-2"
>
<li
class=
"list-group-item list-group-item-secondary"
>
Meilleures grilles
</li>
{%
for
grid
in
bestGrids
%}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment