Add mode to seed completion

pull/1/head
Flashfyre 9 months ago
parent 2e964b007d
commit 5214c4aff4

@ -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")
}

@ -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
}

Loading…
Cancel
Save