[backend/database] Fix heuristics query when no notes are in the database (ISH-81)
This commit is contained in:
parent
7d55cbe25a
commit
8525ee5d0c
1 changed files with 1 additions and 1 deletions
|
@ -96,7 +96,7 @@ public static class QueryableExtensions
|
||||||
{
|
{
|
||||||
var lastDate = await db.Notes.AnyAsync()
|
var lastDate = await db.Notes.AnyAsync()
|
||||||
? await db.Notes.OrderByDescending(p => p.Id).Select(p => p.CreatedAt).FirstOrDefaultAsync()
|
? await db.Notes.OrderByDescending(p => p.Id).Select(p => p.CreatedAt).FirstOrDefaultAsync()
|
||||||
: DateTime.Now;
|
: DateTime.UtcNow;
|
||||||
|
|
||||||
return await db.Notes.CountAsync(p => p.CreatedAt > lastDate - TimeSpan.FromDays(7) &&
|
return await db.Notes.CountAsync(p => p.CreatedAt > lastDate - TimeSpan.FromDays(7) &&
|
||||||
(p.User.IsFollowedBy(user) || p.User == user));
|
(p.User.IsFollowedBy(user) || p.User == user));
|
||||||
|
|
Loading…
Add table
Reference in a new issue