🎨 Adjust post shuffle query
This commit is contained in:
@@ -106,10 +106,9 @@ public class PostController(
|
|||||||
var totalCount = await query
|
var totalCount = await query
|
||||||
.CountAsync();
|
.CountAsync();
|
||||||
|
|
||||||
if (shuffle)
|
query = shuffle
|
||||||
query = query.OrderBy(e => EF.Functions.Random());
|
? query.OrderBy(e => EF.Functions.Random())
|
||||||
else
|
: query.OrderByDescending(e => e.PublishedAt ?? e.CreatedAt);
|
||||||
query = query.OrderByDescending(e => e.PublishedAt ?? e.CreatedAt);
|
|
||||||
|
|
||||||
var posts = await query
|
var posts = await query
|
||||||
.Include(e => e.RepliedPost)
|
.Include(e => e.RepliedPost)
|
||||||
|
Reference in New Issue
Block a user