1
0
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:
Ferdinand Mütsch
2019-05-09 00:07:38 +02:00
parent 3bc706ed4b
commit d1be4ce2a3
8 changed files with 187 additions and 15 deletions

29
services/aggregation.go Normal file
View 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{}
}