Add download counter on each book

* Closes: #40
This commit is contained in:
Las Zenow 2018-11-19 03:14:26 +00:00
parent fb399ac973
commit 8b996803c8
5 changed files with 30 additions and 5 deletions

View file

@ -49,11 +49,12 @@ func logoutHandler(h handler) {
}
type bookData struct {
S Status
Book database.Book
Description []string
Lists []database.BookList
UserLists []string
S Status
Book database.Book
Description []string
DownloadCounter int
Lists []database.BookList
UserLists []string
}
func bookHandler(h handler) {
@ -73,6 +74,11 @@ func bookHandler(h handler) {
}
data.S.Title = book.Title + author + " -- " + data.S.Title
data.DownloadCounter, err = h.db.GetDownloadCounter(id)
if err != nil {
log.Error("Error getting download counter: ", err)
}
data.Lists, err = h.db.GetListsByBook(id)
if err != nil {
log.Error("Error getting lists: ", err)