erreur comptage archives

This commit is contained in:
Nicolas Bally 2014-09-08 15:23:31 +02:00
parent e96974fb50
commit 1a09e2b6c6

View File

@ -3,12 +3,13 @@
%ul %ul
-first_month = Article.where(:enabled => true).order(:published_at).first.published_at.beginning_of_month -first_month = Article.where(:enabled => true).order(:published_at).first.published_at.beginning_of_month
-last_month = Article.where(:enabled => true).order(:published_at).last.published_at.beginning_of_month -last_month = Article.where(:enabled => true).order(:published_at).last.published_at.beginning_of_month
-the_month = last_month -the_month = last_month
-while the_month >= first_month -while the_month >= first_month
-articles = Article.where("enabled = ? and published_at > ? and published_at < ?", true, the_month.beginning_of_month, the_month.end_of_month ).count -articles = Article.where("enabled = ? and published_at >= ? and published_at <= ?", true, the_month.beginning_of_month, the_month.end_of_month ).count
-if articles > 0 -if articles > 0
%li=link_to l(the_month.to_date, :format => :only_month)+" (#{articles})", archive_public_article_path(:year => the_month.year, :month => the_month.month) %li=link_to l(the_month.to_date, :format => :only_month)+" (#{articles})", archive_public_article_path(:year => the_month.year, :month => the_month.month)