Fixed book not found when quantity did not exist
the build was successful Details

This commit is contained in:
konrad 2017-11-17 11:26:24 +01:00 committed by kolaente
parent fb305e5b39
commit a3b0d1d94b
Signed by: konrad
GPG Key ID: F40E70337AB24C9B
1 changed files with 2 additions and 4 deletions

View File

@ -67,13 +67,11 @@ func GetBookByID(ID int64) (book Book, exists bool, err error) {
has, err := x.ID(ID).Get(&book)
if has {
// Get the books quantity. We can't join it because xorm ignores the Quantity option in struc
qt := Quantity{BookID: ID}
has, err = x.Desc("id").Get(&qt)
// Get the books quantity. We can't join it because xorm ignores the Quantity option in struct
book.Quantity, err = GetQuantityByBook(ID)
if err != nil {
fmt.Println("Error getting quantity:", err)
}
book.Quantity = qt.Quantity
// Get publisher. We can't join it because xorm ignores the PublisherID option in struct
publisher := Publisher{ID: book.Publisher}