fix: improve some database queries
This commit is contained in:
@@ -3,7 +3,6 @@
|
||||
namespace App\Controller\Administrative\Document;
|
||||
|
||||
use App\Entity\Upload;
|
||||
use App\Model\DocumentFilterDto;
|
||||
use App\Repository\UploadRepository;
|
||||
use App\Service\Common\DocumentFilterHandler;
|
||||
use Knp\Component\Pager\PaginatorInterface;
|
||||
@@ -72,4 +71,4 @@ class IndexController extends AbstractController
|
||||
'status' => $status,
|
||||
]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -31,11 +31,12 @@ class ApplicationRepository extends ServiceEntityRepository
|
||||
$qb = $this->createQueryBuilder('application');
|
||||
|
||||
$qb
|
||||
->select('application', 'assignment', 'destination', 'job_profile', 'teamer')
|
||||
->select('application', 'assignment', 'job_profile', 'destination', 'teamer', 'user')
|
||||
->innerJoin('application.assignment', 'assignment')
|
||||
->innerJoin('assignment.destination', 'destination')
|
||||
->innerJoin('assignment.jobProfile', 'job_profile')
|
||||
->innerJoin('application.teamer', 'teamer')
|
||||
->innerJoin('teamer.user', 'user')
|
||||
->where($qb->expr()->neq('application.status', ':status'))
|
||||
->setParameter('status', Application::STATUS_REJECTED)
|
||||
;
|
||||
@@ -159,11 +160,12 @@ class ApplicationRepository extends ServiceEntityRepository
|
||||
$qb = $this->createQueryBuilder('application');
|
||||
|
||||
return $qb
|
||||
->select('application', 'assignment', 'destination', 'job_profile', 'teamer')
|
||||
->select('application', 'assignment', 'destination', 'job_profile', 'teamer', 'user')
|
||||
->innerJoin('application.assignment', 'assignment')
|
||||
->innerJoin('assignment.destination', 'destination')
|
||||
->innerJoin('assignment.jobProfile', 'job_profile')
|
||||
->innerJoin('application.teamer', 'teamer')
|
||||
->innerJoin('teamer.user', 'user')
|
||||
->where($qb->expr()->neq('application.status', ':status'))
|
||||
->orderBy('application.createdAt', 'DESC')
|
||||
->setParameter('status', Application::STATUS_REJECTED)
|
||||
|
||||
@@ -155,8 +155,9 @@ class DispositionRepository extends ServiceEntityRepository
|
||||
$qb = $this->createQueryBuilder('disposition');
|
||||
|
||||
return $qb
|
||||
->select('disposition', 'assignment', 'destination')
|
||||
->select('disposition', 'assignment', 'job_profile', 'destination')
|
||||
->innerJoin('disposition.assignment', 'assignment')
|
||||
->innerJoin('assignment.jobProfile', 'job_profile')
|
||||
->innerJoin('assignment.destination', 'destination')
|
||||
->where($qb->expr()->andX(
|
||||
$qb->expr()->orX(
|
||||
@@ -182,9 +183,11 @@ class DispositionRepository extends ServiceEntityRepository
|
||||
$qb = $this->createQueryBuilder('disposition');
|
||||
|
||||
$qb
|
||||
->select('disposition', 'assignment', 'destination', 'feedback', 'teamer')
|
||||
->select('disposition', 'assignment', 'job_profile', 'destination', 'feedback', 'teamer', 'user')
|
||||
->innerJoin('disposition.assignment', 'assignment')
|
||||
->innerJoin('assignment.jobProfile', 'job_profile')
|
||||
->innerJoin('disposition.teamer', 'teamer')
|
||||
->innerJoin('teamer.user', 'user')
|
||||
->innerJoin('assignment.destination', 'destination')
|
||||
->leftJoin('disposition.feedback', 'feedback')
|
||||
->where($qb->expr()->andX(
|
||||
@@ -292,10 +295,13 @@ class DispositionRepository extends ServiceEntityRepository
|
||||
$qb = $this->createQueryBuilder('disposition');
|
||||
|
||||
return $qb
|
||||
->select('disposition', 'assignment', 'destination', 'document')
|
||||
->select('disposition', 'assignment', 'job_profile', 'destination', 'document', 'teamer', 'user')
|
||||
->innerJoin('disposition.assignment', 'assignment')
|
||||
->innerJoin('assignment.jobProfile', 'job_profile')
|
||||
->innerJoin('assignment.destination', 'destination')
|
||||
->leftJoin('disposition.documents', 'document')
|
||||
->innerJoin('disposition.teamer', 'teamer')
|
||||
->innerJoin('teamer.user', 'user')
|
||||
->where($qb->expr()->andX(
|
||||
$qb->expr()->lte('disposition.createdAt', ':dueDate'),
|
||||
$qb->expr()->eq('disposition.status', ':status'),
|
||||
|
||||
@@ -32,8 +32,9 @@ class FeedbackRepository extends ServiceEntityRepository
|
||||
$qb = $this->createQueryBuilder('feedback');
|
||||
|
||||
$qb
|
||||
->select('feedback', 'teamer')
|
||||
->select('feedback', 'teamer', 'user')
|
||||
->innerJoin('feedback.teamer', 'teamer')
|
||||
->innerJoin('teamer.user', 'user')
|
||||
;
|
||||
|
||||
if (null !== $name = $filterDto->getName()) {
|
||||
@@ -73,8 +74,9 @@ class FeedbackRepository extends ServiceEntityRepository
|
||||
$qb = $this->createQueryBuilder('feedback');
|
||||
|
||||
return $qb
|
||||
->select('feedback', 'teamer')
|
||||
->select('feedback', 'teamer', 'user')
|
||||
->innerJoin('feedback.teamer', 'teamer')
|
||||
->innerJoin('teamer.user', 'user')
|
||||
->where($qb->expr()->eq('feedback.status', ':status'))
|
||||
->setParameter('status', Feedback::STATUS_NEW)
|
||||
->orderBy('feedback.createdAt', 'DESC')
|
||||
|
||||
@@ -87,12 +87,13 @@ class UploadRepository extends ServiceEntityRepository
|
||||
$qb = $this->createQueryBuilder('upload');
|
||||
|
||||
return $qb
|
||||
->select('upload', 'disposition', 'assignment', 'job_profile', 'destination', 'teamer')
|
||||
->select('upload', 'disposition', 'assignment', 'job_profile', 'destination', 'teamer', 'user')
|
||||
->innerJoin('upload.disposition', 'disposition')
|
||||
->innerJoin('disposition.assignment', 'assignment')
|
||||
->innerJoin('assignment.jobProfile', 'job_profile')
|
||||
->innerJoin('assignment.destination', 'destination')
|
||||
->innerJoin('disposition.teamer', 'teamer')
|
||||
->innerJoin('teamer.user', 'user')
|
||||
->where($qb->expr()->andX(
|
||||
$qb->expr()->eq('upload.type', ':type'),
|
||||
$qb->expr()->eq('upload.status', ':status'),
|
||||
@@ -120,12 +121,13 @@ class UploadRepository extends ServiceEntityRepository
|
||||
$qb = $this->createQueryBuilder('upload');
|
||||
|
||||
$qb
|
||||
->select('upload', 'disposition', 'assignment', 'job_profile', 'destination', 'teamer')
|
||||
->select('upload', 'disposition', 'assignment', 'job_profile', 'destination', 'teamer', 'user')
|
||||
->innerJoin('upload.disposition', 'disposition')
|
||||
->innerJoin('disposition.assignment', 'assignment')
|
||||
->innerJoin('assignment.jobProfile', 'job_profile')
|
||||
->innerJoin('assignment.destination', 'destination')
|
||||
->innerJoin('disposition.teamer', 'teamer')
|
||||
->innerJoin('teamer.user', 'user')
|
||||
->addOrderBy('FIELD(upload.status, :checked, :new)', 'DESC')
|
||||
->setParameter('new', Upload::STATUS_NEW)
|
||||
->setParameter('checked', Upload::STATUS_CHECKED)
|
||||
@@ -188,9 +190,10 @@ class UploadRepository extends ServiceEntityRepository
|
||||
$qb = $this->createQueryBuilder('upload');
|
||||
|
||||
return $qb
|
||||
->select('upload', 'owner', 'teamer', 'disposition', 'assignment')
|
||||
->select('upload', 'owner', 'teamer', 'user', 'disposition', 'assignment')
|
||||
->innerJoin('upload.owner', 'owner')
|
||||
->innerJoin('owner.teamer', 'teamer')
|
||||
->innerJoin('teamer.user', 'user')
|
||||
->leftJoin('upload.disposition', 'disposition')
|
||||
->leftJoin('disposition.assignment', 'assignment')
|
||||
->where($qb->expr()->andX(
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
|
||||
{% block content %}
|
||||
<div class="grid grid-cols-1 lg:grid-cols-2 gap-8">
|
||||
|
||||
<div class="bg-gray-100 border border-gray-200 rounded-md px-4 py-2">
|
||||
<h2 class="flex justify-between pb-2">
|
||||
<span class="font-bold text-lg">Neue Bewerbungen</span>
|
||||
@@ -31,6 +32,7 @@
|
||||
{% endfor %}
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
<div class="bg-gray-100 border border-gray-200 rounded-md px-4 py-2">
|
||||
<h2 class="font-bold text-lg pb-2">
|
||||
Neue Einteilungen
|
||||
@@ -51,6 +53,7 @@
|
||||
{% endfor %}
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
<div class="bg-gray-100 border border-gray-200 rounded-md px-4 py-2">
|
||||
<h2 class="flex justify-between pb-2">
|
||||
<span class="font-bold text-lg">Neue Honorarverträge</span>
|
||||
@@ -84,6 +87,7 @@
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="bg-gray-100 border border-gray-200 rounded-md px-4 py-2">
|
||||
<h2 class="flex justify-between pb-2">
|
||||
<span class="font-bold text-lg">Neue Honorarnoten</span>
|
||||
@@ -116,6 +120,7 @@
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="bg-gray-100 border border-gray-200 rounded-md px-4 py-2">
|
||||
<h2 class="font-bold text-lg pb-2">
|
||||
Neue Einsätze
|
||||
@@ -140,6 +145,7 @@
|
||||
{% endfor %}
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
<div class="bg-gray-100 border border-gray-200 rounded-md px-4 py-2">
|
||||
<h2 class="font-bold text-lg pb-2">
|
||||
Neue Verfügbarkeiten
|
||||
@@ -162,6 +168,7 @@
|
||||
{% endfor %}
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
<div class="bg-gray-100 border border-gray-200 rounded-md px-4 py-2">
|
||||
<h2 class="flex justify-between pb-2">
|
||||
<span class="font-bold text-lg">Neue Feedbacks</span>
|
||||
@@ -195,6 +202,7 @@
|
||||
{% endfor %}
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
{% set overdueFeedbacksCount = overdueFeedbacks|length %}
|
||||
<div class="bg-gray-100 border border-gray-200 rounded-md px-4 py-2">
|
||||
<h2 class="flex justify-between pb-2">
|
||||
@@ -230,6 +238,7 @@
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{% set overdueContractsCount = overdueContracts|length %}
|
||||
<div class="bg-gray-100 border border-gray-200 rounded-md px-4 py-2">
|
||||
<h2 class="flex justify-between pb-2">
|
||||
@@ -261,5 +270,6 @@
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
{% endblock %}
|
||||
|
||||
Reference in New Issue
Block a user