Move engagement calculation inside widget

pull/57/head
Svilen Markov 2024-05-12 11:00:45 +07:00
parent 0fbc8dcb41
commit aef0c84286
2 changed files with 1 additions and 2 deletions

@ -110,7 +110,5 @@ func FetchSubredditPosts(subreddit, sort, topPeriod, search, commentsUrlTemplate
posts = append(posts, forumPost)
}
posts.CalculateEngagement()
return posts, nil
}

@ -95,6 +95,7 @@ func (widget *Reddit) Update(ctx context.Context) {
}
if widget.ExtraSortBy == "engagement" {
posts.CalculateEngagement()
posts.SortByEngagement()
}