Created methods to get orphan visits lists

This commit is contained in:
Alejandro Celaya
2021-02-09 21:22:36 +01:00
parent 1fbcb44136
commit 85dd023c0e
7 changed files with 173 additions and 30 deletions

View File

@@ -7,11 +7,24 @@ namespace Shlinkio\Shlink\Core\Visit\Spec;
use Happyr\DoctrineSpecification\BaseSpecification;
use Happyr\DoctrineSpecification\Spec;
use Happyr\DoctrineSpecification\Specification\Specification;
use Shlinkio\Shlink\Common\Util\DateRange;
use Shlinkio\Shlink\Core\Spec\InDateRange;
class CountOfOrphanVisits extends BaseSpecification
{
private ?DateRange $dateRange;
public function __construct(?DateRange $dateRange)
{
parent::__construct();
$this->dateRange = $dateRange;
}
protected function getSpec(): Specification
{
return Spec::countOf(Spec::isNull('shortUrl'));
return Spec::countOf(Spec::andX(
Spec::isNull('shortUrl'),
new InDateRange($this->dateRange),
));
}
}