[backend/database] Fix heuristics query when no notes are in the database (ISH-81)

This commit is contained in:
Laura Hausmann 2024-02-17 16:44:47 +01:00
parent 7d55cbe25a
commit 8525ee5d0c
No known key found for this signature in database
GPG key ID: D044E84C5BE01605

View file

@ -96,7 +96,7 @@ public static class QueryableExtensions
{
var lastDate = await db.Notes.AnyAsync()
? 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) &&
(p.User.IsFollowedBy(user) || p.User == user));