Fixed book not found when quantity did not exist
the build was successful
Details
the build was successful
Details
This commit is contained in:
parent
fb305e5b39
commit
a3b0d1d94b
|
@ -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}
|
||||
|
|
Loading…
Reference in New Issue