Release 2.0.35 (#4302)

This commit is contained in:
Kevin Papst
2023-09-23 18:15:22 +02:00
committed by GitHub
parent de419350b2
commit 7a5b12762a
122 changed files with 1555 additions and 2054 deletions

View File

@@ -21,6 +21,8 @@ use App\Repository\TimesheetRepository;
*/
final class FavoriteRecordService
{
public const MAX_FAVORITES = 5;
public function __construct(private TimesheetRepository $repository, private BookmarkRepository $bookmarkRepository)
{
}
@@ -35,7 +37,7 @@ final class FavoriteRecordService
/** @var array<int> $favIds */
$favIds = $this->getBookmark($user)->getContent();
$recentIds = [];
if (\count($favIds) < 5) {
if (\count($favIds) < $limit) {
$recentIds = $this->repository->getRecentActivityIds($user, null, $limit);
}
/** @var array<int> $ids */
@@ -98,7 +100,7 @@ final class FavoriteRecordService
return;
}
if (\count($ids) >= 5) {
if (\count($ids) >= self::MAX_FAVORITES) {
array_pop($ids); // remove the last element and make space for a new id
}
array_unshift($ids, $timesheet->getId());