Fix: update time doesn't recorded in database

This commit is contained in:
Radhi Fadlillah 2018-03-09 08:13:11 +07:00
parent ffa2497c5f
commit e9d8f3ce12
2 changed files with 4 additions and 2 deletions

View file

@ -210,6 +210,7 @@ func updateBookmarks(indices []string, base model.Bookmark, offline, overwrite b
}
bookmarks[i].Tags = newTags
bookmarks[i].Modified = time.Now().UTC().Format("2006-01-02 15:04:05")
}
result, err := DB.UpdateBookmarks(bookmarks)

View file

@ -379,7 +379,7 @@ func (db *SQLiteDatabase) SearchBookmarks(orderLatest bool, keyword string, tags
FROM bookmark ` + whereClause
if orderLatest {
query += ` ORDER BY modified DESC`
query += ` ORDER BY id DESC`
}
bookmarks := []model.Bookmark{}
@ -432,7 +432,7 @@ func (db *SQLiteDatabase) UpdateBookmarks(bookmarks []model.Bookmark) (result []
// Prepare statement
stmtUpdateBookmark, err := db.Preparex(`UPDATE bookmark SET
url = ?, title = ?, image_url = ?, excerpt = ?, author = ?,
min_read_time = ?, max_read_time = ? WHERE id = ?`)
min_read_time = ?, max_read_time = ?, modified = ? WHERE id = ?`)
checkError(err)
stmtUpdateBookmarkContent, err := db.Preparex(`UPDATE bookmark_content SET
@ -461,6 +461,7 @@ func (db *SQLiteDatabase) UpdateBookmarks(bookmarks []model.Bookmark) (result []
book.Author,
book.MinReadTime,
book.MaxReadTime,
book.Modified,
book.ID)
stmtUpdateBookmarkContent.MustExec(