mirror of
https://github.com/idanoo/go-mastodon-stats
synced 2025-07-01 22:02:20 +00:00
Order by counts
This commit is contained in:
parent
d927f1c5a1
commit
f2c7022469
1 changed files with 10 additions and 2 deletions
|
@ -1,6 +1,9 @@
|
|||
package gomastodonstats
|
||||
|
||||
import "log"
|
||||
import (
|
||||
"log"
|
||||
"sort"
|
||||
)
|
||||
|
||||
func Run() {
|
||||
log.Println("Fetching counts")
|
||||
|
@ -14,7 +17,12 @@ func Run() {
|
|||
// Write to DB
|
||||
updatedMetrics := persistMetrics(metrics)
|
||||
if len(updatedMetrics) > 0 {
|
||||
// sendToMatrix(updatedMetrics)
|
||||
// Sort by counts!
|
||||
sort.Slice(updatedMetrics, func(i, j int) bool {
|
||||
return updatedMetrics[i].MetricValue < updatedMetrics[j].MetricValue
|
||||
})
|
||||
|
||||
sendToMatrix(updatedMetrics)
|
||||
postToMastodon(updatedMetrics)
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue