From 780daac675e10b7861e2d7ba00779a16d8c8fe20 Mon Sep 17 00:00:00 2001 From: Jason Streifling Date: Thu, 28 Mar 2024 07:41:11 +0100 Subject: [PATCH] Fixed bug not showing correct issue in RSS feed --- cmd/main.go | 2 +- cmd/model/articles.go | 5 +++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/cmd/main.go b/cmd/main.go index 7838450..1fc4a91 100644 --- a/cmd/main.go +++ b/cmd/main.go @@ -50,7 +50,7 @@ func main() { mux.HandleFunc("GET /edit-user/", view.EditUser(db, store)) mux.HandleFunc("GET /hub/", view.ShowHub(db, store)) mux.HandleFunc("GET /logout/", view.Logout(store)) - mux.HandleFunc("GET /publish-issue/", view.PublishLatestIssue(db)) + mux.HandleFunc("GET /publish-issue/", view.PublishLatestIssue(db, store)) mux.HandleFunc("GET /rejected-articles/", view.ShowRejectedArticles(db, store)) mux.HandleFunc("GET /rss/", view.ShowRSS( db, diff --git a/cmd/model/articles.go b/cmd/model/articles.go index 8e60e35..4d2a162 100644 --- a/cmd/model/articles.go +++ b/cmd/model/articles.go @@ -105,7 +105,7 @@ func (db *DB) GetArticle(id int64) (*Article, error) { func (db *DB) GetCertainArticles(published, rejected bool) ([]*Article, error) { query := ` - SELECT id, title, created, description, content, author_id + SELECT id, title, created, description, content, author_id, issue_id FROM articles WHERE published = ? AND rejected = ? @@ -121,7 +121,8 @@ func (db *DB) GetCertainArticles(published, rejected bool) ([]*Article, error) { var created []byte if err = rows.Scan(&article.ID, &article.Title, &created, - &article.Description, &article.Content, &article.AuthorID); err != nil { + &article.Description, &article.Content, &article.AuthorID, + &article.IssueID); err != nil { return nil, fmt.Errorf("error scanning article row: %v", err) }