From e7cff35d69346c043b0372fff7fa747097ad8e38 Mon Sep 17 00:00:00 2001 From: Up Date: Wed, 15 May 2024 00:50:50 +0200 Subject: [PATCH] delete vouchers when claiming them --- api/savedata/get.go | 4 ++++ api/savedata/update.go | 5 ----- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/api/savedata/get.go b/api/savedata/get.go index 1e5feeb..3a1cecb 100644 --- a/api/savedata/get.go +++ b/api/savedata/get.go @@ -57,6 +57,10 @@ func Get(uuid []byte, datatype, slot int) (any, error) { if err != nil { return nil, fmt.Errorf("failed to update system save data: %s", err) } + err = db.DeleteClaimedAccountCompensations(uuid) + if err != nil { + return nil, fmt.Errorf("failed to delete claimed compensations: %s", err) + } err = db.UpdateAccountStats(uuid, system.GameStats, system.VoucherCounts) if err != nil { diff --git a/api/savedata/update.go b/api/savedata/update.go index 6876b57..58eee72 100644 --- a/api/savedata/update.go +++ b/api/savedata/update.go @@ -47,11 +47,6 @@ func Update(uuid []byte, slot int, save any) error { return fmt.Errorf("failed to update account stats: %s", err) } - err = db.DeleteClaimedAccountCompensations(uuid) - if err != nil { - return fmt.Errorf("failed to delete claimed compensations: %s", err) - } - return db.StoreSystemSaveData(uuid, save) case defs.SessionSaveData: // Session