🐛 Bug fixes on web article
This commit is contained in:
parent
fb8fc69920
commit
71fcc26534
@ -43,17 +43,14 @@ public class ActivityService(
|
|||||||
if (debugInclude.Contains("articles") || Random.Shared.NextDouble() < 0.2)
|
if (debugInclude.Contains("articles") || Random.Shared.NextDouble() < 0.2)
|
||||||
{
|
{
|
||||||
var recentArticlesQuery = db.WebArticles
|
var recentArticlesQuery = db.WebArticles
|
||||||
|
.Include(a => a.Feed)
|
||||||
.Take(20); // Get a larger pool for randomization
|
.Take(20); // Get a larger pool for randomization
|
||||||
|
|
||||||
// Apply random ordering 50% of the time
|
// Apply random ordering 50% of the time
|
||||||
if (Random.Shared.NextDouble() < 0.5)
|
if (Random.Shared.NextDouble() < 0.5)
|
||||||
{
|
|
||||||
recentArticlesQuery = recentArticlesQuery.OrderBy(_ => EF.Functions.Random());
|
recentArticlesQuery = recentArticlesQuery.OrderBy(_ => EF.Functions.Random());
|
||||||
}
|
|
||||||
else
|
else
|
||||||
{
|
|
||||||
recentArticlesQuery = recentArticlesQuery.OrderByDescending(a => a.PublishedAt);
|
recentArticlesQuery = recentArticlesQuery.OrderByDescending(a => a.PublishedAt);
|
||||||
}
|
|
||||||
|
|
||||||
var recentArticles = await recentArticlesQuery.Take(5).ToListAsync();
|
var recentArticles = await recentArticlesQuery.Take(5).ToListAsync();
|
||||||
|
|
||||||
|
@ -8,8 +8,8 @@ public class WebArticle : ModelBase
|
|||||||
{
|
{
|
||||||
public Guid Id { get; set; } = Guid.NewGuid();
|
public Guid Id { get; set; } = Guid.NewGuid();
|
||||||
|
|
||||||
[MaxLength(4096)] public string Title { get; set; }
|
[MaxLength(4096)] public string Title { get; set; } = null!;
|
||||||
[MaxLength(8192)] public string Url { get; set; }
|
[MaxLength(8192)] public string Url { get; set; } = null!;
|
||||||
[MaxLength(4096)] public string? Author { get; set; }
|
[MaxLength(4096)] public string? Author { get; set; }
|
||||||
|
|
||||||
[Column(TypeName = "jsonb")] public Dictionary<string, object>? Meta { get; set; }
|
[Column(TypeName = "jsonb")] public Dictionary<string, object>? Meta { get; set; }
|
||||||
|
Loading…
x
Reference in New Issue
Block a user