👔 Update the algorithm to pick featured post
This commit is contained in:
@@ -770,7 +770,6 @@ public partial class PostService(
|
|||||||
var reactSocialPoints = await db.PostReactions
|
var reactSocialPoints = await db.PostReactions
|
||||||
.Include(e => e.Post)
|
.Include(e => e.Post)
|
||||||
.Where(e => e.Post.Visibility == PostVisibility.Public)
|
.Where(e => e.Post.Visibility == PostVisibility.Public)
|
||||||
.Where(e => e.CreatedAt >= periodStart && e.CreatedAt < periodEnd)
|
|
||||||
.Where(e => e.Post.CreatedAt >= periodStart && e.Post.CreatedAt < periodEnd)
|
.Where(e => e.Post.CreatedAt >= periodStart && e.Post.CreatedAt < periodEnd)
|
||||||
.GroupBy(e => e.PostId)
|
.GroupBy(e => e.PostId)
|
||||||
.Select(e => new
|
.Select(e => new
|
||||||
@@ -784,7 +783,7 @@ public partial class PostService(
|
|||||||
|
|
||||||
featuredIds = reactSocialPoints.Select(e => e.Key).ToList();
|
featuredIds = reactSocialPoints.Select(e => e.Key).ToList();
|
||||||
|
|
||||||
await cache.SetAsync(FeaturedPostCacheKey, featuredIds, TimeSpan.FromHours(24));
|
await cache.SetAsync(FeaturedPostCacheKey, featuredIds, TimeSpan.FromHours(4));
|
||||||
|
|
||||||
// Create featured record
|
// Create featured record
|
||||||
var existingFeaturedPostIds = await db.PostFeaturedRecords
|
var existingFeaturedPostIds = await db.PostFeaturedRecords
|
||||||
|
Reference in New Issue
Block a user