mirror of
https://github.com/status-im/fathom.git
synced 2025-03-01 03:20:27 +00:00
24 lines
439 B
Go
24 lines
439 B
Go
package count
|
|
|
|
import (
|
|
"log"
|
|
"time"
|
|
|
|
"github.com/usefathom/fathom/pkg/datastore"
|
|
)
|
|
|
|
// CreateVisitorTotals aggregates visitor data into daily totals
|
|
func CreateVisitorTotals(since string) {
|
|
tomorrow := time.Now().AddDate(0, 0, 1).Format("2006-01-02")
|
|
totals, err := datastore.VisitorCountPerDay(tomorrow, since)
|
|
if err != nil {
|
|
log.Fatal(err)
|
|
}
|
|
|
|
err = datastore.SaveVisitorTotals(totals)
|
|
if err != nil {
|
|
log.Fatal(err)
|
|
}
|
|
|
|
}
|