Add comments to submissions

This commit is contained in:
Las Zenow 2018-04-07 23:42:41 +00:00
parent 8d126fbe7a
commit 8bcff3c826
8 changed files with 97 additions and 30 deletions

View file

@ -148,6 +148,7 @@ func saveHandler(h handler) {
type newBook struct {
TitleFound int
AuthorFound int
Comment string
B database.Book
}
type newData struct {
@ -194,6 +195,10 @@ func newHandler(h handler) {
data.Books[i].B = b
_, data.Books[i].TitleFound, _ = h.db.GetBooks("title:"+b.Title, 1, 0)
_, data.Books[i].AuthorFound, _ = h.db.GetBooks("author:"+strings.Join(b.Authors, " author:"), 1, 0)
data.Books[i].Comment, err = h.db.GetComment(b.ID)
if err != nil {
log.Error("Error getting comment for ", b.Title, " (", b.ID, "): ", err)
}
}
data.Page = page + 1
if num > (page+1)*newItemsPage {