2018-11-05 15:24:41 +00:00
|
|
|
package main
|
|
|
|
|
|
|
|
import (
|
|
|
|
"github.com/animenotifier/arn"
|
2019-03-30 06:39:40 +00:00
|
|
|
"github.com/blitzprog/color"
|
2018-11-05 15:24:41 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
func main() {
|
|
|
|
color.Yellow("Sorting posts by date")
|
|
|
|
|
|
|
|
defer color.Green("Finished.")
|
|
|
|
defer arn.Node.Close()
|
|
|
|
|
|
|
|
for thread := range arn.StreamThreads() {
|
|
|
|
posts := thread.Posts()
|
|
|
|
arn.SortPostsLatestLast(posts)
|
|
|
|
postIDs := []string{}
|
|
|
|
|
|
|
|
for _, post := range posts {
|
|
|
|
postIDs = append(postIDs, post.ID)
|
|
|
|
}
|
|
|
|
|
|
|
|
thread.PostIDs = postIDs
|
|
|
|
thread.Save()
|
|
|
|
}
|
|
|
|
}
|