From c8b749c4fdb0cd3cbdf3b72e40e6aa3a87bfba8b Mon Sep 17 00:00:00 2001 From: "theletterrsquared@gmail.com" Date: Fri, 5 Feb 2016 12:00:42 -0800 Subject: [PATCH] fixed issue #2 --- .../app/views/archives_sidebar/_content.html.erb | 2 +- lib/archives_sidebar/lib/archives_sidebar.rb | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/archives_sidebar/app/views/archives_sidebar/_content.html.erb b/lib/archives_sidebar/app/views/archives_sidebar/_content.html.erb index 0408211ea..2fbf66c8c 100644 --- a/lib/archives_sidebar/app/views/archives_sidebar/_content.html.erb +++ b/lib/archives_sidebar/app/views/archives_sidebar/_content.html.erb @@ -5,7 +5,7 @@ <% sidebar.archives.each do |month| %> <% counter = sidebar.show_count ? "(#{month[:article_count]})" : "" %>
  • - <%= link_to"#{month[:name]} #{counter}".html_safe, articles_by_month_path( month[:year], "%02i" % (month[:month]) ) %> + <%= link_to"#{month[:name]} #{counter}".html_safe, articles_by_month_path( month[:year], "%02i" % (month[:month])) %>
  • <% end %> diff --git a/lib/archives_sidebar/lib/archives_sidebar.rb b/lib/archives_sidebar/lib/archives_sidebar.rb index 50f789503..9a5e879cb 100644 --- a/lib/archives_sidebar/lib/archives_sidebar.rb +++ b/lib/archives_sidebar/lib/archives_sidebar.rb @@ -30,11 +30,11 @@ def parse_request(_contents, _params) article_counts = Content.find_by_sql(["select count(*) as count, #{date_func} from contents where type='Article' and published = ? and published_at < ? group by year,month order by year desc,month desc limit ? ", true, Time.now, count.to_i]) @archives = article_counts.map do |entry| - month = (entry.month.to_i%12) + month = (entry.month.to_i%13) year = entry.year.to_i { name: I18n.l(Date.new(year, month), format: '%B %Y'), - month: month -1, + month: month, year: year, article_count: entry.count }