[backend/core] Fix note counter recomputation query

This commit is contained in:
Laura Hausmann 2024-02-29 20:36:27 +01:00
parent 52519f3b69
commit 06a2e0705a
No known key found for this signature in database
GPG key ID: D044E84C5BE01605

View file

@ -8,7 +8,7 @@ public class DatabaseMaintenanceService(DatabaseContext db)
public async Task RecomputeNoteCountersAsync()
{
await db.Notes.ExecuteUpdateAsync(p => p.SetProperty(n => n.RenoteCount,
n => db.Notes.Count(r => r.IsPureRenote))
n => db.Notes.Count(r => r.IsPureRenote && r.Renote == n))
.SetProperty(n => n.RepliesCount,
n => db.Notes.Count(r => r.Reply == n)));
//TODO: update reaction counts as well? (can likely not be done database-side :/)