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

chore: minor ui improvements

This commit is contained in:
Ferdinand Mütsch
2021-06-12 12:01:20 +02:00
parent 7c4a2024b6
commit 561198b203
3 changed files with 55 additions and 14 deletions

View File

@@ -6,6 +6,7 @@ import (
"github.com/muety/wakapi/repositories"
"github.com/muety/wakapi/utils"
"github.com/patrickmn/go-cache"
"strings"
"time"
"github.com/muety/wakapi/models"
@@ -90,8 +91,16 @@ func (srv *HeartbeatService) GetEntitySetByUser(entityType uint8, user *models.U
if err != nil {
return nil, err
}
srv.cache.Set(cacheKey, utils.StringsToSet(results), cache.DefaultExpiration)
return results, nil
filtered := make([]string, 0, len(results))
for _, r := range results {
if strings.TrimSpace(r) != "" {
filtered = append(filtered, r)
}
}
srv.cache.Set(cacheKey, utils.StringsToSet(filtered), cache.DefaultExpiration)
return filtered, nil
}
func (srv *HeartbeatService) DeleteBefore(t time.Time) error {