Move engagement calculation inside widget
This commit is contained in:
1 parent
0fbc8dcb41
commit
aef0c84286
2 files changed
+1
-2
No files matched your search
@@ -110,7 +110,5 @@ func FetchSubredditPosts(subreddit, sort, topPeriod, search, commentsUrlTemplate
|
|||||||
posts = append(posts, forumPost)
|
posts = append(posts, forumPost)
|
||||||
}
|
}
|
||||||
|
|
||||||
posts.CalculateEngagement()
|
|
||||||
|
|
||||||
return posts, nil
|
return posts, nil
|
||||||
}
|
}
|
||||||
@@ -95,6 +95,7 @@ func (widget *Reddit) Update(ctx context.Context) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if widget.ExtraSortBy == "engagement" {
|
if widget.ExtraSortBy == "engagement" {
|
||||||
|
posts.CalculateEngagement()
|
||||||
posts.SortByEngagement()
|
posts.SortByEngagement()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user