Make "start read" icon full when the book is being read in list view
This commit is contained in:
@@ -53,6 +53,23 @@ func TestSearchBook_OneBookRead(t *testing.T) {
|
||||
result.Books)
|
||||
}
|
||||
|
||||
func TestSearchBook_OneBookStartRead(t *testing.T) {
|
||||
result := testSearchBook(t, "Recherches", "", "")
|
||||
assert.Equal(t, int64(1), result.Count)
|
||||
assert.Equal(t,
|
||||
[]dto.BookSearchGetBook{{
|
||||
Title: "Recherches philosophiques",
|
||||
Author: "Ludwig Wittgenstein",
|
||||
ID: 30,
|
||||
Rating: 0,
|
||||
Read: false,
|
||||
StartRead: true,
|
||||
WantRead: false,
|
||||
CoverPath: "/static/bookcover/Recherches-philosophiques.jpg",
|
||||
}},
|
||||
result.Books)
|
||||
}
|
||||
|
||||
func TestSearchBook_ISBN(t *testing.T) {
|
||||
result := testSearchBook(t, "9782070337903", "", "")
|
||||
assert.Equal(t, int64(1), result.Count)
|
||||
|
||||
@@ -53,6 +53,7 @@ type BookSearchGetBook struct {
|
||||
IsInventaireEdition bool `json:"isinventaireedition"`
|
||||
Rating int `json:"rating"`
|
||||
Read bool `json:"read"`
|
||||
StartRead bool `json:"startread"`
|
||||
WantRead bool `json:"wantread"`
|
||||
CoverPath string `json:"coverPath"`
|
||||
}
|
||||
|
||||
@@ -171,7 +171,7 @@ func fetchBookSearchQuery(db *gorm.DB, userId uint, searchterm string) *gorm.DB
|
||||
|
||||
func fetchBookQueryBuilder(db *gorm.DB, userId uint) *gorm.DB {
|
||||
query := db.Model(&model.Book{})
|
||||
query = query.Select("books.id, books.title, authors.name as author, books.small_description as description, books.inventaire_id, user_books.rating, user_books.read, user_books.want_read, " + selectStaticFilesPath())
|
||||
query = query.Select("books.id, books.title, authors.name as author, books.small_description as description, books.inventaire_id, user_books.rating, user_books.read, (user_books.start_read_date IS NOT NULL AND (user_books.read IS NULL OR user_books.read IS FALSE)) as start_read, user_books.want_read, " + selectStaticFilesPath())
|
||||
query = joinAuthors(query)
|
||||
query = query.Joins("left join user_books on (user_books.book_id = books.id and user_books.user_id = ?)", userId)
|
||||
query = joinStaticFiles(query)
|
||||
|
||||
Reference in New Issue
Block a user