From 2078a3f675c0d0e81cf428860d79073fc131c196 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E3=83=9E=E3=83=AA=E3=82=A6=E3=82=B9?= Date: Thu, 15 Oct 2020 00:22:20 +0100 Subject: [PATCH] Fixed issues with entry ID --- z/database.go | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/z/database.go b/z/database.go index 8fa61ea..e4a0ca1 100644 --- a/z/database.go +++ b/z/database.go @@ -3,6 +3,7 @@ package z import ( "log" "errors" + "strings" "encoding/json" "github.com/tidwall/buntdb" "github.com/google/uuid" @@ -65,7 +66,7 @@ func (database *Database) GetEntry(user string, entryId string) (Entry, error) { dberr := database.DB.View(func(tx *buntdb.Tx) error { tx.AscendKeys(user + ":entry:" + entryId, func(key, value string) bool { json.Unmarshal([]byte(value), &entry) - entry.ID = key + entry.ID = (strings.Split(key, ":"))[2] return true }) @@ -91,7 +92,7 @@ func (database *Database) FinishEntry(user string, entry Entry) (string, error) return errors.New("Specified entry is not currently running!") } - _, _, srerr := tx.Set(user + ":status:running", entry.ID, nil) + _, _, srerr := tx.Set(user + ":status:running", "", nil) if srerr != nil { return srerr }