PHRAS-3738 Admin - worker - job tab - add filter on databox_id (name),record_id (#4132)

* add databox and record id filter

* add entry count

* generate translation

* fix retrieve count in DB

* change string position
This commit is contained in:
Aina Sitraka
2022-09-16 11:18:07 +03:00
committed by GitHub
parent 6fa89c5bf8
commit 2d71cffe46
11 changed files with 458 additions and 298 deletions

View File

@@ -379,7 +379,7 @@ class WorkerRunningJobRepository extends EntityRepository
return count($qb->getQuery()->getResult());
}
public function findByStatusAndJob(array $status, $jobType, $start = 0, $limit = WorkerRunningJob::MAX_RESULT)
public function findByFilter(array $status, $jobType, $databoxId, $recordId, $start = 0, $limit = WorkerRunningJob::MAX_RESULT)
{
$qb = $this->createQueryBuilder('w');
@@ -392,15 +392,56 @@ class WorkerRunningJobRepository extends EntityRepository
->setParameter('work', $jobType);
}
if (!empty($databoxId)) {
$qb->andWhere('w.databoxId = :databoxId')
->setParameter('databoxId', $databoxId);
}
if (!empty($recordId)) {
$qb->andWhere('w.recordId = :recordId')
->setParameter('recordId', $recordId);
}
if ($limit !== null) {
$qb->setMaxResults($limit);
}
$qb
->setFirstResult($start)
->setMaxResults($limit)
->orderBy('w.id', 'DESC')
;
return $qb->getQuery()->getResult();
}
public function getJobCount(array $status, $jobType, $databoxId, $recordId)
{
$qb = $this->createQueryBuilder('w');
$qb->select('count(w)');
if (!empty($status)) {
$qb->where($qb->expr()->in('w.status', $status));
}
if (!empty($jobType)) {
$qb->andWhere('w.work = :work')
->setParameter('work', $jobType);
}
if (!empty($databoxId)) {
$qb->andWhere('w.databoxId = :databoxId')
->setParameter('databoxId', $databoxId);
}
if (!empty($recordId)) {
$qb->andWhere('w.recordId = :recordId')
->setParameter('recordId', $recordId);
}
return $qb->getQuery()->getSingleScalarResult();
}
public function updateStatusRunningToCanceledSinceCreated($hour = 0)
{
$sql = '