@@ -66,6 +66,7 @@ public function __construct($entityManager, $user)
6666
6767 $ this ->oneMonthAgo = (new \DateTime ())->modify ('-1 month ' );
6868 $ this ->oneWeekAgo = (new \DateTime ())->modify ('-7 days ' );
69+ $ this ->today = (new \DateTime ())->modify ('today ' );
6970 }
7071
7172 public function action ($ action , $ data = [])
@@ -1662,6 +1663,9 @@ function getGenerativeAssetsByFilters($filter = null, $page = 1, $limit = 20, $r
16621663
16631664 $ publicGenerativeAssets = null ;
16641665 switch ($ filter ) {
1666+ case 'most-popular-today ' :
1667+ $ publicGenerativeAssets = $ repository ->getAllMostPopularByCreatedAt ($ this ->today , $ limit , $ offset );
1668+ break ;
16651669 case 'most-recent ' :
16661670 $ publicGenerativeAssets = $ repository ->findBy (['isPublic ' => true ], ['createdAt ' => 'DESC ' ], $ limit , $ offset );
16671671 break ;
@@ -1689,6 +1693,7 @@ function getMyGenerativeAssetsByFilters($filter = null, $page = 1, $limit = 20,
16891693 $ offset = ($ page - 1 ) * $ limit ;
16901694 $ publicGenerativeAssets = null ;
16911695 switch ($ filter ) {
1696+
16921697 case 'most-recent ' :
16931698 $ publicGenerativeAssets = $ this ->entityManager ->getRepository (GenerativeAssets::class)->findBy (['user ' => $ user ], ['createdAt ' => 'DESC ' ], $ limit , $ offset );
16941699 break ;
@@ -1701,6 +1706,9 @@ function getMyGenerativeAssetsByFilters($filter = null, $page = 1, $limit = 20,
17011706 case 'most-popular-month ' :
17021707 $ publicGenerativeAssets = $ this ->entityManager ->getRepository (GenerativeAssets::class)->getMyMostPopularByCreatedAt ($ this ->oneMonthAgo , $ limit , $ offset , $ user );
17031708 break ;
1709+ case 'most-popular-today ' :
1710+ $ publicGenerativeAssets = $ this ->entityManager ->getRepository (GenerativeAssets::class)->getMyMostPopularByCreatedAt ($ this ->today , $ limit , $ offset , $ user );
1711+ break ;
17041712 default :
17051713 $ publicGenerativeAssets = $ this ->entityManager ->getRepository (GenerativeAssets::class)->findBy (['user ' => $ user ], ['createdAt ' => 'DESC ' ], $ limit , $ offset );
17061714 break ;
@@ -1723,6 +1731,7 @@ function getCountGenerativeAssetsByFilters($filter = null, $repository, $mine =
17231731 {
17241732 $ count = 0 ;
17251733 switch ($ filter ) {
1734+
17261735 case 'most-recent ' :
17271736 $ count = $ repository ->getCountAll (false , false , $ mine , $ user , $ isPublic );
17281737 break ;
@@ -1735,6 +1744,9 @@ function getCountGenerativeAssetsByFilters($filter = null, $repository, $mine =
17351744 case 'most-popular-month ' :
17361745 $ count = $ repository ->getCountAllMostPopularByCreatedAt ($ this ->oneMonthAgo , $ mine , $ user , $ isPublic );
17371746 break ;
1747+ case 'most-popular-today ' :
1748+ $ count = $ repository ->getCountAllMostPopularByCreatedAt ($ this ->today , $ mine , $ user , $ isPublic );
1749+ break ;
17381750 default :
17391751 $ count = $ repository ->getCountAll (false , false , $ mine , $ user , $ isPublic );
17401752 break ;
@@ -1762,6 +1774,7 @@ function getMyFavoriteGenerativeAssetsByFilters($filter = null, $page = 1, $limi
17621774 }
17631775
17641776 switch ($ filter ) {
1777+
17651778 case 'most-recent ' :
17661779 //$likedImages = $this->processReturnFromFavorite($repository->getMyFavoriteSince($user, null, $limit, $offset));
17671780 $ likedImages = $ this ->entityManager ->getRepository (GenerativeAssets::class)->getAllMostPopularSinceFromArray ($ limit , $ offset , $ ids , null );
@@ -1777,6 +1790,9 @@ function getMyFavoriteGenerativeAssetsByFilters($filter = null, $page = 1, $limi
17771790 /* $likedImages = $this->processReturnFromFavorite($repository->getMyFavoriteSince($user, $this->oneMonthAgo, $limit, $offset)); */
17781791 $ likedImages = $ this ->entityManager ->getRepository (GenerativeAssets::class)->getAllMostPopularSinceFromArray ($ limit , $ offset , $ ids , $ this ->oneMonthAgo );
17791792 break ;
1793+ case 'most-popular-today ' :
1794+ $ likedImages = $ this ->entityManager ->getRepository (GenerativeAssets::class)->getAllMostPopularSinceFromArray ($ limit , $ offset , $ ids , $ this ->today );
1795+ break ;
17801796 default :
17811797 $ likedImages = $ this ->entityManager ->getRepository (GenerativeAssets::class)->getAllMostPopularSinceFromArray ($ limit , $ offset , $ ids , null );
17821798 break ;
0 commit comments