mirror of
https://github.com/muety/wakapi.git
synced 2023-08-10 21:12:56 +03:00
Fix heartbeats insertion.
Add OS and editor fields. Introduce aggregations (not working yet).
This commit is contained in:
29
services/aggregation.go
Normal file
29
services/aggregation.go
Normal file
@ -0,0 +1,29 @@
|
||||
package services
|
||||
|
||||
import (
|
||||
"database/sql"
|
||||
"fmt"
|
||||
"log"
|
||||
"time"
|
||||
|
||||
"github.com/n1try/wakapi/models"
|
||||
)
|
||||
|
||||
type AggregationService struct {
|
||||
Db *sql.DB
|
||||
HeartbeatService *HeartbeatService
|
||||
}
|
||||
|
||||
func (srv *AggregationService) Aggregate(from time.Time, to time.Time, user *models.User) {
|
||||
heartbeats, err := srv.HeartbeatService.GetAllFrom(from, user)
|
||||
if err != nil {
|
||||
log.Fatal(err)
|
||||
}
|
||||
for _, h := range heartbeats {
|
||||
fmt.Printf("%+v\n", h)
|
||||
}
|
||||
}
|
||||
|
||||
func (srv *AggregationService) aggregateBy(*[]models.Heartbeat, models.AggregationType) *models.Aggregation {
|
||||
return &models.Aggregation{}
|
||||
}
|
Reference in New Issue
Block a user