From 1a3190ad40a96a048360afb31b80c400452ee5f6 Mon Sep 17 00:00:00 2001 From: The Magician Date: Fri, 13 Sep 2024 12:33:20 +0100 Subject: [PATCH] Remove unnecessary code --- sevenkeys/database/storagearea.go | 14 -------------- sevenkeys/logic/remove.go | 9 ++------- 2 files changed, 2 insertions(+), 21 deletions(-) diff --git a/sevenkeys/database/storagearea.go b/sevenkeys/database/storagearea.go index d916fb2..eab522f 100644 --- a/sevenkeys/database/storagearea.go +++ b/sevenkeys/database/storagearea.go @@ -49,17 +49,3 @@ func InsertStorageArea(db *sql.DB, storageArea StorageArea) error { return nil } - -func GetStorageAreaTypeById(db *sql.DB, storageAreaId int) (string, error) { - var storageType string - - query := `SELECT StorageType FROM StorageArea WHERE Id = ?;` - row := db.QueryRow(query, storageAreaId) - - err := row.Scan(&storageType) - if err != nil { - return storageType, err - } - - return storageType, nil -} diff --git a/sevenkeys/logic/remove.go b/sevenkeys/logic/remove.go index be617a6..6e6e6b5 100644 --- a/sevenkeys/logic/remove.go +++ b/sevenkeys/logic/remove.go @@ -10,14 +10,9 @@ import ( var UnrecognizedStorageAreaTypeError error = errors.New("Unrecognized storage area type.") func RemoveFromStorage(db *sql.DB, location database.LocateCardResult) error { - locationType, err := database.GetStorageAreaTypeById(db, location.CardLocationId) - if err != nil { - return err - } - - if locationType == database.StorageAreaTypeBinder { + if location.StorageAreaType == database.StorageAreaTypeBinder { database.RemoveFromBinder(db, location) - } else if locationType == database.StorageAreaTypeBox { + } else if location.StorageAreaType == database.StorageAreaTypeBox { database.RemoveFromBox(db, location) } else { return UnrecognizedStorageAreaTypeError