Skip to content

Commit a399380

Browse files
kranjbarkranjbar
kranjbar
authored and
kranjbar
committed
Fixes sf-wdi-25#2
1 parent fd17e07 commit a399380

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

lib/archives_sidebar/app/views/archives_sidebar/_content.html.erb

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
<% sidebar.archives.each do |month| %>
66
<% counter = sidebar.show_count ? "<em>(#{month[:article_count]})</em>" : "" %>
77
<li>
8-
<%= link_to"#{month[:name]} #{counter}".html_safe, articles_by_month_path( month[:year], "%02i" % (month[:month]+1) ) %>
8+
<%= link_to"#{month[:name]} #{counter}".html_safe, articles_by_month_path( month[:year], "%02i" % (month[:month]) ) %>
99
</li>
1010
<% end %>
1111
</ul>

lib/archives_sidebar/lib/archives_sidebar.rb

+2-2
Original file line numberDiff line numberDiff line change
@@ -30,11 +30,11 @@ def parse_request(_contents, _params)
3030
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])
3131

3232
@archives = article_counts.map do |entry|
33-
month = (entry.month.to_i%12)+1
33+
month = (entry.month.to_i%13)
3434
year = entry.year.to_i
3535
{
3636
name: I18n.l(Date.new(year, month), format: '%B %Y'),
37-
month: month - 1,
37+
month: month,
3838
year: year,
3939
article_count: entry.count
4040
}

0 commit comments

Comments
 (0)