Change logic of tags_ids filter from AND to OR

This commit is contained in:
Constantin Graf
2024-11-08 12:11:16 +01:00
committed by Constantin Graf
parent 45daeead61
commit 4b622afcfc
6 changed files with 53 additions and 5 deletions

View File

@@ -133,7 +133,11 @@ class TimeEntryFilter
if ($tagIds === null) {
return $this;
}
$this->builder->whereJsonContains('tags', $tagIds);
$this->builder->where(function (Builder $builder) use ($tagIds): void {
foreach ($tagIds as $tagId) {
$builder->orWhereJsonContains('tags', $tagId);
}
});
return $this;
}