diff --git a/internal/gomastodonstats/main.go b/internal/gomastodonstats/main.go index 3490882..700ea09 100644 --- a/internal/gomastodonstats/main.go +++ b/internal/gomastodonstats/main.go @@ -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) } }