1
0
mirror of https://github.com/muety/wakapi.git synced 2023-08-10 21:12:56 +03:00

Generate summary generation jobs.

This commit is contained in:
Ferdinand Mütsch
2019-10-10 16:47:19 +02:00
parent 851f378684
commit 43f6f33966
4 changed files with 86 additions and 41 deletions

View File

@ -1,6 +1,7 @@
package services
import (
"fmt"
"math"
"sort"
"time"
@ -66,6 +67,14 @@ func (srv *SummaryService) GetSummary(from, to time.Time, user *models.User) (*m
return summary, nil
}
func (srv *SummaryService) SaveSummary(summary *models.Summary) error {
fmt.Println("Saving summary", summary)
if err := srv.Db.Create(summary).Error; err != nil {
return err
}
return nil
}
func (srv *SummaryService) GetLatestUserSummaries() ([]*models.Summary, error) {
var summaries []*models.Summary
if err := srv.Db.