mirror of
https://github.com/idanoo/go-mastodon-stats
synced 2025-07-02 22:32:19 +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
|
package gomastodonstats
|
||||||
|
|
||||||
import "log"
|
import (
|
||||||
|
"log"
|
||||||
|
"sort"
|
||||||
|
)
|
||||||
|
|
||||||
func Run() {
|
func Run() {
|
||||||
log.Println("Fetching counts")
|
log.Println("Fetching counts")
|
||||||
|
@ -14,7 +17,12 @@ func Run() {
|
||||||
// Write to DB
|
// Write to DB
|
||||||
updatedMetrics := persistMetrics(metrics)
|
updatedMetrics := persistMetrics(metrics)
|
||||||
if len(updatedMetrics) > 0 {
|
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)
|
postToMastodon(updatedMetrics)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue