Fixed issues with entry ID
This commit is contained in:
parent
abd839ccd4
commit
2078a3f675
1 changed files with 3 additions and 2 deletions
|
@ -3,6 +3,7 @@ package z
|
||||||
import (
|
import (
|
||||||
"log"
|
"log"
|
||||||
"errors"
|
"errors"
|
||||||
|
"strings"
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
"github.com/tidwall/buntdb"
|
"github.com/tidwall/buntdb"
|
||||||
"github.com/google/uuid"
|
"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 {
|
dberr := database.DB.View(func(tx *buntdb.Tx) error {
|
||||||
tx.AscendKeys(user + ":entry:" + entryId, func(key, value string) bool {
|
tx.AscendKeys(user + ":entry:" + entryId, func(key, value string) bool {
|
||||||
json.Unmarshal([]byte(value), &entry)
|
json.Unmarshal([]byte(value), &entry)
|
||||||
entry.ID = key
|
entry.ID = (strings.Split(key, ":"))[2]
|
||||||
return true
|
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!")
|
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 {
|
if srerr != nil {
|
||||||
return srerr
|
return srerr
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue