stats: fix queries getting stuck

This commit is contained in:
Alex Gleason
2023-12-10 15:33:01 -06:00
parent 6a92c5135d
commit a48c1e51e1
2 changed files with 13 additions and 11 deletions

View File

@@ -171,7 +171,7 @@ function getFilterQuery(filter: DittoFilter): EventQuery {
return exp
.orderBy('created_at', 'desc')
.groupBy('pubkey')
.groupBy('events.pubkey')
.as('authors');
},
(join) => join.onRef('authors.pubkey', '=', 'events.pubkey'),
@@ -184,9 +184,13 @@ function getFilterQuery(filter: DittoFilter): EventQuery {
'authors.tags as author_tags',
'authors.created_at as author_created_at',
'authors.sig as author_sig',
'authors.author_stats_followers_count',
'authors.author_stats_following_count',
'authors.author_stats_notes_count',
...(filter.relations?.includes('stats')
? [
'authors.author_stats_followers_count',
'authors.author_stats_following_count',
'authors.author_stats_notes_count',
] as const
: []),
]);
}