mirror of
https://github.com/MarijnDoeve/TijdVoorDeTest.git
synced 2026-03-05 20:44:19 +01:00
- Refactor ORM annotations across entities for consistency.
- Adjusted migrations to align with refactored ORM annotations. - Added new PHPStan and PHP-CS-Fixer configurations, including stricter rules. - Introduced `tests/object-manager.php` to improve test environment setup.
This commit is contained in:
@@ -38,7 +38,7 @@ class CandidateRepository extends ServiceEntityRepository
|
||||
select c from Tvdt\Entity\Candidate c
|
||||
where c.season = :season
|
||||
and lower(c.name) = lower(:name)
|
||||
DQL
|
||||
DQL
|
||||
)->setParameter('season', $season)
|
||||
->setParameter('name', $name)
|
||||
->getOneOrNullResult();
|
||||
@@ -57,21 +57,21 @@ class CandidateRepository extends ServiceEntityRepository
|
||||
public function getScores(Quiz $quiz): array
|
||||
{
|
||||
return $this->getEntityManager()->createQuery(<<<DQL
|
||||
select
|
||||
c.id,
|
||||
c.name,
|
||||
sum(case when a.isRightAnswer = true then 1 else 0 end) as correct,
|
||||
qc.corrections,
|
||||
max(ga.created) - qc.created as time,
|
||||
(sum(case when a.isRightAnswer = true then 1 else 0 end) + qc.corrections) as score
|
||||
from Tvdt\Entity\Candidate c
|
||||
join c.givenAnswers ga
|
||||
join ga.answer a
|
||||
join c.quizData qc
|
||||
where qc.quiz = :quiz and ga.quiz = :quiz
|
||||
group by ga.quiz, c.id, qc.id
|
||||
order by score desc, time asc
|
||||
DQL
|
||||
select
|
||||
c.id,
|
||||
c.name,
|
||||
count(case when a.isRightAnswer = true then 1 else null end) as correct,
|
||||
qc.corrections,
|
||||
max(ga.created) - qc.created as time,
|
||||
(count(case when a.isRightAnswer = true then 1 else null end) + qc.corrections) as score
|
||||
from Tvdt\Entity\Candidate c
|
||||
join c.givenAnswers ga
|
||||
join ga.answer a
|
||||
join c.quizData qc
|
||||
where qc.quiz = :quiz and ga.quiz = :quiz
|
||||
group by ga.quiz, c.id, qc.id
|
||||
order by score desc, time asc
|
||||
DQL
|
||||
)->setParameter('quiz', $quiz)->getResult();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -32,7 +32,7 @@ class QuestionRepository extends ServiceEntityRepository
|
||||
and q1.quiz = :quiz
|
||||
)
|
||||
and qz = :quiz
|
||||
DQL)
|
||||
DQL)
|
||||
->setMaxResults(1)
|
||||
->setParameter('candidate', $candidate)
|
||||
->setParameter('quiz', $candidate->getSeason()->getActiveQuiz())
|
||||
|
||||
@@ -24,7 +24,7 @@ class SeasonRepository extends ServiceEntityRepository
|
||||
{
|
||||
return $this->getEntityManager()->createQuery(<<<DQL
|
||||
select s from Tvdt\Entity\Season s where :user member of s.owners order by s.name
|
||||
DQL
|
||||
DQL
|
||||
)->setParameter('user', $user)->getResult();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user