Return correct count of currently-published lang posts

Previously, we'd include scheduled posts, too.

Ref T805
This commit is contained in:
Matt Baer 2021-09-16 15:53:07 -04:00
parent 414d5b0a1c
commit e91748c0bc

View file

@ -1262,7 +1262,7 @@ func (db *datastore) GetPostsTagged(cfg *config.Config, c *Collection, tag strin
func (db *datastore) GetCollLangTotalPosts(collID int64, lang string) (uint64, error) {
var articles uint64
err := db.QueryRow("SELECT COUNT(*) FROM posts WHERE collection_id = ? AND language = ?", collID, lang).Scan(&articles)
err := db.QueryRow("SELECT COUNT(*) FROM posts WHERE collection_id = ? AND language = ? AND created <= "+db.now(), collID, lang).Scan(&articles)
if err != nil && err != sql.ErrNoRows {
log.Error("Couldn't get total lang posts count for collection %d: %v", collID, err)
return 0, err