From f6028f38634c548d13232fc9b86a9428e5ec8c81 Mon Sep 17 00:00:00 2001 From: Frédéric Guillot Date: Fri, 26 Oct 2018 19:49:49 -0700 Subject: Improve Fever middleware and handle groupID=0 --- storage/entry.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'storage') diff --git a/storage/entry.go b/storage/entry.go index 0405deb..7617bb6 100644 --- a/storage/entry.go +++ b/storage/entry.go @@ -261,11 +261,14 @@ func (s *Storage) MarkAllAsRead(userID int64) error { defer timer.ExecutionTime(time.Now(), fmt.Sprintf("[Storage:MarkAllAsRead] userID=%d", userID)) query := `UPDATE entries SET status=$1 WHERE user_id=$2 AND status=$3` - _, err := s.db.Exec(query, model.EntryStatusRead, userID, model.EntryStatusUnread) + result, err := s.db.Exec(query, model.EntryStatusRead, userID, model.EntryStatusUnread) if err != nil { return fmt.Errorf("unable to mark all entries as read: %v", err) } + count, _ := result.RowsAffected() + logger.Debug("[Storage:MarkAllAsRead] %d items marked as read", count) + return nil } -- cgit v1.2.3