From 86200a9afca64168c84cc028c203d98a1b978fa2 Mon Sep 17 00:00:00 2001 From: The Magician Date: Fri, 13 Sep 2024 20:05:28 +0100 Subject: [PATCH] Fix remove queries and exit loop --- sevenkeys/cli/mainui.go | 2 +- sevenkeys/database/remove.go | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/sevenkeys/cli/mainui.go b/sevenkeys/cli/mainui.go index 94a0a9f..fa25038 100644 --- a/sevenkeys/cli/mainui.go +++ b/sevenkeys/cli/mainui.go @@ -112,7 +112,7 @@ func MainCliLoop(db *sql.DB) { if todo == "r" { logic.RemoveFromStorage(db, location) } else if todo == "n" { - continue + break } else { fmt.Printf("Unrecognized option: %s\n", todo) } diff --git a/sevenkeys/database/remove.go b/sevenkeys/database/remove.go index 5af37cd..5d64d93 100644 --- a/sevenkeys/database/remove.go +++ b/sevenkeys/database/remove.go @@ -3,7 +3,7 @@ package database import "database/sql" func RemoveFromBinder(db *sql.DB, location LocateCardResult) error { - query := `UPDATE CardStorageLocation SET CardPrintingId = NULL WHERE Id = ?;` + query := `UPDATE CardLocation SET CardPrintingId = NULL WHERE Id = ?;` update, err := db.Prepare(query) defer update.Close() @@ -20,7 +20,7 @@ func RemoveFromBinder(db *sql.DB, location LocateCardResult) error { } func RemoveFromBox(db *sql.DB, location LocateCardResult) error { - deleteQuery := `DELETE FROM CardStorageLocation WHERE Id = ?;` + deleteQuery := `DELETE FROM CardLocation WHERE Id = ?;` del, err := db.Prepare(deleteQuery) defer del.Close() @@ -33,7 +33,7 @@ func RemoveFromBox(db *sql.DB, location LocateCardResult) error { return err } - updateQuery := `UPDATE CardStorageLocation SET Position = Position - 1 WHERE Position > ? AND StorageAreaId = ?;` + updateQuery := `UPDATE CardLocation SET Position = Position - 1 WHERE Position > ? AND StorageAreaId = ?;` update, err := db.Prepare(updateQuery) defer update.Close()