From a3b0f488f799020d20c6cd2eb6bb082071bb0455 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?William=20Herg=C3=A8s?= Date: Sat, 17 Jan 2026 22:05:47 +0100 Subject: style(): clean various old things --- user/state.go | 1 + user/xp.go | 7 +++++-- 2 files changed, 6 insertions(+), 2 deletions(-) (limited to 'user') diff --git a/user/state.go b/user/state.go index effdc80..676728b 100644 --- a/user/state.go +++ b/user/state.go @@ -214,6 +214,7 @@ func generateXPs(c *Copaing) []XPCached { i := 0 for _, v := range data { ccs[i] = v + println(v.Time.String(), v.XP) i++ } return ccs diff --git a/user/xp.go b/user/xp.go index c87c450..35c11f3 100644 --- a/user/xp.go +++ b/user/xp.go @@ -51,7 +51,7 @@ func (cc *CopaingCached) GetXPForDays(n uint) uint { } // GetBestXP returns n Copaing with the best XP within d days (d <= cfg.DaysXPRemain; d < 0 <=> d = cfg.DaysXPRemain) -func GetBestXP(ctx context.Context, guildId string, n uint, d int) ([]CopaingCached, error) { +func GetBestXP(ctx context.Context, guildId string, n uint, d int) []CopaingCached { ccs := GetState(ctx).Copaings(guildId) if d > 0 { for _, v := range ccs { @@ -62,5 +62,8 @@ func GetBestXP(ctx context.Context, guildId string, n uint, d int) ([]CopaingCac // desc order return int(b.XP) - int(a.XP) }) - return ccs[:min(len(ccs), int(n))], nil + m := min(len(ccs), int(n)) + res := make([]CopaingCached, m) + copy(ccs[:m], res) + return res } -- cgit v1.2.3