From 5214c4aff4641d5e1b34c952517200f4cd31671f Mon Sep 17 00:00:00 2001 From: Flashfyre Date: Sun, 17 Mar 2024 00:21:04 -0400 Subject: [PATCH] Add mode to seed completion --- api/savedata.go | 2 +- db/savedata.go | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/api/savedata.go b/api/savedata.go index bb7b8d6..b22adfa 100644 --- a/api/savedata.go +++ b/api/savedata.go @@ -278,7 +278,7 @@ func (s *Server) HandleSavedataClear(w http.ResponseWriter, r *http.Request) { newCompletion := false if sessionCompleted { - newCompletion, err = db.TryAddSeedCompletion(uuid, session.Seed) + newCompletion, err = db.TryAddSeedCompletion(uuid, session.Seed, int(session.GameMode)) if err != nil { log.Print("failed to mark seed as completed") } diff --git a/db/savedata.go b/db/savedata.go index bc7fd80..8743567 100644 --- a/db/savedata.go +++ b/db/savedata.go @@ -1,6 +1,6 @@ package db -func TryAddSeedCompletion(uuid []byte, seed string) (bool, error) { +func TryAddSeedCompletion(uuid []byte, seed string, mode int) (bool, error) { if len(seed) < 24 { for range 24 - len(seed) { seed += "0" @@ -15,7 +15,7 @@ func TryAddSeedCompletion(uuid []byte, seed string) (bool, error) { return false, nil } - _, err = handle.Exec("INSERT INTO seedCompletions (uuid, seed, timestamp) VALUES (?, ?, UTC_TIMESTAMP())", uuid, seed) + _, err = handle.Exec("INSERT INTO seedCompletions (uuid, seed, mode, timestamp) VALUES (?, ?, ?, UTC_TIMESTAMP())", uuid, seed, mode) if err != nil { return false, err }