mirror of
https://gitlab.com/soapbox-pub/ditto.git
synced 2025-12-06 11:29:46 +00:00
refreshAuthorStats: return the stats
This commit is contained in:
parent
6995bd2b29
commit
ae9516b445
1 changed files with 3 additions and 1 deletions
|
|
@ -218,7 +218,7 @@ function getFollowDiff(event: NostrEvent, prev?: NostrEvent): AuthorStatDiff[] {
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Refresh the author's stats in the database. */
|
/** Refresh the author's stats in the database. */
|
||||||
async function refreshAuthorStats(pubkey: string): Promise<void> {
|
async function refreshAuthorStats(pubkey: string): Promise<DittoTables['author_stats']> {
|
||||||
const store = await Storages.db();
|
const store = await Storages.db();
|
||||||
const stats = await countAuthorStats(store, pubkey);
|
const stats = await countAuthorStats(store, pubkey);
|
||||||
|
|
||||||
|
|
@ -227,6 +227,8 @@ async function refreshAuthorStats(pubkey: string): Promise<void> {
|
||||||
.values(stats)
|
.values(stats)
|
||||||
.onConflict((oc) => oc.column('pubkey').doUpdateSet(stats))
|
.onConflict((oc) => oc.column('pubkey').doUpdateSet(stats))
|
||||||
.execute();
|
.execute();
|
||||||
|
|
||||||
|
return stats;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Calculate author stats from the database. */
|
/** Calculate author stats from the database. */
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue