Unverified Commit ca7d07fa authored by Sebastian Castro's avatar Sebastian Castro
Browse files

Detect duplicate only on visible elements

parent f2912aee
......@@ -72,7 +72,7 @@ final class RemoveAbandonnerProjectsCommand extends GoGoAbstractCommand
$message = "Les projets suivants sont probablement à supprimer : ";
foreach ($projectsToDelete as $project) {
$url = $this->generateUrlForProject($project);
$message .= '<li><a href="' . $url .'">' . $project->getName() .' / Nombre de points : ' . $project->getDataSize() .'</li>';
$message .= '<li><a href="' . $url .'">' . $project->getName() .' / Nombre de points : ' . $project->getDataSize() .'</a></li>';
$project->setWarningToDeleteProjectSentAt(time());
}
......
......@@ -29,7 +29,7 @@ class BulkActionsAbstractController extends Controller
$batchFromStep = 0;
}
$count = $elementRepo->findAllElements(null, $batchFromStep, true);
$count = $elementRepo->findVisibles(true, false, null, $batchFromStep);
$elementsToProcceedCount = 0;
if ($count > $this->batchSize) {
$batchLastStep = $batchFromStep + $this->batchSize;
......@@ -39,7 +39,7 @@ class BulkActionsAbstractController extends Controller
$batchLastStep = $batchFromStep + $count;
}
$elements = $elementRepo->findAllElements($this->batchSize, $batchFromStep);
$elements = $elementRepo->findVisibles(false, false, $this->batchSize, $batchFromStep);
$i = 0;
$renderedViews = [];
......
......@@ -147,7 +147,7 @@ class ElementRepository extends DocumentRepository
return $qb->getQuery()->execute();
}
public function findVisibles($getCount = false, $excludeImported = false)
public function findVisibles($getCount = false, $excludeImported = false, $limit = null, $skip = null)
{
$qb = $this->createQueryBuilder('App\Document\Element');
......@@ -155,6 +155,12 @@ class ElementRepository extends DocumentRepository
if ($excludeImported) {
$qb->field('status')->notEqual(ElementStatus::DynamicImport);
}
if ($limit) {
$qb->limit($limit);
}
if ($skip) {
$qb->skip($skip);
}
if ($getCount) {
$qb->count();
}
......
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